From 84c96b0a6d1c010574e869e7068c7050166e2970 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 2 Dec 2021 03:03:16 +0000 Subject: [PATCH] CodeGen from PR 16940 in Azure/azure-rest-api-specs Merge a33a1ab2a7b987c16a393ba3dd76ab99e2df2bf7 into 3c5135f8325eaf79be7b137cae363bdcba028c17 --- ...etentionPoliciesCreateOrUpdateOperation.cs | 72 -- ...hortTermRetentionPoliciesRestOperations.cs | 8 +- .../Generated/CapabilitiesRestOperations.cs | 2 +- .../DataWarehouseUserActivitiesOperations.cs | 192 ++++ ...aWarehouseUserActivitiesRestOperations.cs} | 142 ++- .../Generated/DatabaseAdvisorsOperations.cs | 170 ++++ .../DatabaseAdvisorsRestOperations.cs | 387 ++++++++ .../DatabaseAutomaticTuningRestOperations.cs | 4 +- ...abaseBlobAuditingPoliciesRestOperations.cs | 6 +- .../Generated/DatabaseColumnsOperations.cs | 337 +++++++ .../DatabaseColumnsRestOperations.cs | 656 +++++++++++++ ...tabaseExtensionsCreateOrUpdateOperation.cs | 72 ++ .../Generated/DatabaseExtensionsOperations.cs | 282 ++++++ .../DatabaseExtensionsRestOperations.cs | 448 +++++++++ .../DatabaseRecommendedActionsOperations.cs | 174 ++++ ...atabaseRecommendedActionsRestOperations.cs | 417 ++++++++ .../src/Generated/DatabaseRestOperations.cs | 4 +- ...ations.cs => DatabaseSchemasOperations.cs} | 104 +- .../DatabaseSchemasRestOperations.cs | 354 +++++++ ...DatabaseSecurityAlertPoliciesOperations.cs | 236 +++++ ...baseSecurityAlertPoliciesRestOperations.cs | 453 +++++++++ .../src/Generated/DatabaseTablesOperations.cs | 206 ++++ .../Generated/DatabaseTablesRestOperations.cs | 388 ++++++++ ...tabaseThreatDetectionPoliciesOperations.cs | 127 --- .../src/Generated/DatabaseUsagesOperations.cs | 42 +- .../Generated/DatabaseUsagesRestOperations.cs | 103 +- ...tyAssessmentRuleBaselinesRestOperations.cs | 6 +- ...nerabilityAssessmentScansRestOperations.cs | 132 +-- ...eVulnerabilityAssessmentsRestOperations.cs | 8 +- .../src/Generated/DatabasesExportOperation.cs | 22 +- .../src/Generated/DatabasesImportOperation.cs | 20 +- .../src/Generated/DatabasesOperations.cs | 384 ++++---- .../src/Generated/DatabasesRestOperations.cs | 812 +++++++++------- .../src/Generated/DeletedServersOperations.cs | 302 ++++++ .../DeletedServersRecoverOperation.cs | 72 ++ .../Generated/DeletedServersRestOperations.cs | 477 +++++++++ .../Generated/ElasticPoolRestOperations.cs | 4 +- .../Generated/ElasticPoolsRestOperations.cs | 12 +- .../EncryptionProtectorsOperations.cs | 68 +- .../EncryptionProtectorsRestOperations.cs | 164 ++-- ...abaseBlobAuditingPoliciesRestOperations.cs | 6 +- ...erverBlobAuditingPoliciesRestOperations.cs | 6 +- .../Generated/FailoverGroupsRestOperations.cs | 14 +- .../src/Generated/FirewallRulesOperations.cs | 102 +- .../Generated/FirewallRulesRestOperations.cs | 263 ++++- .../InstanceFailoverGroupsRestOperations.cs | 12 +- .../Generated/InstancePoolsRestOperations.cs | 12 +- .../src/Generated/JobAgentsRestOperations.cs | 10 +- .../Generated/JobCredentialsRestOperations.cs | 8 +- .../Generated/JobExecutionsRestOperations.cs | 12 +- .../JobStepExecutionsRestOperations.cs | 4 +- .../src/Generated/JobStepsRestOperations.cs | 12 +- .../JobTargetExecutionsRestOperations.cs | 6 +- .../JobTargetGroupsRestOperations.cs | 8 +- .../Generated/JobVersionsRestOperations.cs | 4 +- .../src/Generated/JobsRestOperations.cs | 8 +- ...gerDigestUploadsCreateOrUpdateOperation.cs | 72 ++ .../LedgerDigestUploadsDisableOperation.cs | 72 ++ .../LedgerDigestUploadsOperations.cs | 346 +++++++ .../LedgerDigestUploadsRestOperations.cs | 535 ++++++++++ ...tionBackupsCopyByResourceGroupOperation.cs | 72 ++ .../LongTermRetentionBackupsCopyOperation.cs | 72 ++ .../LongTermRetentionBackupsOperations.cs | 680 ++++++++++--- .../LongTermRetentionBackupsRestOperations.cs | 920 +++++++++++++----- ...onBackupsUpdateByResourceGroupOperation.cs | 72 ++ ...LongTermRetentionBackupsUpdateOperation.cs | 72 ++ ...ionManagedInstanceBackupsRestOperations.cs | 20 +- ...etentionPoliciesCreateOrUpdateOperation.cs | 72 ++ ...=> LongTermRetentionPoliciesOperations.cs} | 137 ++- ...LongTermRetentionPoliciesRestOperations.cs | 443 +++++++++ .../MaintenanceWindowOptionsOperations.cs | 83 ++ ...MaintenanceWindowOptionsRestOperations.cs} | 55 +- .../Generated/MaintenanceWindowsOperations.cs | 127 +++ ...cs => MaintenanceWindowsRestOperations.cs} | 115 +-- ...hortTermRetentionPoliciesRestOperations.cs | 8 +- .../ManagedDatabaseColumnsOperations.cs | 337 +++++++ .../ManagedDatabaseColumnsRestOperations.cs | 656 +++++++++++++ .../ManagedDatabaseQueriesOperations.cs | 208 ++++ .../ManagedDatabaseQueriesRestOperations.cs | 392 ++++++++ ...eRecommendedSensitivityLabelsOperations.cs | 83 ++ ...ommendedSensitivityLabelsRestOperations.cs | 144 +++ ...ManagedDatabaseRestoreDetailsOperations.cs | 4 +- ...gedDatabaseRestoreDetailsRestOperations.cs | 6 +- .../ManagedDatabaseSchemasOperations.cs | 194 ++++ .../ManagedDatabaseSchemasRestOperations.cs | 354 +++++++ ...baseSecurityAlertPoliciesRestOperations.cs | 6 +- ...ManagedDatabaseSecurityEventsOperations.cs | 158 +++ ...gedDatabaseSecurityEventsRestOperations.cs | 271 ++++++ ...agedDatabaseSensitivityLabelsOperations.cs | 74 +- ...DatabaseSensitivityLabelsRestOperations.cs | 185 +++- .../ManagedDatabaseTablesOperations.cs | 206 ++++ .../ManagedDatabaseTablesRestOperations.cs | 388 ++++++++ ...baseTransparentDataEncryptionOperations.cs | 236 +++++ ...TransparentDataEncryptionRestOperations.cs | 453 +++++++++ ...tyAssessmentRuleBaselinesRestOperations.cs | 6 +- ...eVulnerabilityAssessmentScansOperations.cs | 48 +- ...nerabilityAssessmentScansRestOperations.cs | 180 ++-- ...eVulnerabilityAssessmentsRestOperations.cs | 8 +- .../Generated/ManagedDatabasesOperations.cs | 28 +- .../ManagedDatabasesRestOperations.cs | 180 ++-- ...ManagedInstanceAdministratorsOperations.cs | 38 +- ...gedInstanceAdministratorsRestOperations.cs | 50 +- ...yAuthenticationsCreateOrUpdateOperation.cs | 72 ++ ...ureADOnlyAuthenticationsDeleteOperation.cs | 68 ++ ...nceAzureADOnlyAuthenticationsOperations.cs | 314 ++++++ ...zureADOnlyAuthenticationsRestOperations.cs | 479 +++++++++ ...tanceEncryptionProtectorsRestOperations.cs | 8 +- .../ManagedInstanceKeysRestOperations.cs | 8 +- ...LongTermRetentionPoliciesRestOperations.cs | 6 +- .../Generated/ManagedInstanceOperations.cs | 32 +- ...pointConnectionsCreateOrUpdateOperation.cs | 72 ++ ...ivateEndpointConnectionsDeleteOperation.cs | 68 ++ ...ncePrivateEndpointConnectionsOperations.cs | 330 +++++++ ...rivateEndpointConnectionsRestOperations.cs | 501 ++++++++++ ...dInstancePrivateLinkResourcesOperations.cs | 180 ++++ ...tancePrivateLinkResourcesRestOperations.cs | 312 ++++++ .../ManagedInstanceRestOperations.cs | 102 +- ...edInstanceTdeCertificatesRestOperations.cs | 2 +- ...tanceVulnerabilityAssessmentsOperations.cs | 4 +- ...eVulnerabilityAssessmentsRestOperations.cs | 12 +- .../Generated/ManagedInstancesOperations.cs | 300 ++++-- .../ManagedInstancesRestOperations.cs | 515 +++++++--- ...etentionPoliciesCreateOrUpdateOperation.cs | 2 +- ...kupShortTermRetentionPoliciesOperations.cs | 16 +- ...hortTermRetentionPoliciesRestOperations.cs | 24 +- ...ortTermRetentionPoliciesUpdateOperation.cs | 2 +- ...edServerSecurityAlertPoliciesOperations.cs | 8 +- ...rverSecurityAlertPoliciesRestOperations.cs | 18 +- .../Generated/Models/Advisor.Serialization.cs | 147 +++ .../src/Generated/Models/Advisor.cs | 64 ++ .../Models/AdvisorStatus.Serialization.cs | 32 + .../src/Generated/Models/AdvisorStatus.cs | 22 + .../Models/AggregationFunctionType.cs | 60 ++ .../AuthenticationType.Serialization.cs | 28 - .../Generated/Models/AuthenticationType.cs | 18 - .../Models/AutoExecuteStatus.Serialization.cs | 30 + .../src/Generated/Models/AutoExecuteStatus.cs | 20 + ...xecuteStatusInheritedFrom.Serialization.cs | 34 + .../Models/AutoExecuteStatusInheritedFrom.cs | 24 + .../Models/BackupStorageRedundancy.cs | 57 ++ .../Models/BlobAuditingPolicyState.cs | 2 +- .../src/Generated/Models/ColumnDataType.cs | 147 +++ ...RetentionBackupParameters.Serialization.cs | 54 + .../CopyLongTermRetentionBackupParameters.cs | 31 + .../src/Generated/Models/CreatedByType.cs | 57 ++ ...taWarehouseUserActivities.Serialization.cs | 73 ++ .../Models/DataWarehouseUserActivities.cs | 31 + ...eUserActivitiesListResult.Serialization.cs | 46 + .../DataWarehouseUserActivitiesListResult.cs | 36 + .../Models/DataWarehouseUserActivityName.cs | 48 + .../Models/Database.Serialization.cs | 143 ++- .../src/Generated/Models/Database.cs | 54 +- ...atabaseBlobAuditingPolicy.Serialization.cs | 106 +- .../Models/DatabaseBlobAuditingPolicy.cs | 86 +- .../Models/DatabaseColumn.Serialization.cs | 126 +++ .../src/Generated/Models/DatabaseColumn.cs | 43 + .../DatabaseColumnListResult.Serialization.cs | 46 + .../Models/DatabaseColumnListResult.cs | 36 + .../src/Generated/Models/DatabaseEdition.cs | 111 --- .../DatabaseExtensions.Serialization.cs | 116 +++ .../Generated/Models/DatabaseExtensions.cs | 43 + .../Models/DatabaseIdentity.Serialization.cs | 112 +++ .../src/Generated/Models/DatabaseIdentity.cs | 46 + .../Generated/Models/DatabaseIdentityType.cs | 51 + .../src/Generated/Models/DatabaseReadScale.cs | 2 +- .../Models/DatabaseSchema.Serialization.cs | 47 + .../src/Generated/Models/DatabaseSchema.cs | 26 + .../DatabaseSchemaListResult.Serialization.cs | 46 + .../Models/DatabaseSchemaListResult.cs | 36 + ...seSecurityAlertListResult.Serialization.cs | 46 + .../Models/DatabaseSecurityAlertListResult.cs | 36 + ...tabaseSecurityAlertPolicy.Serialization.cs | 93 +- .../Models/DatabaseSecurityAlertPolicy.cs | 58 +- .../src/Generated/Models/DatabaseStatus.cs | 9 + ...tion.cs => DatabaseTable.Serialization.cs} | 34 +- .../src/Generated/Models/DatabaseTable.cs | 35 + .../DatabaseTableListResult.Serialization.cs | 46 + .../Models/DatabaseTableListResult.cs | 36 + .../Models/DatabaseUpdate.Serialization.cs | 41 +- .../src/Generated/Models/DatabaseUpdate.cs | 26 +- .../Models/DatabaseUsage.Serialization.cs | 87 +- .../src/Generated/Models/DatabaseUsage.cs | 41 +- .../DatabaseUsageListResult.Serialization.cs | 15 +- .../Models/DatabaseUsageListResult.cs | 26 +- .../DatabaseUserIdentity.Serialization.cs | 52 + .../Generated/Models/DatabaseUserIdentity.cs | 34 + .../Models/DatabaseVulnerabilityAssessment.cs | 4 +- .../src/Generated/Models/DayOfWeek.cs | 66 ++ .../Models/Delegation.Serialization.cs | 52 + .../src/Generated/Models/Delegation.cs | 34 + .../Models/DeletedServer.Serialization.cs | 92 ++ .../src/Generated/Models/DeletedServer.cs | 45 + .../DeletedServerListResult.Serialization.cs | 46 + .../Models/DeletedServerListResult.cs | 36 + ...DnsRefreshConfigurationPropertiesStatus.cs | 51 + .../Models/ElasticPool.Serialization.cs | 13 +- .../src/Generated/Models/ElasticPool.cs | 6 +- .../Generated/Models/ElasticPoolEdition.cs | 60 -- ...erformanceLevelCapability.Serialization.cs | 18 +- .../ElasticPoolPerformanceLevelCapability.cs | 7 +- .../Models/ElasticPoolUpdate.Serialization.cs | 5 + .../src/Generated/Models/ElasticPoolUpdate.cs | 2 + .../EncryptionProtector.Serialization.cs | 18 +- .../Generated/Models/EncryptionProtector.cs | 6 +- .../Generated/Models/{Enum65.cs => Enum60.cs} | 32 +- ...ExportDatabaseDefinition.Serialization.cs} | 13 +- ...Request.cs => ExportDatabaseDefinition.cs} | 34 +- ...atabaseBlobAuditingPolicy.Serialization.cs | 106 +- .../ExtendedDatabaseBlobAuditingPolicy.cs | 86 +- ...dServerBlobAuditingPolicy.Serialization.cs | 110 ++- .../ExtendedServerBlobAuditingPolicy.cs | 114 ++- .../src/Generated/Models/ExtensionName.cs | 48 - .../Models/FirewallRule.Serialization.cs | 19 +- .../src/Generated/Models/FirewallRule.cs | 22 +- .../Models/FirewallRuleList.Serialization.cs | 31 + .../src/Generated/Models/FirewallRuleList.cs | 24 + .../FirewallRuleListResult.Serialization.cs | 8 +- .../Models/FirewallRuleListResult.cs | 12 +- .../src/Generated/Models/IdentityType.cs | 9 + .../ImplementationMethod.Serialization.cs | 28 + .../Generated/Models/ImplementationMethod.cs | 18 + ...istingDatabaseDefinition.Serialization.cs} | 11 +- .../ImportExistingDatabaseDefinition.cs | 63 ++ ...nsionsOperationListResult.Serialization.cs | 46 + ...portExportExtensionsOperationListResult.cs | 36 + ...xtensionsOperationResult.Serialization.cs} | 42 +- .../ImportExportExtensionsOperationResult.cs | 57 ++ ...portExportOperationResult.Serialization.cs | 139 +++ .../Models/ImportExportOperationResult.cs | 72 ++ .../Generated/Models/ImportExportResponse.cs | 65 -- .../Models/ImportExtensionProperties.cs | 47 - .../ImportExtensionRequest.Serialization.cs | 69 -- .../Models/ImportExtensionRequest.cs | 38 - ...portNewDatabaseDefinition.Serialization.cs | 61 ++ .../Models/ImportNewDatabaseDefinition.cs | 71 ++ .../Models/ImportRequest.Serialization.cs | 44 - .../src/Generated/Models/ImportRequest.cs | 116 --- .../Models/IsRetryable.Serialization.cs | 28 + .../src/Generated/Models/IsRetryable.cs | 18 + .../src/Generated/Models/JobSchedule.cs | 4 +- .../LedgerDigestUploads.Serialization.cs | 84 ++ .../Generated/Models/LedgerDigestUploads.cs | 35 + ...erDigestUploadsListResult.Serialization.cs | 46 + .../Models/LedgerDigestUploadsListResult.cs | 36 + .../Models/LedgerDigestUploadsName.cs | 48 + .../LedgerDigestUploadsState.Serialization.cs | 28 + ...Default.cs => LedgerDigestUploadsState.cs} | 4 +- ...TransparentDataEncryption.Serialization.cs | 78 ++ ...ogicalDatabaseTransparentDataEncryption.cs | 31 + ...tDataEncryptionListResult.Serialization.cs | 46 + ...baseTransparentDataEncryptionListResult.cs | 36 + .../LongTermRetentionBackup.Serialization.cs | 29 +- .../Models/LongTermRetentionBackup.cs | 10 +- ...tionBackupOperationResult.Serialization.cs | 115 +++ .../LongTermRetentionBackupOperationResult.cs | 57 ++ .../Models/LongTermRetentionDatabaseState.cs | 54 - ... LongTermRetentionPolicy.Serialization.cs} | 6 +- ...onPolicy.cs => LongTermRetentionPolicy.cs} | 10 +- ...RetentionPolicyListResult.Serialization.cs | 46 + .../LongTermRetentionPolicyListResult.cs | 36 + ...ceConfigurationCapability.Serialization.cs | 57 ++ .../MaintenanceConfigurationCapability.cs | 40 + .../MaintenanceWindowOptions.Serialization.cs | 185 ++++ .../Models/MaintenanceWindowOptions.cs | 59 ++ ...aintenanceWindowTimeRange.Serialization.cs | 67 ++ .../Models/MaintenanceWindowTimeRange.cs | 36 + .../MaintenanceWindows.Serialization.cs | 89 ++ .../Generated/Models/MaintenanceWindows.cs | 34 + .../ManagedDatabaseSecurityAlertPolicy.cs | 4 +- .../Models/ManagedInstance.Serialization.cs | 115 ++- .../src/Generated/Models/ManagedInstance.cs | 37 +- ...AzureADOnlyAuthListResult.Serialization.cs | 46 + ...anagedInstanceAzureADOnlyAuthListResult.cs | 36 + ...AzureADOnlyAuthentication.Serialization.cs | 78 ++ ...anagedInstanceAzureADOnlyAuthentication.cs | 31 + ...InstanceEditionCapability.Serialization.cs | 29 +- .../ManagedInstanceEditionCapability.cs | 11 +- ...stanceEncryptionProtector.Serialization.cs | 18 +- .../ManagedInstanceEncryptionProtector.cs | 6 +- ...anceExternalAdministrator.Serialization.cs | 121 +++ .../ManagedInstanceExternalAdministrator.cs | 50 + .../ManagedInstanceKey.Serialization.cs | 13 +- .../Generated/Models/ManagedInstanceKey.cs | 6 +- ...ceLongTermRetentionBackup.Serialization.cs | 13 +- .../ManagedInstanceLongTermRetentionBackup.cs | 6 +- ...ceConfigurationCapability.Serialization.cs | 46 + ...tanceMaintenanceConfigurationCapability.cs | 36 + ...anagedInstancePecProperty.Serialization.cs | 40 + .../Models/ManagedInstancePecProperty.cs | 32 + ...PrivateEndpointConnection.Serialization.cs | 100 ++ ...anagedInstancePrivateEndpointConnection.cs | 39 + ...pointConnectionListResult.Serialization.cs | 46 + ...ancePrivateEndpointConnectionListResult.cs | 36 + ...pointConnectionProperties.Serialization.cs | 51 + ...ancePrivateEndpointConnectionProperties.cs | 36 + ...cePrivateEndpointProperty.Serialization.cs | 40 + .../ManagedInstancePrivateEndpointProperty.cs | 28 + ...anagedInstancePrivateLink.Serialization.cs | 58 ++ .../Models/ManagedInstancePrivateLink.cs | 31 + ...ancePrivateLinkListResult.Serialization.cs | 46 + .../ManagedInstancePrivateLinkListResult.cs | 36 + ...ancePrivateLinkProperties.Serialization.cs | 46 + .../ManagedInstancePrivateLinkProperties.cs | 36 + ...ceConnectionStateProperty.Serialization.cs | 51 + ...ivateLinkServiceConnectionStateProperty.cs | 19 +- ...agedInstancePropertiesProvisioningState.cs | 27 + .../ManagedInstanceQuery.Serialization.cs | 73 ++ .../Generated/Models/ManagedInstanceQuery.cs | 31 + ...edInstanceQueryStatistics.Serialization.cs | 46 + .../Models/ManagedInstanceQueryStatistics.cs | 36 + .../ManagedInstanceUpdate.Serialization.cs | 35 + .../Generated/Models/ManagedInstanceUpdate.cs | 19 + ...dInstanceVcoresCapability.Serialization.cs | 18 +- .../Models/ManagedInstanceVcoresCapability.cs | 7 +- .../ManagedInstanceVulnerabilityAssessment.cs | 8 +- ...ServerSecurityAlertPolicy.Serialization.cs | 17 +- .../ManagedServerSecurityAlertPolicy.cs | 12 +- ...TransparentDataEncryption.Serialization.cs | 78 ++ .../ManagedTransparentDataEncryption.cs | 31 + ...tDataEncryptionListResult.Serialization.cs | 46 + ...agedTransparentDataEncryptionListResult.cs | 36 + .../src/Generated/Models/MetricType.cs | 60 ++ .../NetworkIsolationSettings.Serialization.cs | 31 + .../Models/NetworkIsolationSettings.cs | 23 + .../src/Generated/Models/OperationImpact.cs | 15 +- .../src/Generated/Models/OperationMode.cs | 48 + .../OutboundFirewallRule.Serialization.cs | 68 ++ .../Generated/Models/OutboundFirewallRule.cs | 31 + ...undFirewallRuleListResult.Serialization.cs | 46 + .../Models/OutboundFirewallRuleListResult.cs | 36 + .../src/Generated/Models/PrincipalType.cs | 54 + ...PrivateEndpointConnection.Serialization.cs | 11 +- .../Models/PrivateEndpointConnection.cs | 4 +- ...pointConnectionProperties.Serialization.cs | 4 +- .../PrivateEndpointConnectionProperties.cs | 4 +- ...ntConnectionRequestStatus.Serialization.cs | 41 + .../PrivateEndpointConnectionRequestStatus.cs | 36 + ...ateLinkResourceProperties.Serialization.cs | 18 +- .../Models/PrivateLinkResourceProperties.cs | 7 +- ...ceConnectionStateProperty.Serialization.cs | 17 +- ...ivateLinkServiceConnectionStateProperty.cs | 14 +- ...tatePropertyAutoGenerated.Serialization.cs | 46 - ...iceConnectionStatePropertyAutoGenerated.cs | 48 - ...yResourceWithWritableName.Serialization.cs | 52 + .../Models/ProxyResourceWithWritableName.cs | 26 + .../QueryMetricInterval.Serialization.cs | 84 ++ .../Generated/Models/QueryMetricInterval.cs | 44 + .../QueryMetricProperties.Serialization.cs | 118 +++ .../Generated/Models/QueryMetricProperties.cs | 60 ++ .../Generated/Models/QueryMetricUnitType.cs | 57 ++ .../Models/QueryStatistics.Serialization.cs | 113 +++ .../src/Generated/Models/QueryStatistics.cs | 51 + ...QueryStatisticsProperties.Serialization.cs | 64 ++ .../Models/QueryStatisticsProperties.cs | 48 + .../Generated/Models/QueryTimeGrainType.cs | 51 + .../Models/RecommendedAction.Serialization.cs | 344 +++++++ .../src/Generated/Models/RecommendedAction.cs | 136 +++ .../Models/RecommendedActionCurrentState.cs | 87 ++ ...ecommendedActionErrorInfo.Serialization.cs | 40 + .../Models/RecommendedActionErrorInfo.cs | 32 + ...mendedActionImpactRecord.Serialization.cs} | 23 +- .../Models/RecommendedActionImpactRecord.cs | 44 + ...dActionImplementationInfo.Serialization.cs | 40 + .../RecommendedActionImplementationInfo.cs | 32 + ...ommendedActionInitiatedBy.Serialization.cs | 28 + .../Models/RecommendedActionInitiatedBy.cs | 18 + ...commendedActionMetricInfo.Serialization.cs | 64 ++ .../Models/RecommendedActionMetricInfo.cs | 46 + ...ecommendedActionStateInfo.Serialization.cs | 60 ++ .../Models/RecommendedActionStateInfo.cs | 40 + .../RecommendedElasticPool.Serialization.cs | 215 ---- .../Models/RecommendedElasticPool.cs | 77 -- ...sticPoolListMetricsResult.Serialization.cs | 35 - ...RecommendedElasticPoolListMetricsResult.cs | 40 - ...ndedElasticPoolListResult.Serialization.cs | 35 - .../RecommendedElasticPoolListResult.cs | 40 - ...ommendedElasticPoolMetric.Serialization.cs | 57 -- .../Models/RecommendedElasticPoolMetric.cs | 38 - .../src/Generated/Models/RecommendedIndex.cs | 83 -- .../RecommendedIndexAction.Serialization.cs | 30 - .../Models/RecommendedIndexAction.cs | 20 - .../RecommendedIndexState.Serialization.cs | 46 - .../Generated/Models/RecommendedIndexState.cs | 36 - .../RecommendedIndexType.Serialization.cs | 32 - .../Generated/Models/RecommendedIndexType.cs | 22 - ...dedSensitivityLabelUpdate.Serialization.cs | 111 +++ .../RecommendedSensitivityLabelUpdate.cs | 42 + ...ensitivityLabelUpdateKind.Serialization.cs | 28 + .../RecommendedSensitivityLabelUpdateKind.cs | 18 + ...ensitivityLabelUpdateList.Serialization.cs | 31 + .../RecommendedSensitivityLabelUpdateList.cs | 24 + .../Models/ReplicationLink.Serialization.cs | 53 +- .../src/Generated/Models/ReplicationLink.cs | 60 +- ...ReplicationLinkListResult.Serialization.cs | 8 +- .../Models/ReplicationLinkListResult.cs | 12 +- .../Generated/Models/ReplicationLinkType.cs | 51 + .../src/Generated/Models/ReplicationRole.cs | 2 +- .../src/Generated/Models/ReplicationState.cs | 2 +- .../Models/ResourceIdentity.Serialization.cs | 30 +- .../src/Generated/Models/ResourceIdentity.cs | 9 +- .../ResourceWithWritableName.Serialization.cs | 52 + .../Models/ResourceWithWritableName.cs | 36 + ...RestorableDroppedDatabase.Serialization.cs | 89 +- .../Models/RestorableDroppedDatabase.cs | 43 +- ...DroppedDatabaseListResult.Serialization.cs | 15 +- .../RestorableDroppedDatabaseListResult.cs | 26 +- .../src/Generated/Models/SecondaryType.cs | 51 + ...tPolicyEmailAccountAdmins.Serialization.cs | 28 - .../Models/SecurityAlertPolicyName.cs | 4 +- .../SecurityAlertPolicyNameAutoGenerated.cs | 48 - .../Models/SecurityAlertPolicyState.cs | 2 +- ...ertPolicyUseServerDefault.Serialization.cs | 28 - ...SecurityAlertsPolicyState.Serialization.cs | 28 + ...Admins.cs => SecurityAlertsPolicyState.cs} | 4 +- .../Models/SecurityEvent.Serialization.cs | 132 +++ .../src/Generated/Models/SecurityEvent.cs | 65 ++ .../SecurityEventCollection.Serialization.cs | 46 + .../Models/SecurityEventCollection.cs | 36 + ...ctionAdditionalProperties.Serialization.cs | 85 ++ ...tyEventSqlInjectionAdditionalProperties.cs | 52 + .../Models/SecurityEventType.Serialization.cs | 30 + .../src/Generated/Models/SecurityEventType.cs | 20 + .../Models/SecurityEventsFilterParameters.cs | 25 + .../Models/SensitivityLabel.Serialization.cs | 26 +- .../src/Generated/Models/SensitivityLabel.cs | 18 +- .../SensitivityLabelUpdate.Serialization.cs | 127 +++ .../Models/SensitivityLabelUpdate.cs | 46 + ...ensitivityLabelUpdateKind.Serialization.cs | 28 + .../Models/SensitivityLabelUpdateKind.cs | 18 + ...ensitivityLabelUpdateList.Serialization.cs | 31 + .../Models/SensitivityLabelUpdateList.cs | 24 + .../Generated/Models/Server.Serialization.cs | 88 +- .../src/Generated/Models/Server.cs | 28 +- .../ServerBlobAuditingPolicy.Serialization.cs | 102 +- .../Models/ServerBlobAuditingPolicy.cs | 108 +- .../ServerConnectionPolicy.Serialization.cs | 16 +- .../Models/ServerConnectionPolicy.cs | 12 +- ...onnectionPolicyListResult.Serialization.cs | 46 + .../ServerConnectionPolicyListResult.cs | 36 + .../ServerConnectionType.Serialization.cs | 30 - .../Generated/Models/ServerConnectionType.cs | 44 +- ...psAuditSettingsListResult.Serialization.cs | 46 + .../ServerDevOpsAuditSettingsListResult.cs | 36 + ...verDevOpsAuditingSettings.Serialization.cs | 144 +++ .../Models/ServerDevOpsAuditingSettings.cs | 121 +++ ...ServerDnsAliasAcquisition.Serialization.cs | 7 +- .../Models/ServerDnsAliasAcquisition.cs | 16 +- ...rverExternalAdministrator.Serialization.cs | 121 +++ .../Models/ServerExternalAdministrator.cs | 50 + .../Models/ServerInfo.Serialization.cs | 37 + .../src/Generated/Models/ServerInfo.cs | 31 + .../Models/ServerKey.Serialization.cs | 28 +- .../src/Generated/Models/ServerKey.cs | 16 +- .../Models/ServerNetworkAccessFlag.cs | 51 + ...on.cs => ServerOperation.Serialization.cs} | 122 +-- .../src/Generated/Models/ServerOperation.cs | 81 ++ ...ServerOperationListResult.Serialization.cs | 46 + .../Models/ServerOperationListResult.cs | 36 + .../Models/ServerPublicNetworkAccess.cs | 51 - ...ServerSecurityAlertPolicy.Serialization.cs | 17 +- .../Models/ServerSecurityAlertPolicy.cs | 12 +- .../Models/ServerTrustGroup.Serialization.cs | 115 +++ .../src/Generated/Models/ServerTrustGroup.cs | 40 + ...erverTrustGroupListResult.Serialization.cs | 46 + .../Models/ServerTrustGroupListResult.cs | 36 + ...rverTrustGroupPropertiesTrustScopesItem.cs | 51 + .../Models/ServerUpdate.Serialization.cs | 30 + .../src/Generated/Models/ServerUpdate.cs | 17 +- .../Models/ServerVulnerabilityAssessment.cs | 8 +- .../Models/ServerWorkspaceFeature.cs | 51 + ...erviceObjectiveCapability.Serialization.cs | 18 +- .../Models/ServiceObjectiveCapability.cs | 7 +- .../Generated/Models/ServiceObjectiveName.cs | 4 +- .../Models/ServicePrincipal.Serialization.cs | 63 ++ .../src/Generated/Models/ServicePrincipal.cs | 40 + .../Generated/Models/ServicePrincipalType.cs | 51 + .../ServiceTierAdvisor.Serialization.cs | 253 ----- .../Generated/Models/ServiceTierAdvisor.cs | 108 -- ...viceTierAdvisorListResult.Serialization.cs | 35 - .../Models/ServiceTierAdvisorListResult.cs | 40 - .../Models/SloUsageMetric.Serialization.cs | 57 -- .../src/Generated/Models/SloUsageMetric.cs | 13 +- .../SqlAgentConfiguration.Serialization.cs | 78 ++ .../Generated/Models/SqlAgentConfiguration.cs | 31 + .../SqlAgentConfigurationPropertiesState.cs | 51 + .../Models/StorageKeyType.Serialization.cs | 28 - .../src/Generated/Models/StorageKeyType.cs | 43 +- .../Models/SyncGroup.Serialization.cs | 56 +- .../src/Generated/Models/SyncGroup.cs | 18 +- .../Models/SyncMember.Serialization.cs | 8 +- .../src/Generated/Models/SyncMember.cs | 6 +- .../Models/SystemData.Serialization.cs | 80 ++ .../src/Generated/Models/SystemData.cs | 50 + .../src/Generated/Models/TableTemporalType.cs | 54 + .../Models/TimeZone.Serialization.cs | 74 ++ .../src/Generated/Models/TimeZone.cs | 35 + .../TimeZoneListResult.Serialization.cs | 46 + .../Generated/Models/TimeZoneListResult.cs | 36 + .../Models/TopQueries.Serialization.cs | 86 ++ .../src/Generated/Models/TopQueries.cs | 56 ++ .../TopQueriesListResult.Serialization.cs | 46 + .../Generated/Models/TopQueriesListResult.cs | 36 + .../Models/TransparentDataEncryption.cs | 35 - .../TransparentDataEncryptionActivity.cs | 39 - ...ryptionActivityListResult.Serialization.cs | 35 - ...sparentDataEncryptionActivityListResult.cs | 40 - ...TransparentDataEncryptionActivityStatus.cs | 51 - ...arentDataEncryptionState.Serialization.cs} | 18 +- ...s.cs => TransparentDataEncryptionState.cs} | 4 +- ...RetentionBackupParameters.Serialization.cs | 29 + ...UpdateLongTermRetentionBackupParameters.cs | 21 + ...tanceDnsServersOperation.Serialization.cs} | 21 +- ...pdateManagedInstanceDnsServersOperation.cs | 31 + .../Models/UserIdentity.Serialization.cs | 52 + .../src/Generated/Models/UserIdentity.cs | 34 + .../Models/VirtualCluster.Serialization.cs | 13 +- .../src/Generated/Models/VirtualCluster.cs | 6 +- .../VirtualClusterUpdate.Serialization.cs | 5 + .../Generated/Models/VirtualClusterUpdate.cs | 2 + .../Models/VirtualNetworkRuleState.cs | 3 + ...ndFirewallRulesCreateOrUpdateOperation.cs} | 28 +- .../OutboundFirewallRulesDeleteOperation.cs | 68 ++ .../OutboundFirewallRulesOperations.cs | 330 +++++++ .../OutboundFirewallRulesRestOperations.cs | 503 ++++++++++ ...rivateEndpointConnectionsRestOperations.cs | 8 +- .../PrivateLinkResourcesRestOperations.cs | 4 +- .../RecommendedSensitivityLabelsOperations.cs | 83 ++ ...ommendedSensitivityLabelsRestOperations.cs | 144 +++ ...coverableManagedDatabasesRestOperations.cs | 4 +- .../Generated/ReplicationLinksOperations.cs | 156 ++- .../ReplicationLinksRestOperations.cs | 458 +++++++-- .../src/Generated/RestOperations.cs | 2 +- .../RestorableDroppedDatabasesOperations.cs | 58 +- ...estorableDroppedDatabasesRestOperations.cs | 155 ++- ...leDroppedManagedDatabasesRestOperations.cs | 4 +- .../src/Generated/RestorePointsOperations.cs | 38 +- .../Generated/RestorePointsRestOperations.cs | 105 +- .../Generated/SensitivityLabelsOperations.cs | 74 +- .../SensitivityLabelsRestOperations.cs | 185 +++- .../src/Generated/ServerAdvisorsOperations.cs | 164 ++++ ...ons.cs => ServerAdvisorsRestOperations.cs} | 166 ++-- .../ServerAutomaticTuningRestOperations.cs | 4 +- ...rverAzureADAdministratorsRestOperations.cs | 8 +- ...zureADOnlyAuthenticationsRestOperations.cs | 8 +- ...erverBlobAuditingPoliciesRestOperations.cs | 6 +- ...nnectionPoliciesCreateOrUpdateOperation.cs | 72 ++ .../ServerConnectionPoliciesOperations.cs | 165 +++- .../ServerConnectionPoliciesRestOperations.cs | 235 ++++- ...OpsAuditSettingsCreateOrUpdateOperation.cs | 72 ++ ...=> ServerDevOpsAuditSettingsOperations.cs} | 172 ++-- ...ServerDevOpsAuditSettingsRestOperations.cs | 413 ++++++++ .../ServerDnsAliasesAcquireOperation.cs | 24 +- ...ServerDnsAliasesCreateOrUpdateOperation.cs | 2 +- .../Generated/ServerDnsAliasesOperations.cs | 16 +- .../ServerDnsAliasesRestOperations.cs | 27 +- .../src/Generated/ServerKeysOperations.cs | 4 +- .../src/Generated/ServerKeysRestOperations.cs | 12 +- ...itiesOperations.cs => ServerOperations.cs} | 86 +- ...tOperations.cs => ServerRestOperations.cs} | 116 +-- .../ServerSecurityAlertPoliciesOperations.cs | 8 +- ...rverSecurityAlertPoliciesRestOperations.cs | 18 +- ...erverTrustGroupsCreateOrUpdateOperation.cs | 72 ++ .../ServerTrustGroupsDeleteOperation.cs | 68 ++ .../Generated/ServerTrustGroupsOperations.cs | 428 ++++++++ .../ServerTrustGroupsRestOperations.cs | 674 +++++++++++++ ...erverVulnerabilityAssessmentsOperations.cs | 4 +- ...rVulnerabilityAssessmentsRestOperations.cs | 12 +- .../ServersImportDatabaseOperation.cs | 72 ++ .../src/Generated/ServersOperations.cs | 108 +- .../src/Generated/ServersRestOperations.cs | 176 +++- .../src/Generated/SqlAgentOperations.cs | 119 +++ .../src/Generated/SqlAgentRestOperations.cs | 228 +++++ .../src/Generated/SqlManagementClient.cs | 334 ++++--- .../SubscriptionUsagesRestOperations.cs | 4 +- .../src/Generated/SyncAgentsRestOperations.cs | 12 +- .../src/Generated/SyncGroupsOperations.cs | 4 +- .../src/Generated/SyncGroupsRestOperations.cs | 34 +- .../Generated/SyncMembersRestOperations.cs | 14 +- .../TdeCertificatesRestOperations.cs | 2 +- .../src/Generated/TimeZonesOperations.cs | 168 ++++ .../src/Generated/TimeZonesRestOperations.cs | 278 ++++++ .../TransparentDataEncryptionsOperations.cs | 161 ++- ...ransparentDataEncryptionsRestOperations.cs | 271 +++++- .../src/Generated/UsagesRestOperations.cs | 2 +- .../Generated/VirtualClustersOperations.cs | 42 +- .../VirtualClustersRestOperations.cs | 98 +- .../VirtualNetworkRulesRestOperations.cs | 8 +- .../WorkloadClassifiersRestOperations.cs | 8 +- .../Generated/WorkloadGroupsRestOperations.cs | 8 +- .../Azure.ResourceManager.Sql/src/autorest.md | 2 +- 590 files changed, 39253 insertions(+), 6822 deletions(-) delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesCreateOrUpdateOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{BackupLongTermRetentionPoliciesRestOperations.cs => DataWarehouseUserActivitiesRestOperations.cs} (67%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsCreateOrUpdateOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsRestOperations.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{ServiceTierAdvisorsOperations.cs => DatabaseSchemasOperations.cs} (52%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesRestOperations.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersRecoverOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsCreateOrUpdateOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsDisableOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsCopyByResourceGroupOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsCopyOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsUpdateByResourceGroupOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsUpdateOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesCreateOrUpdateOperation.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{BackupLongTermRetentionPoliciesOperations.cs => LongTermRetentionPoliciesOperations.cs} (51%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{TransparentDataEncryptionActivitiesRestOperations.cs => MaintenanceWindowOptionsRestOperations.cs} (63%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsOperations.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{DatabaseThreatDetectionPoliciesRestOperations.cs => MaintenanceWindowsRestOperations.cs} (64%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseQueriesRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemasRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityEventsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTablesOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTablesRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsDeleteOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResourcesRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Advisor.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Advisor.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AdvisorStatus.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AdvisorStatus.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AggregationFunctionType.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthenticationType.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthenticationType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatus.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatus.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ColumnDataType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CreatedByType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivities.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivities.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivitiesListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivitiesListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivityName.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumn.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumn.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumnListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumnListResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseEdition.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseExtensions.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseExtensions.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentityType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchema.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchema.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchemaListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchemaListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertListResult.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{TransparentDataEncryptionActivity.Serialization.cs => DatabaseTable.Serialization.cs} (68%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTable.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTableListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTableListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUserIdentity.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUserIdentity.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DayOfWeek.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServer.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServer.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServerListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServerListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DnsRefreshConfigurationPropertiesStatus.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolEdition.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{Enum65.cs => Enum60.cs} (59%) rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{ImportExtensionProperties.Serialization.cs => ExportDatabaseDefinition.Serialization.cs} (72%) rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{ExportRequest.cs => ExportDatabaseDefinition.cs} (52%) delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtensionName.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleList.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleList.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImplementationMethod.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImplementationMethod.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{ExportRequest.Serialization.cs => ImportExistingDatabaseDefinition.Serialization.cs} (72%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExistingDatabaseDefinition.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationListResult.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{ImportExportResponse.Serialization.cs => ImportExportExtensionsOperationResult.Serialization.cs} (80%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportOperationResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportOperationResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportResponse.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionProperties.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionRequest.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionRequest.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportNewDatabaseDefinition.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportNewDatabaseDefinition.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportRequest.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportRequest.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IsRetryable.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IsRetryable.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploads.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploads.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsName.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsState.Serialization.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{SecurityAlertPolicyUseServerDefault.cs => LedgerDigestUploadsState.cs} (70%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryptionListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryptionListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionDatabaseState.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{BackupLongTermRetentionPolicy.Serialization.cs => LongTermRetentionPolicy.Serialization.cs} (91%) rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{BackupLongTermRetentionPolicy.cs => LongTermRetentionPolicy.cs} (77%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceConfigurationCapability.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceConfigurationCapability.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowOptions.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowOptions.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowTimeRange.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindows.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindows.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthentication.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthentication.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceMaintenanceConfigurationCapability.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceMaintenanceConfigurationCapability.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePecProperty.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePecProperty.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionProperties.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionProperties.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointProperty.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointProperty.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLink.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkServiceConnectionStateProperty.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQuery.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQuery.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQueryStatistics.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQueryStatistics.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryption.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryptionListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryptionListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MetricType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/NetworkIsolationSettings.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/NetworkIsolationSettings.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationMode.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRule.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRule.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRuleListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRuleListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrincipalType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionRequestStatus.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionRequestStatus.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ProxyResourceWithWritableName.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricInterval.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricInterval.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricProperties.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricProperties.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricUnitType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatistics.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatistics.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryTimeGrainType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedAction.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedAction.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionCurrentState.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionErrorInfo.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{OperationImpact.Serialization.cs => RecommendedActionImpactRecord.Serialization.cs} (61%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImplementationInfo.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionInitiatedBy.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionMetricInfo.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionStateInfo.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionStateInfo.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPool.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPool.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListMetricsResult.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListMetricsResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListResult.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolMetric.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndex.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexAction.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexAction.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexState.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexState.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexType.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceWithWritableName.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceWithWritableName.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecondaryType.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyNameAutoGenerated.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertsPolicyState.Serialization.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{SecurityAlertPolicyEmailAccountAdmins.cs => SecurityAlertsPolicyState.cs} (60%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEvent.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEvent.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventCollection.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventCollection.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventType.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdate.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdate.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateKind.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateList.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicyListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicyListResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionType.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditSettingsListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditSettingsListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditingSettings.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditingSettings.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerExternalAdministrator.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerExternalAdministrator.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerInfo.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerInfo.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerNetworkAccessFlag.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{RecommendedIndex.Serialization.cs => ServerOperation.Serialization.cs} (53%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerPublicNetworkAccess.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroup.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroup.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupPropertiesTrustScopesItem.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerWorkspaceFeature.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisor.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisor.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisorListResult.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisorListResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SloUsageMetric.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfiguration.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfiguration.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfigurationPropertiesState.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageKeyType.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SystemData.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SystemData.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TableTemporalType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZone.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZone.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZoneListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZoneListResult.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueries.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueries.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueriesListResult.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueriesListResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryption.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityListResult.Serialization.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityListResult.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{TransparentDataEncryptionStatus.Serialization.cs => TransparentDataEncryptionState.Serialization.cs} (57%) rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{TransparentDataEncryptionStatus.cs => TransparentDataEncryptionState.cs} (75%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/{TransparentDataEncryption.Serialization.cs => UpdateManagedInstanceDnsServersOperation.Serialization.cs} (70%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UserIdentity.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UserIdentity.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{DatabasesCreateImportOperationOperation.cs => OutboundFirewallRulesCreateOrUpdateOperation.cs} (55%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesDeleteOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedSensitivityLabelsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvisorsOperations.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{RecommendedElasticPoolsRestOperations.cs => ServerAdvisorsRestOperations.cs} (65%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesCreateOrUpdateOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsCreateOrUpdateOperation.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{RecommendedElasticPoolsOperations.cs => ServerDevOpsAuditSettingsOperations.cs} (50%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsRestOperations.cs rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{TransparentDataEncryptionActivitiesOperations.cs => ServerOperations.cs} (50%) rename sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/{ServiceTierAdvisorsRestOperations.cs => ServerRestOperations.cs} (58%) create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsCreateOrUpdateOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsDeleteOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersImportDatabaseOperation.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentRestOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TimeZonesOperations.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TimeZonesRestOperations.cs diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesCreateOrUpdateOperation.cs deleted file mode 100644 index d5b787fb94660..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesCreateOrUpdateOperation.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - /// Sets a database's long term retention policy. - public partial class BackupLongTermRetentionPoliciesCreateOrUpdateOperation : Operation, IOperationSource - { - private readonly ArmOperationHelpers _operation; - - /// Initializes a new instance of BackupLongTermRetentionPoliciesCreateOrUpdateOperation for mocking. - protected BackupLongTermRetentionPoliciesCreateOrUpdateOperation() - { - } - - internal BackupLongTermRetentionPoliciesCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) - { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "BackupLongTermRetentionPoliciesCreateOrUpdateOperation"); - } - /// - public override string Id => _operation.Id; - - /// - public override BackupLongTermRetentionPolicy Value => _operation.Value; - - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// - public override bool HasValue => _operation.HasValue; - - /// - public override Response GetRawResponse() => _operation.GetRawResponse(); - - /// - public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - - /// - public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - - /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - - BackupLongTermRetentionPolicy IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPoliciesRestOperations.cs index adc2b23f8f448..2087808cce03a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupShortTermRetentionPoliciesRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -264,7 +264,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath(databaseName, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -368,7 +368,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/backupShortTermRetentionPolicies", false); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/CapabilitiesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/CapabilitiesRestOperations.cs index 94039ef55ca06..3f8c004b79be3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/CapabilitiesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/CapabilitiesRestOperations.cs @@ -59,7 +59,7 @@ internal HttpMessage CreateListByLocationRequest(string locationName, Capability { uri.AppendQuery("include", include.Value.ToString(), true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs new file mode 100644 index 0000000000000..e5bf6b5bc5ea7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The DataWarehouseUserActivities service client. + public partial class DataWarehouseUserActivitiesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DataWarehouseUserActivitiesRestOperations RestClient { get; } + + /// Initializes a new instance of DataWarehouseUserActivitiesOperations for mocking. + protected DataWarehouseUserActivitiesOperations() + { + } + + /// Initializes a new instance of DataWarehouseUserActivitiesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal DataWarehouseUserActivitiesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DataWarehouseUserActivitiesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the user activities of a data warehouse which includes running and suspended queries. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The activity name of the data warehouse. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the user activities of a data warehouse which includes running and suspended queries. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The activity name of the data warehouse. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List the user activities of a data warehouse which includes running and suspended queries. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List the user activities of a data warehouse which includes running and suspended queries. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DataWarehouseUserActivitiesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesRestOperations.cs similarity index 67% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesRestOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesRestOperations.cs index ba174e0c3a1d6..5fa22b75d717b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DataWarehouseUserActivitiesRestOperations.cs @@ -16,20 +16,20 @@ namespace Azure.ResourceManager.Sql { - internal partial class BackupLongTermRetentionPoliciesRestOperations + internal partial class DataWarehouseUserActivitiesRestOperations { private string subscriptionId; private Uri endpoint; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; - /// Initializes a new instance of BackupLongTermRetentionPoliciesRestOperations. + /// Initializes a new instance of DataWarehouseUserActivitiesRestOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. /// is null. - public BackupLongTermRetentionPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + public DataWarehouseUserActivitiesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { if (subscriptionId == null) { @@ -43,7 +43,7 @@ public BackupLongTermRetentionPoliciesRestOperations(ClientDiagnostics clientDia _pipeline = pipeline; } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -58,22 +58,22 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/backupLongTermRetentionPolicies/", false); - uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendPath("/dataWarehouseUserActivities/", false); + uri.AppendPath(dataWarehouseUserActivityName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a database's long term retention policy. + /// Gets the user activities of a data warehouse which includes running and suspended queries. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// The policy name. Should always be Default. + /// The activity name of the data warehouse. /// The cancellation token to use. /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -88,15 +88,15 @@ public async Task> GetAsync(string resou throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, policyName); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - BackupLongTermRetentionPolicy value = default; + DataWarehouseUserActivities value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement); + value = DataWarehouseUserActivities.DeserializeDataWarehouseUserActivities(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -104,14 +104,14 @@ public async Task> GetAsync(string resou } } - /// Gets a database's long term retention policy. + /// Gets the user activities of a data warehouse which includes running and suspended queries. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// The policy name. Should always be Default. + /// The activity name of the data warehouse. /// The cancellation token to use. /// , , or is null. - public Response Get(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string serverName, string databaseName, DataWarehouseUserActivityName dataWarehouseUserActivityName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -126,15 +126,15 @@ public Response Get(string resourceGroupName, str throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, policyName); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - BackupLongTermRetentionPolicy value = default; + DataWarehouseUserActivities value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement); + value = DataWarehouseUserActivities.DeserializeDataWarehouseUserActivities(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -142,11 +142,11 @@ public Response Get(string resourceGroupName, str } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, BackupLongTermRetentionPolicy parameters) + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -157,27 +157,20 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/backupLongTermRetentionPolicies/", false); - uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendPath("/dataWarehouseUserActivities", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; return message; } - /// Sets a database's long term retention policy. + /// List the user activities of a data warehouse which includes running and suspended queries. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// The policy name. Should always be Default. - /// The long term retention policy info. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, BackupLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -191,32 +184,30 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, policyName, parameters); + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + DataWarehouseUserActivitiesListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataWarehouseUserActivitiesListResult.DeserializeDataWarehouseUserActivitiesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Sets a database's long term retention policy. + /// List the user activities of a data warehouse which includes running and suspended queries. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// The policy name. Should always be Default. - /// The long term retention policy info. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, BackupLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -230,53 +221,49 @@ public Response CreateOrUpdate(string resourceGroupName, string serverName, stri { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, policyName, parameters); + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + DataWarehouseUserActivitiesListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataWarehouseUserActivitiesListResult.DeserializeDataWarehouseUserActivitiesListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/servers/", false); - uri.AppendPath(serverName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/backupLongTermRetentionPolicies", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a database's long term retention policy. + /// List the user activities of a data warehouse which includes running and suspended queries. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -290,15 +277,15 @@ public async Task> ListByDatabaseAsync(s throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - BackupLongTermRetentionPolicy value = default; + DataWarehouseUserActivitiesListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement); + value = DataWarehouseUserActivitiesListResult.DeserializeDataWarehouseUserActivitiesListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -306,14 +293,19 @@ public async Task> ListByDatabaseAsync(s } } - /// Gets a database's long term retention policy. + /// List the user activities of a data warehouse which includes running and suspended queries. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The cancellation token to use. - /// , , or is null. - public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -327,15 +319,15 @@ public Response ListByDatabase(string resourceGro throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - BackupLongTermRetentionPolicy value = default; + DataWarehouseUserActivitiesListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BackupLongTermRetentionPolicy.DeserializeBackupLongTermRetentionPolicy(document.RootElement); + value = DataWarehouseUserActivitiesListResult.DeserializeDataWarehouseUserActivitiesListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsOperations.cs new file mode 100644 index 0000000000000..94761371319b3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsOperations.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The DatabaseAdvisors service client. + public partial class DatabaseAdvisorsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseAdvisorsRestOperations RestClient { get; } + + /// Initializes a new instance of DatabaseAdvisorsOperations for mocking. + protected DatabaseAdvisorsOperations() + { + } + + /// Initializes a new instance of DatabaseAdvisorsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal DatabaseAdvisorsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseAdvisorsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a list of database advisors. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The child resources to include in the response. + /// The cancellation token to use. + public virtual async Task>> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.ListByDatabase"); + scope.Start(); + try + { + return await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, expand, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of database advisors. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The child resources to include in the response. + /// The cancellation token to use. + public virtual Response> ListByDatabase(string resourceGroupName, string serverName, string databaseName, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.ListByDatabase"); + scope.Start(); + try + { + return RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, expand, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a database advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, advisorName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a database advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, advisorName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a database advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The requested advisor resource state. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, serverName, databaseName, advisorName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a database advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The requested advisor resource state. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseAdvisorsOperations.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, serverName, databaseName, advisorName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsRestOperations.cs new file mode 100644 index 0000000000000..aa00031809d37 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAdvisorsRestOperations.cs @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DatabaseAdvisorsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseAdvisorsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public DatabaseAdvisorsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/advisors", false); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of database advisors. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The child resources to include in the response. + /// The cancellation token to use. + /// , , or is null. + public async Task>> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string expand = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(Advisor.DeserializeAdvisor(item)); + } + value = array; + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of database advisors. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The child resources to include in the response. + /// The cancellation token to use. + /// , , or is null. + public Response> ListByDatabase(string resourceGroupName, string serverName, string databaseName, string expand = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IReadOnlyList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(Advisor.DeserializeAdvisor(item)); + } + value = array; + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string advisorName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/advisors/", false); + uri.AppendPath(advisorName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a database advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, advisorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Advisor value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Advisor.DeserializeAdvisor(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a database advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, advisorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Advisor value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Advisor.DeserializeAdvisor(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/advisors/", false); + uri.AppendPath(advisorName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Updates a database advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The requested advisor resource state. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> UpdateAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, advisorName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Advisor value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Advisor.DeserializeAdvisor(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates a database advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The requested advisor resource state. + /// The cancellation token to use. + /// , , , , or is null. + public Response Update(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, advisorName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Advisor value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Advisor.DeserializeAdvisor(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAutomaticTuningRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAutomaticTuningRestOperations.cs index b9069ac8ac132..8d10cae8115ef 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAutomaticTuningRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseAutomaticTuningRestOperations.cs @@ -59,7 +59,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/automaticTuning/current", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -155,7 +155,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/automaticTuning/current", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPoliciesRestOperations.cs index eaa178bd06b27..f69864bb6d6d0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseBlobAuditingPoliciesRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/auditingSettings/", false); uri.AppendPath("default", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -157,7 +157,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/auditingSettings/", false); uri.AppendPath("default", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -269,7 +269,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/auditingSettings", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsOperations.cs new file mode 100644 index 0000000000000..6f101e39143f0 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsOperations.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The DatabaseColumns service client. + public partial class DatabaseColumnsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseColumnsRestOperations RestClient { get; } + + /// Initializes a new instance of DatabaseColumnsOperations for mocking. + protected DatabaseColumnsOperations() + { + } + + /// Initializes a new instance of DatabaseColumnsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal DatabaseColumnsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseColumnsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get database column. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The name of the column. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get database column. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The name of the column. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public virtual AsyncPageable ListByTableAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByTable"); + scope.Start(); + try + { + var response = await RestClient.ListByTableAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByTable"); + scope.Start(); + try + { + var response = await RestClient.ListByTableNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, schemaName, tableName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public virtual Pageable ListByTable(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByTable"); + scope.Start(); + try + { + var response = RestClient.ListByTable(resourceGroupName, serverName, databaseName, schemaName, tableName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseColumnsOperations.ListByTable"); + scope.Start(); + try + { + var response = RestClient.ListByTableNextPage(nextLink, resourceGroupName, serverName, databaseName, schemaName, tableName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsRestOperations.cs new file mode 100644 index 0000000000000..b172b0742eda3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseColumnsRestOperations.cs @@ -0,0 +1,656 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DatabaseColumnsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseColumnsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public DatabaseColumnsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, IEnumerable schema, IEnumerable table, IEnumerable column, IEnumerable orderBy, string skiptoken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/columns", false); + if (schema != null) + { + uri.AppendQueryDelimited("schema", schema, ",", true); + } + if (table != null) + { + uri.AppendQueryDelimited("table", table, ",", true); + } + if (column != null) + { + uri.AppendQueryDelimited("column", column, ",", true); + } + if (orderBy != null) + { + uri.AppendQueryDelimited("orderBy", orderBy, ",", true); + } + if (skiptoken != null) + { + uri.AppendQuery("$skiptoken", skiptoken, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTableRequest(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/columns", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> ListByTableAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateListByTableRequest(resourceGroupName, serverName, databaseName, schemaName, tableName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public Response ListByTable(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateListByTableRequest(resourceGroupName, serverName, databaseName, schemaName, tableName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/columns/", false); + uri.AppendPath(columnName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get database column. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The name of the column. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (columnName == null) + { + throw new ArgumentNullException(nameof(columnName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumn value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumn.DeserializeDatabaseColumn(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get database column. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The name of the column. + /// The cancellation token to use. + /// , , , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (columnName == null) + { + throw new ArgumentNullException(nameof(columnName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumn value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumn.DeserializeDatabaseColumn(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, IEnumerable schema, IEnumerable table, IEnumerable column, IEnumerable orderBy, string skiptoken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database columns. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database columns. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTableNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database columns. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task> ListByTableNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateListByTableNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schemaName, tableName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database columns. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , , or is null. + public Response ListByTableNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateListByTableNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schemaName, tableName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsCreateOrUpdateOperation.cs new file mode 100644 index 0000000000000..4bad03accd639 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsCreateOrUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Perform a database extension operation, like polybase import. + public partial class DatabaseExtensionsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of DatabaseExtensionsCreateOrUpdateOperation for mocking. + protected DatabaseExtensionsCreateOrUpdateOperation() + { + } + + internal DatabaseExtensionsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabaseExtensionsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ImportExportExtensionsOperationResult Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ImportExportExtensionsOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ImportExportExtensionsOperationResult.DeserializeImportExportExtensionsOperationResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ImportExportExtensionsOperationResult.DeserializeImportExportExtensionsOperationResult(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsOperations.cs new file mode 100644 index 0000000000000..24bc450d20be6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsOperations.cs @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The DatabaseExtensions service client. + public partial class DatabaseExtensionsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseExtensionsRestOperations RestClient { get; } + + /// Initializes a new instance of DatabaseExtensionsOperations for mocking. + protected DatabaseExtensionsOperations() + { + } + + /// Initializes a new instance of DatabaseExtensionsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal DatabaseExtensionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseExtensionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a database extension. This will return resource not found as it is not supported. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The String to use. + /// The cancellation token to use. + public virtual async Task GetAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, extensionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a database extension. This will return resource not found as it is not supported. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The String to use. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, extensionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List database extension. This will return an empty list as it is not supported. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List database extension. This will return an empty list as it is not supported. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Perform a database extension operation, like polybase import. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The String to use. + /// The database import request parameters. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (extensionName == null) + { + throw new ArgumentNullException(nameof(extensionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, cancellationToken).ConfigureAwait(false); + return new DatabaseExtensionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, extensionName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Perform a database extension operation, like polybase import. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The String to use. + /// The database import request parameters. + /// The cancellation token to use. + /// , , , , or is null. + public virtual DatabaseExtensionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (extensionName == null) + { + throw new ArgumentNullException(nameof(extensionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("DatabaseExtensionsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, extensionName, parameters, cancellationToken); + return new DatabaseExtensionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, extensionName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsRestOperations.cs new file mode 100644 index 0000000000000..8f52e8cc69ddd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseExtensionsRestOperations.cs @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DatabaseExtensionsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseExtensionsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public DatabaseExtensionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string extensionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/extensions/", false); + uri.AppendPath(extensionName, true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + return message; + } + + /// Gets a database extension. This will return resource not found as it is not supported. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The String to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task GetAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (extensionName == null) + { + throw new ArgumentNullException(nameof(extensionName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, extensionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a database extension. This will return resource not found as it is not supported. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The String to use. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (extensionName == null) + { + throw new ArgumentNullException(nameof(extensionName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, extensionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/extensions/", false); + uri.AppendPath(extensionName, true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Perform a database extension operation, like polybase import. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The String to use. + /// The database import request parameters. + /// The cancellation token to use. + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (extensionName == null) + { + throw new ArgumentNullException(nameof(extensionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, extensionName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Perform a database extension operation, like polybase import. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The String to use. + /// The database import request parameters. + /// The cancellation token to use. + /// , , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (extensionName == null) + { + throw new ArgumentNullException(nameof(extensionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, extensionName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/extensions", false); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database extension. This will return an empty list as it is not supported. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ImportExportExtensionsOperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ImportExportExtensionsOperationListResult.DeserializeImportExportExtensionsOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database extension. This will return an empty list as it is not supported. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ImportExportExtensionsOperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ImportExportExtensionsOperationListResult.DeserializeImportExportExtensionsOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database extension. This will return an empty list as it is not supported. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ImportExportExtensionsOperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ImportExportExtensionsOperationListResult.DeserializeImportExportExtensionsOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database extension. This will return an empty list as it is not supported. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ImportExportExtensionsOperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ImportExportExtensionsOperationListResult.DeserializeImportExportExtensionsOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs new file mode 100644 index 0000000000000..c52346662be2d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The DatabaseRecommendedActions service client. + public partial class DatabaseRecommendedActionsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseRecommendedActionsRestOperations RestClient { get; } + + /// Initializes a new instance of DatabaseRecommendedActionsOperations for mocking. + protected DatabaseRecommendedActionsOperations() + { + } + + /// Initializes a new instance of DatabaseRecommendedActionsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal DatabaseRecommendedActionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseRecommendedActionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets list of Database Recommended Actions. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The cancellation token to use. + public virtual async Task>> ListByDatabaseAdvisorAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.ListByDatabaseAdvisor"); + scope.Start(); + try + { + return await RestClient.ListByDatabaseAdvisorAsync(resourceGroupName, serverName, databaseName, advisorName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets list of Database Recommended Actions. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The cancellation token to use. + public virtual Response> ListByDatabaseAdvisor(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.ListByDatabaseAdvisor"); + scope.Start(); + try + { + return RestClient.ListByDatabaseAdvisor(resourceGroupName, serverName, databaseName, advisorName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a database recommended action. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The name of Database Recommended Action. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a database recommended action. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The name of Database Recommended Action. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a database recommended action. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The name of Database Recommended Action. + /// The requested recommended action resource state. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a database recommended action. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The name of Database Recommended Action. + /// The requested recommended action resource state. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseRecommendedActionsOperations.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsRestOperations.cs new file mode 100644 index 0000000000000..d995fed20a193 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRecommendedActionsRestOperations.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DatabaseRecommendedActionsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseRecommendedActionsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public DatabaseRecommendedActionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByDatabaseAdvisorRequest(string resourceGroupName, string serverName, string databaseName, string advisorName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/advisors/", false); + uri.AppendPath(advisorName, true); + uri.AppendPath("/recommendedActions", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets list of Database Recommended Actions. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The cancellation token to use. + /// , , , or is null. + public async Task>> ListByDatabaseAdvisorAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + + using var message = CreateListByDatabaseAdvisorRequest(resourceGroupName, serverName, databaseName, advisorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + IReadOnlyList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(RecommendedAction.DeserializeRecommendedAction(item)); + } + value = array; + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets list of Database Recommended Actions. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The cancellation token to use. + /// , , , or is null. + public Response> ListByDatabaseAdvisor(string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + + using var message = CreateListByDatabaseAdvisorRequest(resourceGroupName, serverName, databaseName, advisorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + IReadOnlyList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(RecommendedAction.DeserializeRecommendedAction(item)); + } + value = array; + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/advisors/", false); + uri.AppendPath(advisorName, true); + uri.AppendPath("/recommendedActions/", false); + uri.AppendPath(recommendedActionName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a database recommended action. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The name of Database Recommended Action. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + if (recommendedActionName == null) + { + throw new ArgumentNullException(nameof(recommendedActionName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RecommendedAction value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecommendedAction.DeserializeRecommendedAction(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a database recommended action. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The name of Database Recommended Action. + /// The cancellation token to use. + /// , , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + if (recommendedActionName == null) + { + throw new ArgumentNullException(nameof(recommendedActionName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RecommendedAction value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecommendedAction.DeserializeRecommendedAction(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/advisors/", false); + uri.AppendPath(advisorName, true); + uri.AppendPath("/recommendedActions/", false); + uri.AppendPath(recommendedActionName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Updates a database recommended action. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The name of Database Recommended Action. + /// The requested recommended action resource state. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task> UpdateAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + if (recommendedActionName == null) + { + throw new ArgumentNullException(nameof(recommendedActionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RecommendedAction value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RecommendedAction.DeserializeRecommendedAction(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates a database recommended action. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the Database Advisor. + /// The name of Database Recommended Action. + /// The requested recommended action resource state. + /// The cancellation token to use. + /// , , , , , or is null. + public Response Update(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + if (recommendedActionName == null) + { + throw new ArgumentNullException(nameof(recommendedActionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RecommendedAction value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RecommendedAction.DeserializeRecommendedAction(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRestOperations.cs index 453ca0ccb7da0..14bde864b4bac 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseRestOperations.cs @@ -61,7 +61,7 @@ internal HttpMessage CreateCancelRequest(string resourceGroupName, string server uri.AppendPath("/operations/", false); uri.AppendPath(operationId, true); uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; return message; } @@ -148,7 +148,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/operations", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasOperations.cs similarity index 52% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasOperations.cs index 40cf6e393054f..9191a9ea3ef5b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasOperations.cs @@ -15,43 +15,43 @@ namespace Azure.ResourceManager.Sql { - /// The ServiceTierAdvisors service client. - public partial class ServiceTierAdvisorsOperations + /// The DatabaseSchemas service client. + public partial class DatabaseSchemasOperations { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; - internal ServiceTierAdvisorsRestOperations RestClient { get; } + internal DatabaseSchemasRestOperations RestClient { get; } - /// Initializes a new instance of ServiceTierAdvisorsOperations for mocking. - protected ServiceTierAdvisorsOperations() + /// Initializes a new instance of DatabaseSchemasOperations for mocking. + protected DatabaseSchemasOperations() { } - /// Initializes a new instance of ServiceTierAdvisorsOperations. + /// Initializes a new instance of DatabaseSchemasOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. - internal ServiceTierAdvisorsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + internal DatabaseSchemasOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { - RestClient = new ServiceTierAdvisorsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new DatabaseSchemasRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } - /// Gets a service tier advisor. + /// Get database schema. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of database. - /// The name of service tier advisor. + /// The name of the database. + /// The name of the schema. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ServiceTierAdvisorsOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.Get"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, schemaName, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -60,19 +60,19 @@ public virtual async Task> GetAsync(string resource } } - /// Gets a service tier advisor. + /// Get database schema. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of database. - /// The name of service tier advisor. + /// The name of the database. + /// The name of the schema. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ServiceTierAdvisorsOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.Get"); scope.Start(); try { - return RestClient.Get(resourceGroupName, serverName, databaseName, serviceTierAdvisorName, cancellationToken); + return RestClient.Get(resourceGroupName, serverName, databaseName, schemaName, cancellationToken); } catch (Exception e) { @@ -81,13 +81,14 @@ public virtual Response Get(string resourceGroupName, string } } - /// Returns service tier advisors for specified database. + /// List database schemas. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of database. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -102,14 +103,14 @@ public virtual AsyncPageable ListByDatabaseAsync(string reso throw new ArgumentNullException(nameof(databaseName)); } - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ServiceTierAdvisorsOperations.ListByDatabase"); + using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.ListByDatabase"); scope.Start(); try { - var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -117,16 +118,32 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Returns service tier advisors for specified database. + /// List database schemas. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of database. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -141,14 +158,29 @@ public virtual Pageable ListByDatabase(string resourceGroupN throw new ArgumentNullException(nameof(databaseName)); } - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ServiceTierAdvisorsOperations.ListByDatabase"); + using var scope = _clientDiagnostics.CreateScope("DatabaseSchemasOperations.ListByDatabase"); scope.Start(); try { - var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -156,7 +188,7 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasRestOperations.cs new file mode 100644 index 0000000000000..f1ec304eec063 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSchemasRestOperations.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DatabaseSchemasRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseSchemasRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public DatabaseSchemasRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database schemas. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database schemas. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string schemaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get database schema. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchema value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSchema.DeserializeDatabaseSchema(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get database schema. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchema value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSchema.DeserializeDatabaseSchema(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database schemas. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database schemas. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs new file mode 100644 index 0000000000000..be6e5179e6a17 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The DatabaseSecurityAlertPolicies service client. + public partial class DatabaseSecurityAlertPoliciesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseSecurityAlertPoliciesRestOperations RestClient { get; } + + /// Initializes a new instance of DatabaseSecurityAlertPoliciesOperations for mocking. + protected DatabaseSecurityAlertPoliciesOperations() + { + } + + /// Initializes a new instance of DatabaseSecurityAlertPoliciesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal DatabaseSecurityAlertPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseSecurityAlertPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a database's security alert policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a database's security alert policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The name of the security alert policy. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, securityAlertPolicyName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a database's security alert policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The name of the security alert policy. + /// The database security alert policy. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a database's security alert policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The name of the security alert policy. + /// The database security alert policy. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of database's security alert policies. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of database's security alert policies. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseSecurityAlertPoliciesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesRestOperations.cs new file mode 100644 index 0000000000000..1c94674abfb59 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseSecurityAlertPoliciesRestOperations.cs @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DatabaseSecurityAlertPoliciesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseSecurityAlertPoliciesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public DatabaseSecurityAlertPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/securityAlertPolicies/", false); + uri.AppendPath(securityAlertPolicyName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a database's security alert policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The name of the security alert policy. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSecurityAlertPolicy value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a database's security alert policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The name of the security alert policy. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSecurityAlertPolicy value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/securityAlertPolicies/", false); + uri.AppendPath(securityAlertPolicyName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates or updates a database's security alert policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The name of the security alert policy. + /// The database security alert policy. + /// The cancellation token to use. + /// , , , or is null. + public async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DatabaseSecurityAlertPolicy value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates or updates a database's security alert policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The name of the security alert policy. + /// The database security alert policy. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DatabaseSecurityAlertPolicy value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/securityAlertPolicies", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of database's security alert policies. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSecurityAlertListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSecurityAlertListResult.DeserializeDatabaseSecurityAlertListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of database's security alert policies. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSecurityAlertListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSecurityAlertListResult.DeserializeDatabaseSecurityAlertListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of database's security alert policies. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSecurityAlertListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSecurityAlertListResult.DeserializeDatabaseSecurityAlertListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of database's security alert policies. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database for which the security alert policy is defined. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSecurityAlertListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSecurityAlertListResult.DeserializeDatabaseSecurityAlertListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesOperations.cs new file mode 100644 index 0000000000000..fe2e5ff8df187 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesOperations.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The DatabaseTables service client. + public partial class DatabaseTablesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DatabaseTablesRestOperations RestClient { get; } + + /// Initializes a new instance of DatabaseTablesOperations for mocking. + protected DatabaseTablesOperations() + { + } + + /// Initializes a new instance of DatabaseTablesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal DatabaseTablesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DatabaseTablesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get database table. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get database table. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, schemaName, tableName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List database tables. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListBySchemaAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.ListBySchema"); + scope.Start(); + try + { + var response = await RestClient.ListBySchemaAsync(resourceGroupName, serverName, databaseName, schemaName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.ListBySchema"); + scope.Start(); + try + { + var response = await RestClient.ListBySchemaNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, schemaName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List database tables. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListBySchema(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.ListBySchema"); + scope.Start(); + try + { + var response = RestClient.ListBySchema(resourceGroupName, serverName, databaseName, schemaName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseTablesOperations.ListBySchema"); + scope.Start(); + try + { + var response = RestClient.ListBySchemaNextPage(nextLink, resourceGroupName, serverName, databaseName, schemaName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesRestOperations.cs new file mode 100644 index 0000000000000..3be3e716856ed --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseTablesRestOperations.cs @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DatabaseTablesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DatabaseTablesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public DatabaseTablesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListBySchemaRequest(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/tables", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database tables. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListBySchemaAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateListBySchemaRequest(resourceGroupName, serverName, databaseName, schemaName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseTableListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database tables. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public Response ListBySchema(string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateListBySchemaRequest(resourceGroupName, serverName, databaseName, schemaName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseTableListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get database table. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseTable value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseTable.DeserializeDatabaseTable(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get database table. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The cancellation token to use. + /// , , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, schemaName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseTable value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseTable.DeserializeDatabaseTable(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySchemaNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List database tables. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> ListBySchemaNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateListBySchemaNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schemaName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseTableListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List database tables. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public Response ListBySchemaNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateListBySchemaNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, schemaName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseTableListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs deleted file mode 100644 index 4e549b00d0ef9..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Sql.Models; - -namespace Azure.ResourceManager.Sql -{ - /// The DatabaseThreatDetectionPolicies service client. - public partial class DatabaseThreatDetectionPoliciesOperations - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly HttpPipeline _pipeline; - internal DatabaseThreatDetectionPoliciesRestOperations RestClient { get; } - - /// Initializes a new instance of DatabaseThreatDetectionPoliciesOperations for mocking. - protected DatabaseThreatDetectionPoliciesOperations() - { - } - - /// Initializes a new instance of DatabaseThreatDetectionPoliciesOperations. - /// The handler for diagnostic messaging in the client. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The subscription ID that identifies an Azure subscription. - /// server parameter. - internal DatabaseThreatDetectionPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) - { - RestClient = new DatabaseThreatDetectionPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); - _clientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - } - - /// Gets a database's threat detection policy. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The name of the database for which database Threat Detection policy is defined. - /// The name of the security alert policy. - /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DatabaseThreatDetectionPoliciesOperations.Get"); - scope.Start(); - try - { - return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets a database's threat detection policy. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The name of the database for which database Threat Detection policy is defined. - /// The name of the security alert policy. - /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DatabaseThreatDetectionPoliciesOperations.Get"); - scope.Start(); - try - { - return RestClient.Get(resourceGroupName, serverName, databaseName, securityAlertPolicyName, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Creates or updates a database's threat detection policy. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The name of the database for which database Threat Detection policy is defined. - /// The name of the security alert policy. - /// The database Threat Detection policy. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DatabaseThreatDetectionPoliciesOperations.CreateOrUpdate"); - scope.Start(); - try - { - return await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, cancellationToken).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Creates or updates a database's threat detection policy. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The name of the database for which database Threat Detection policy is defined. - /// The name of the security alert policy. - /// The database Threat Detection policy. - /// The cancellation token to use. - public virtual Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("DatabaseThreatDetectionPoliciesOperations.CreateOrUpdate"); - scope.Start(); - try - { - return RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, cancellationToken); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesOperations.cs index 81330420b5297..203e5f60552d0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesOperations.cs @@ -39,7 +39,7 @@ internal DatabaseUsagesOperations(ClientDiagnostics clientDiagnostics, HttpPipel _pipeline = pipeline; } - /// Returns database usages. + /// Gets database usages. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. @@ -67,7 +67,7 @@ async Task> FirstPageFunc(int? pageSizeHint) try { var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -75,10 +75,25 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseUsagesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Returns database usages. + /// Gets database usages. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. @@ -106,7 +121,22 @@ Page FirstPageFunc(int? pageSizeHint) try { var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatabaseUsagesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -114,7 +144,7 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesRestOperations.cs index f48beff085ad4..40ca7d3bcee22 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseUsagesRestOperations.cs @@ -59,13 +59,13 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/usages", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Returns database usages. + /// Gets database usages. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. @@ -102,7 +102,7 @@ public async Task> ListByDatabaseAsync(string } } - /// Returns database usages. + /// Gets database usages. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. @@ -138,5 +138,102 @@ public Response ListByDatabase(string resourceGroupName throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets database usages. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseUsageListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseUsageListResult.DeserializeDatabaseUsageListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets database usages. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseUsageListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseUsageListResult.DeserializeDatabaseUsageListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs index c2d3697ec91b5..101f2c948dd48 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs @@ -64,7 +64,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(ruleId, true); uri.AppendPath("/baselines/", false); uri.AppendPath(baselineName.ToSerialString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -179,7 +179,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(ruleId, true); uri.AppendPath("/baselines/", false); uri.AppendPath(baselineName.ToSerialString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -308,7 +308,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(ruleId, true); uri.AppendPath("/baselines/", false); uri.AppendPath(baselineName.ToSerialString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansRestOperations.cs index b9fd28eea8c32..759b7793d75db 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansRestOperations.cs @@ -43,11 +43,11 @@ public DatabaseVulnerabilityAssessmentScansRestOperations(ClientDiagnostics clie _pipeline = pipeline; } - internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName) + internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -60,21 +60,23 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendPath("/scans", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanId, true); + uri.AppendPath("/initiateScan", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); return message; } - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The name of the vulnerability assessment. + /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task InitiateScanAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -88,31 +90,32 @@ public async Task> ListByD { throw new ArgumentNullException(nameof(databaseName)); } + if (scanId == null) + { + throw new ArgumentNullException(nameof(scanId)); + } - using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + using var message = CreateInitiateScanRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - VulnerabilityAssessmentScanRecordListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The name of the vulnerability assessment. + /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// , , or is null. - public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response InitiateScan(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -126,24 +129,24 @@ public Response ListByDatabase(stri { throw new ArgumentNullException(nameof(databaseName)); } + if (scanId == null) + { + throw new ArgumentNullException(nameof(scanId)); + } - using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + using var message = CreateInitiateScanRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - VulnerabilityAssessmentScanRecordListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -160,23 +163,21 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanId, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/scans", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a vulnerability assessment scan record of a database. + /// Lists the vulnerability assessment scans of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -190,20 +191,16 @@ public async Task> GetAsync(string r { throw new ArgumentNullException(nameof(databaseName)); } - if (scanId == null) - { - throw new ArgumentNullException(nameof(scanId)); - } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - VulnerabilityAssessmentScanRecord value = default; + VulnerabilityAssessmentScanRecordListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement); + value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -211,15 +208,14 @@ public async Task> GetAsync(string r } } - /// Gets a vulnerability assessment scan record of a database. + /// Lists the vulnerability assessment scans of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// , , , or is null. - public Response Get(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -233,20 +229,16 @@ public Response Get(string resourceGroupName, { throw new ArgumentNullException(nameof(databaseName)); } - if (scanId == null) - { - throw new ArgumentNullException(nameof(scanId)); - } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - VulnerabilityAssessmentScanRecord value = default; + VulnerabilityAssessmentScanRecordListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement); + value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -254,11 +246,11 @@ public Response Get(string resourceGroupName, } } - internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -273,13 +265,13 @@ internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); uri.AppendPath("/scans/", false); uri.AppendPath(scanId, true); - uri.AppendPath("/initiateScan", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); return message; } - /// Executes a Vulnerability Assessment database scan. + /// Gets a vulnerability assessment scan record of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. @@ -287,7 +279,7 @@ internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. /// , , , or is null. - public async Task InitiateScanAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -306,19 +298,23 @@ public async Task InitiateScanAsync(string resourceGroupName, string s throw new ArgumentNullException(nameof(scanId)); } - using var message = CreateInitiateScanRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + VulnerabilityAssessmentScanRecord value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Executes a Vulnerability Assessment database scan. + /// Gets a vulnerability assessment scan record of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. @@ -326,7 +322,7 @@ public async Task InitiateScanAsync(string resourceGroupName, string s /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. /// , , , or is null. - public Response InitiateScan(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string serverName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -345,13 +341,17 @@ public Response InitiateScan(string resourceGroupName, string serverName, string throw new ArgumentNullException(nameof(scanId)); } - using var message = CreateInitiateScanRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + VulnerabilityAssessmentScanRecord value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -377,7 +377,7 @@ internal HttpMessage CreateExportRequest(string resourceGroupName, string server uri.AppendPath("/scans/", false); uri.AppendPath(scanId, true); uri.AppendPath("/export", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentsRestOperations.cs index 5dcb7527798d1..3d3679dd7d50d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseVulnerabilityAssessmentsRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -274,7 +274,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -361,7 +361,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesExportOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesExportOperation.cs index 9e8c227f8be07..67d907584cecb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesExportOperation.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesExportOperation.cs @@ -16,10 +16,10 @@ namespace Azure.ResourceManager.Sql { - /// Exports a database to a bacpac. - public partial class DatabasesExportOperation : Operation, IOperationSource + /// Exports a database. + public partial class DatabasesExportOperation : Operation, IOperationSource { - private readonly ArmOperationHelpers _operation; + private readonly ArmOperationHelpers _operation; /// Initializes a new instance of DatabasesExportOperation for mocking. protected DatabasesExportOperation() @@ -28,13 +28,13 @@ protected DatabasesExportOperation() internal DatabasesExportOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabasesExportOperation"); + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabasesExportOperation"); } /// public override string Id => _operation.Id; /// - public override ImportExportResponse Value => _operation.Value; + public override ImportExportOperationResult Value => _operation.Value; /// public override bool HasCompleted => _operation.HasCompleted; @@ -52,21 +52,21 @@ internal DatabasesExportOperation(ClientDiagnostics clientDiagnostics, HttpPipel public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - ImportExportResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ImportExportOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return ImportExportResponse.DeserializeImportExportResponse(document.RootElement); + return ImportExportOperationResult.DeserializeImportExportOperationResult(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return ImportExportResponse.DeserializeImportExportResponse(document.RootElement); + return ImportExportOperationResult.DeserializeImportExportOperationResult(document.RootElement); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesImportOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesImportOperation.cs index 1e523f9bbacbd..4250eb600d5bb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesImportOperation.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesImportOperation.cs @@ -17,9 +17,9 @@ namespace Azure.ResourceManager.Sql { /// Imports a bacpac into a new database. - public partial class DatabasesImportOperation : Operation, IOperationSource + public partial class DatabasesImportOperation : Operation, IOperationSource { - private readonly ArmOperationHelpers _operation; + private readonly ArmOperationHelpers _operation; /// Initializes a new instance of DatabasesImportOperation for mocking. protected DatabasesImportOperation() @@ -28,13 +28,13 @@ protected DatabasesImportOperation() internal DatabasesImportOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabasesImportOperation"); + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabasesImportOperation"); } /// public override string Id => _operation.Id; /// - public override ImportExportResponse Value => _operation.Value; + public override ImportExportOperationResult Value => _operation.Value; /// public override bool HasCompleted => _operation.HasCompleted; @@ -52,21 +52,21 @@ internal DatabasesImportOperation(ClientDiagnostics clientDiagnostics, HttpPipel public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - ImportExportResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ImportExportOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return ImportExportResponse.DeserializeImportExportResponse(document.RootElement); + return ImportExportOperationResult.DeserializeImportExportOperationResult(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return ImportExportResponse.DeserializeImportExportResponse(document.RootElement); + return ImportExportOperationResult.DeserializeImportExportOperationResult(document.RootElement); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesOperations.cs index 9c46a2e7c037b..5e4c5ebcda778 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesOperations.cs @@ -290,9 +290,10 @@ Page FirstPageFunc(int? pageSizeHint) /// Gets a list of databases. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The String to use. /// The cancellation token to use. /// or is null. - public virtual AsyncPageable ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListByServerAsync(string resourceGroupName, string serverName, string skipToken = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -309,7 +310,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, skipToken, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -324,7 +325,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, skipToken, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -339,9 +340,10 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) /// Gets a list of databases. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The String to use. /// The cancellation token to use. /// or is null. - public virtual Pageable ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public virtual Pageable ListByServer(string resourceGroupName, string serverName, string skipToken = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -358,7 +360,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListByServer(resourceGroupName, serverName, cancellationToken); + var response = RestClient.ListByServer(resourceGroupName, serverName, skipToken, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -373,7 +375,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, skipToken, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -493,13 +495,12 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Imports a bacpac into a new database. + /// Gets a list of inaccessible databases in a logical server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The required parameters for importing a Bacpac into a database. /// The cancellation token to use. - /// , , or is null. - public virtual async Task StartImportAsync(string resourceGroupName, string serverName, ImportRequest parameters, CancellationToken cancellationToken = default) + /// or is null. + public virtual AsyncPageable ListInaccessibleByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -509,32 +510,46 @@ public virtual async Task StartImportAsync(string reso { throw new ArgumentNullException(nameof(serverName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartImport"); - scope.Start(); - try + async Task> FirstPageFunc(int? pageSizeHint) { - var originalResponse = await RestClient.ImportAsync(resourceGroupName, serverName, parameters, cancellationToken).ConfigureAwait(false); - return new DatabasesImportOperation(_clientDiagnostics, _pipeline, RestClient.CreateImportRequest(resourceGroupName, serverName, parameters).Request, originalResponse); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.ListInaccessibleByServer"); + scope.Start(); + try + { + var response = await RestClient.ListInaccessibleByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - catch (Exception e) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.ListInaccessibleByServer"); + scope.Start(); + try + { + var response = await RestClient.ListInaccessibleByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Imports a bacpac into a new database. + /// Gets a list of inaccessible databases in a logical server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The required parameters for importing a Bacpac into a database. /// The cancellation token to use. - /// , , or is null. - public virtual DatabasesImportOperation StartImport(string resourceGroupName, string serverName, ImportRequest parameters, CancellationToken cancellationToken = default) + /// or is null. + public virtual Pageable ListInaccessibleByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -544,34 +559,48 @@ public virtual DatabasesImportOperation StartImport(string resourceGroupName, st { throw new ArgumentNullException(nameof(serverName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartImport"); - scope.Start(); - try + Page FirstPageFunc(int? pageSizeHint) { - var originalResponse = RestClient.Import(resourceGroupName, serverName, parameters, cancellationToken); - return new DatabasesImportOperation(_clientDiagnostics, _pipeline, RestClient.CreateImportRequest(resourceGroupName, serverName, parameters).Request, originalResponse); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.ListInaccessibleByServer"); + scope.Start(); + try + { + var response = RestClient.ListInaccessibleByServer(resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - catch (Exception e) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.ListInaccessibleByServer"); + scope.Start(); + try + { + var response = RestClient.ListInaccessibleByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + /// Creates a new database or updates an existing database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to import into. - /// The name of the operation to perform. - /// The required parameters for importing a Bacpac into a database. + /// The name of the database. + /// The requested database resource state. /// The cancellation token to use. /// , , , or is null. - public virtual async Task StartCreateImportOperationAsync(string resourceGroupName, string serverName, string databaseName, ExtensionName extensionName, ImportExtensionRequest parameters, CancellationToken cancellationToken = default) + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -590,12 +619,12 @@ public virtual async Task StartCreateIm throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartCreateImportOperation"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartCreateOrUpdate"); scope.Start(); try { - var originalResponse = await RestClient.CreateImportOperationAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, cancellationToken).ConfigureAwait(false); - return new DatabasesCreateImportOperationOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateImportOperationRequest(resourceGroupName, serverName, databaseName, extensionName, parameters).Request, originalResponse); + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); + return new DatabasesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); } catch (Exception e) { @@ -604,15 +633,14 @@ public virtual async Task StartCreateIm } } - /// Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + /// Creates a new database or updates an existing database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to import into. - /// The name of the operation to perform. - /// The required parameters for importing a Bacpac into a database. + /// The name of the database. + /// The requested database resource state. /// The cancellation token to use. /// , , , or is null. - public virtual DatabasesCreateImportOperationOperation StartCreateImportOperation(string resourceGroupName, string serverName, string databaseName, ExtensionName extensionName, ImportExtensionRequest parameters, CancellationToken cancellationToken = default) + public virtual DatabasesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -631,12 +659,12 @@ public virtual DatabasesCreateImportOperationOperation StartCreateImportOperatio throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartCreateImportOperation"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartCreateOrUpdate"); scope.Start(); try { - var originalResponse = RestClient.CreateImportOperation(resourceGroupName, serverName, databaseName, extensionName, parameters, cancellationToken); - return new DatabasesCreateImportOperationOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateImportOperationRequest(resourceGroupName, serverName, databaseName, extensionName, parameters).Request, originalResponse); + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, cancellationToken); + return new DatabasesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); } catch (Exception e) { @@ -645,14 +673,13 @@ public virtual DatabasesCreateImportOperationOperation StartCreateImportOperatio } } - /// Exports a database to a bacpac. + /// Deletes the database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be exported. - /// The required parameters for exporting a database. + /// The name of the database. /// The cancellation token to use. - /// , , , or is null. - public virtual async Task StartExportAsync(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -666,17 +693,13 @@ public virtual async Task StartExportAsync(string reso { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartExport"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartDelete"); scope.Start(); try { - var originalResponse = await RestClient.ExportAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); - return new DatabasesExportOperation(_clientDiagnostics, _pipeline, RestClient.CreateExportRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return new DatabasesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); } catch (Exception e) { @@ -685,14 +708,13 @@ public virtual async Task StartExportAsync(string reso } } - /// Exports a database to a bacpac. + /// Deletes the database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be exported. - /// The required parameters for exporting a database. + /// The name of the database. /// The cancellation token to use. - /// , , , or is null. - public virtual DatabasesExportOperation StartExport(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual DatabasesDeleteOperation StartDelete(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -706,17 +728,13 @@ public virtual DatabasesExportOperation StartExport(string resourceGroupName, st { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartExport"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartDelete"); scope.Start(); try { - var originalResponse = RestClient.Export(resourceGroupName, serverName, databaseName, parameters, cancellationToken); - return new DatabasesExportOperation(_clientDiagnostics, _pipeline, RestClient.CreateExportRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); + var originalResponse = RestClient.Delete(resourceGroupName, serverName, databaseName, cancellationToken); + return new DatabasesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); } catch (Exception e) { @@ -725,14 +743,14 @@ public virtual DatabasesExportOperation StartExport(string resourceGroupName, st } } - /// Creates a new database or updates an existing database. + /// Updates an existing database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The requested database resource state. /// The cancellation token to use. /// , , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default) + public virtual async Task StartUpdateAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -751,12 +769,12 @@ public virtual async Task StartCreateOrUpdateA throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartCreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartUpdate"); scope.Start(); try { - var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); - return new DatabasesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); + var originalResponse = await RestClient.UpdateAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); + return new DatabasesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); } catch (Exception e) { @@ -765,14 +783,14 @@ public virtual async Task StartCreateOrUpdateA } } - /// Creates a new database or updates an existing database. + /// Updates an existing database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The requested database resource state. /// The cancellation token to use. /// , , , or is null. - public virtual DatabasesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default) + public virtual DatabasesUpdateOperation StartUpdate(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -791,12 +809,12 @@ public virtual DatabasesCreateOrUpdateOperation StartCreateOrUpdate(string resou throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartCreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartUpdate"); scope.Start(); try { - var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, cancellationToken); - return new DatabasesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); + var originalResponse = RestClient.Update(resourceGroupName, serverName, databaseName, parameters, cancellationToken); + return new DatabasesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); } catch (Exception e) { @@ -805,13 +823,14 @@ public virtual DatabasesCreateOrUpdateOperation StartCreateOrUpdate(string resou } } - /// Deletes the database. + /// Failovers a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. + /// The name of the database to failover. + /// The type of replica to be failed over. /// The cancellation token to use. /// , , or is null. - public virtual async Task StartDeleteAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public virtual async Task StartFailoverAsync(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -826,12 +845,12 @@ public virtual async Task StartDeleteAsync(string reso throw new ArgumentNullException(nameof(databaseName)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartDelete"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartFailover"); scope.Start(); try { - var originalResponse = await RestClient.DeleteAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); - return new DatabasesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); + var originalResponse = await RestClient.FailoverAsync(resourceGroupName, serverName, databaseName, replicaType, cancellationToken).ConfigureAwait(false); + return new DatabasesFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequest(resourceGroupName, serverName, databaseName, replicaType).Request, originalResponse); } catch (Exception e) { @@ -840,13 +859,14 @@ public virtual async Task StartDeleteAsync(string reso } } - /// Deletes the database. + /// Failovers a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. + /// The name of the database to failover. + /// The type of replica to be failed over. /// The cancellation token to use. /// , , or is null. - public virtual DatabasesDeleteOperation StartDelete(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public virtual DatabasesFailoverOperation StartFailover(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -861,12 +881,12 @@ public virtual DatabasesDeleteOperation StartDelete(string resourceGroupName, st throw new ArgumentNullException(nameof(databaseName)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartDelete"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartFailover"); scope.Start(); try { - var originalResponse = RestClient.Delete(resourceGroupName, serverName, databaseName, cancellationToken); - return new DatabasesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); + var originalResponse = RestClient.Failover(resourceGroupName, serverName, databaseName, replicaType, cancellationToken); + return new DatabasesFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequest(resourceGroupName, serverName, databaseName, replicaType).Request, originalResponse); } catch (Exception e) { @@ -875,14 +895,13 @@ public virtual DatabasesDeleteOperation StartDelete(string resourceGroupName, st } } - /// Updates an existing database. + /// Pauses a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// The requested database resource state. + /// The name of the database to be paused. /// The cancellation token to use. - /// , , , or is null. - public virtual async Task StartUpdateAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual async Task StartPauseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -896,17 +915,13 @@ public virtual async Task StartUpdateAsync(string reso { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartUpdate"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartPause"); scope.Start(); try { - var originalResponse = await RestClient.UpdateAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); - return new DatabasesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); + var originalResponse = await RestClient.PauseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return new DatabasesPauseOperation(_clientDiagnostics, _pipeline, RestClient.CreatePauseRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); } catch (Exception e) { @@ -915,14 +930,13 @@ public virtual async Task StartUpdateAsync(string reso } } - /// Updates an existing database. + /// Pauses a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// The requested database resource state. + /// The name of the database to be paused. /// The cancellation token to use. - /// , , , or is null. - public virtual DatabasesUpdateOperation StartUpdate(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual DatabasesPauseOperation StartPause(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -936,17 +950,13 @@ public virtual DatabasesUpdateOperation StartUpdate(string resourceGroupName, st { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartUpdate"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartPause"); scope.Start(); try { - var originalResponse = RestClient.Update(resourceGroupName, serverName, databaseName, parameters, cancellationToken); - return new DatabasesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); + var originalResponse = RestClient.Pause(resourceGroupName, serverName, databaseName, cancellationToken); + return new DatabasesPauseOperation(_clientDiagnostics, _pipeline, RestClient.CreatePauseRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); } catch (Exception e) { @@ -955,13 +965,13 @@ public virtual DatabasesUpdateOperation StartUpdate(string resourceGroupName, st } } - /// Pauses a database. + /// Resumes a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be paused. + /// The name of the database to be resumed. /// The cancellation token to use. /// , , or is null. - public virtual async Task StartPauseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public virtual async Task StartResumeAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -976,12 +986,12 @@ public virtual async Task StartPauseAsync(string resour throw new ArgumentNullException(nameof(databaseName)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartPause"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartResume"); scope.Start(); try { - var originalResponse = await RestClient.PauseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); - return new DatabasesPauseOperation(_clientDiagnostics, _pipeline, RestClient.CreatePauseRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); + var originalResponse = await RestClient.ResumeAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return new DatabasesResumeOperation(_clientDiagnostics, _pipeline, RestClient.CreateResumeRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); } catch (Exception e) { @@ -990,13 +1000,13 @@ public virtual async Task StartPauseAsync(string resour } } - /// Pauses a database. + /// Resumes a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be paused. + /// The name of the database to be resumed. /// The cancellation token to use. /// , , or is null. - public virtual DatabasesPauseOperation StartPause(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public virtual DatabasesResumeOperation StartResume(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1011,12 +1021,12 @@ public virtual DatabasesPauseOperation StartPause(string resourceGroupName, stri throw new ArgumentNullException(nameof(databaseName)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartPause"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartResume"); scope.Start(); try { - var originalResponse = RestClient.Pause(resourceGroupName, serverName, databaseName, cancellationToken); - return new DatabasesPauseOperation(_clientDiagnostics, _pipeline, RestClient.CreatePauseRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); + var originalResponse = RestClient.Resume(resourceGroupName, serverName, databaseName, cancellationToken); + return new DatabasesResumeOperation(_clientDiagnostics, _pipeline, RestClient.CreateResumeRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); } catch (Exception e) { @@ -1025,13 +1035,13 @@ public virtual DatabasesPauseOperation StartPause(string resourceGroupName, stri } } - /// Resumes a database. + /// Upgrades a data warehouse. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be resumed. + /// The name of the database to be upgraded. /// The cancellation token to use. /// , , or is null. - public virtual async Task StartResumeAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public virtual async Task StartUpgradeDataWarehouseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1046,12 +1056,12 @@ public virtual async Task StartResumeAsync(string reso throw new ArgumentNullException(nameof(databaseName)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartResume"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartUpgradeDataWarehouse"); scope.Start(); try { - var originalResponse = await RestClient.ResumeAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); - return new DatabasesResumeOperation(_clientDiagnostics, _pipeline, RestClient.CreateResumeRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); + var originalResponse = await RestClient.UpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return new DatabasesUpgradeDataWarehouseOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpgradeDataWarehouseRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); } catch (Exception e) { @@ -1060,13 +1070,13 @@ public virtual async Task StartResumeAsync(string reso } } - /// Resumes a database. + /// Upgrades a data warehouse. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be resumed. + /// The name of the database to be upgraded. /// The cancellation token to use. /// , , or is null. - public virtual DatabasesResumeOperation StartResume(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public virtual DatabasesUpgradeDataWarehouseOperation StartUpgradeDataWarehouse(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1081,12 +1091,12 @@ public virtual DatabasesResumeOperation StartResume(string resourceGroupName, st throw new ArgumentNullException(nameof(databaseName)); } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartResume"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartUpgradeDataWarehouse"); scope.Start(); try { - var originalResponse = RestClient.Resume(resourceGroupName, serverName, databaseName, cancellationToken); - return new DatabasesResumeOperation(_clientDiagnostics, _pipeline, RestClient.CreateResumeRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); + var originalResponse = RestClient.UpgradeDataWarehouse(resourceGroupName, serverName, databaseName, cancellationToken); + return new DatabasesUpgradeDataWarehouseOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpgradeDataWarehouseRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); } catch (Exception e) { @@ -1095,13 +1105,14 @@ public virtual DatabasesResumeOperation StartResume(string resourceGroupName, st } } - /// Upgrades a data warehouse. + /// Imports a bacpac into a new database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be upgraded. + /// The name of the database. + /// The database import request parameters. /// The cancellation token to use. - /// , , or is null. - public virtual async Task StartUpgradeDataWarehouseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , , or is null. + public virtual async Task StartImportAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1115,13 +1126,17 @@ public virtual async Task StartUpgradeDa { throw new ArgumentNullException(nameof(databaseName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartUpgradeDataWarehouse"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartImport"); scope.Start(); try { - var originalResponse = await RestClient.UpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); - return new DatabasesUpgradeDataWarehouseOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpgradeDataWarehouseRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); + var originalResponse = await RestClient.ImportAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); + return new DatabasesImportOperation(_clientDiagnostics, _pipeline, RestClient.CreateImportRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); } catch (Exception e) { @@ -1130,13 +1145,14 @@ public virtual async Task StartUpgradeDa } } - /// Upgrades a data warehouse. + /// Imports a bacpac into a new database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be upgraded. + /// The name of the database. + /// The database import request parameters. /// The cancellation token to use. - /// , , or is null. - public virtual DatabasesUpgradeDataWarehouseOperation StartUpgradeDataWarehouse(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , , or is null. + public virtual DatabasesImportOperation StartImport(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1150,13 +1166,17 @@ public virtual DatabasesUpgradeDataWarehouseOperation StartUpgradeDataWarehouse( { throw new ArgumentNullException(nameof(databaseName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartUpgradeDataWarehouse"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartImport"); scope.Start(); try { - var originalResponse = RestClient.UpgradeDataWarehouse(resourceGroupName, serverName, databaseName, cancellationToken); - return new DatabasesUpgradeDataWarehouseOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpgradeDataWarehouseRequest(resourceGroupName, serverName, databaseName).Request, originalResponse); + var originalResponse = RestClient.Import(resourceGroupName, serverName, databaseName, parameters, cancellationToken); + return new DatabasesImportOperation(_clientDiagnostics, _pipeline, RestClient.CreateImportRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); } catch (Exception e) { @@ -1165,14 +1185,14 @@ public virtual DatabasesUpgradeDataWarehouseOperation StartUpgradeDataWarehouse( } } - /// Failovers a database. + /// Exports a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to failover. - /// The type of replica to be failed over. + /// The name of the database. + /// The database export request parameters. /// The cancellation token to use. - /// , , or is null. - public virtual async Task StartFailoverAsync(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public virtual async Task StartExportAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1186,13 +1206,17 @@ public virtual async Task StartFailoverAsync(string { throw new ArgumentNullException(nameof(databaseName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartFailover"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartExport"); scope.Start(); try { - var originalResponse = await RestClient.FailoverAsync(resourceGroupName, serverName, databaseName, replicaType, cancellationToken).ConfigureAwait(false); - return new DatabasesFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequest(resourceGroupName, serverName, databaseName, replicaType).Request, originalResponse); + var originalResponse = await RestClient.ExportAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); + return new DatabasesExportOperation(_clientDiagnostics, _pipeline, RestClient.CreateExportRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); } catch (Exception e) { @@ -1201,14 +1225,14 @@ public virtual async Task StartFailoverAsync(string } } - /// Failovers a database. + /// Exports a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to failover. - /// The type of replica to be failed over. + /// The name of the database. + /// The database export request parameters. /// The cancellation token to use. - /// , , or is null. - public virtual DatabasesFailoverOperation StartFailover(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public virtual DatabasesExportOperation StartExport(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1222,13 +1246,17 @@ public virtual DatabasesFailoverOperation StartFailover(string resourceGroupName { throw new ArgumentNullException(nameof(databaseName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartFailover"); + using var scope = _clientDiagnostics.CreateScope("DatabasesOperations.StartExport"); scope.Start(); try { - var originalResponse = RestClient.Failover(resourceGroupName, serverName, databaseName, replicaType, cancellationToken); - return new DatabasesFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequest(resourceGroupName, serverName, databaseName, replicaType).Request, originalResponse); + var originalResponse = RestClient.Export(resourceGroupName, serverName, databaseName, parameters, cancellationToken); + return new DatabasesExportOperation(_clientDiagnostics, _pipeline, RestClient.CreateExportRequest(resourceGroupName, serverName, databaseName, parameters).Request, originalResponse); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesRestOperations.cs index 40cf41c1fe2d2..2b9c90a8429a9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesRestOperations.cs @@ -43,101 +43,11 @@ public DatabasesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline _pipeline = pipeline; } - internal HttpMessage CreateImportRequest(string resourceGroupName, string serverName, ImportRequest parameters) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/servers/", false); - uri.AppendPath(serverName, true); - uri.AppendPath("/import", false); - uri.AppendQuery("api-version", "2014-04-01", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; - return message; - } - - /// Imports a bacpac into a new database. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The required parameters for importing a Bacpac into a database. - /// The cancellation token to use. - /// , , or is null. - public async Task ImportAsync(string resourceGroupName, string serverName, ImportRequest parameters, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (serverName == null) - { - throw new ArgumentNullException(nameof(serverName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateImportRequest(resourceGroupName, serverName, parameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Imports a bacpac into a new database. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The required parameters for importing a Bacpac into a database. - /// The cancellation token to use. - /// , , or is null. - public Response Import(string resourceGroupName, string serverName, ImportRequest parameters, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (serverName == null) - { - throw new ArgumentNullException(nameof(serverName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - - using var message = CreateImportRequest(resourceGroupName, serverName, parameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCreateImportOperationRequest(string resourceGroupName, string serverName, string databaseName, ExtensionName extensionName, ImportExtensionRequest parameters) + internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string serverName, string databaseName, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -148,27 +58,22 @@ internal HttpMessage CreateCreateImportOperationRequest(string resourceGroupName uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/extensions/", false); - uri.AppendPath(extensionName.ToString(), true); + uri.AppendPath("/metrics", false); uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendQuery("$filter", filter, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; return message; } - /// Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + /// Returns database metrics. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to import into. - /// The name of the operation to perform. - /// The required parameters for importing a Bacpac into a database. + /// The name of the database. + /// An OData filter expression that describes a subset of metrics to return. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateImportOperationAsync(string resourceGroupName, string serverName, string databaseName, ExtensionName extensionName, ImportExtensionRequest parameters, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListMetricsAsync(string resourceGroupName, string serverName, string databaseName, string filter, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -182,32 +87,35 @@ public async Task CreateImportOperationAsync(string resourceGroupName, { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) + if (filter == null) { - throw new ArgumentNullException(nameof(parameters)); + throw new ArgumentNullException(nameof(filter)); } - using var message = CreateCreateImportOperationRequest(resourceGroupName, serverName, databaseName, extensionName, parameters); + using var message = CreateListMetricsRequest(resourceGroupName, serverName, databaseName, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 201: - case 202: - return message.Response; + case 200: + { + MetricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + /// Returns database metrics. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to import into. - /// The name of the operation to perform. - /// The required parameters for importing a Bacpac into a database. + /// The name of the database. + /// An OData filter expression that describes a subset of metrics to return. /// The cancellation token to use. - /// , , , or is null. - public Response CreateImportOperation(string resourceGroupName, string serverName, string databaseName, ExtensionName extensionName, ImportExtensionRequest parameters, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListMetrics(string resourceGroupName, string serverName, string databaseName, string filter, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -221,28 +129,32 @@ public Response CreateImportOperation(string resourceGroupName, string serverNam { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) + if (filter == null) { - throw new ArgumentNullException(nameof(parameters)); + throw new ArgumentNullException(nameof(filter)); } - using var message = CreateCreateImportOperationRequest(resourceGroupName, serverName, databaseName, extensionName, parameters); + using var message = CreateListMetricsRequest(resourceGroupName, serverName, databaseName, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 201: - case 202: - return message.Response; + case 200: + { + MetricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricListResult.DeserializeMetricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateExportRequest(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters) + internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -253,25 +165,20 @@ internal HttpMessage CreateExportRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/export", false); + uri.AppendPath("/metricDefinitions", false); uri.AppendQuery("api-version", "2014-04-01", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; return message; } - /// Exports a database to a bacpac. + /// Returns database metric definitions. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be exported. - /// The required parameters for exporting a database. + /// The name of the database. /// The cancellation token to use. - /// , , , or is null. - public async Task ExportAsync(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListMetricDefinitionsAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -285,31 +192,30 @@ public async Task ExportAsync(string resourceGroupName, string serverN { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateExportRequest(resourceGroupName, serverName, databaseName, parameters); + using var message = CreateListMetricDefinitionsRequest(resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + MetricDefinitionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetricDefinitionListResult.DeserializeMetricDefinitionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Exports a database to a bacpac. + /// Returns database metric definitions. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to be exported. - /// The required parameters for exporting a database. + /// The name of the database. /// The cancellation token to use. - /// , , , or is null. - public Response Export(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListMetricDefinitions(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -323,24 +229,24 @@ public Response Export(string resourceGroupName, string serverName, string datab { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateExportRequest(resourceGroupName, serverName, databaseName, parameters); + using var message = CreateListMetricDefinitionsRequest(resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + MetricDefinitionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetricDefinitionListResult.DeserializeMetricDefinitionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string serverName, string databaseName, string filter) + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName, string skipToken) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -353,24 +259,24 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string s uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2014-04-01", true); - uri.AppendQuery("$filter", filter, true); + uri.AppendPath("/databases", false); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Returns database metrics. + /// Gets a list of databases. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// An OData filter expression that describes a subset of metrics to return. + /// The String to use. /// The cancellation token to use. - /// , , , or is null. - public async Task> ListMetricsAsync(string resourceGroupName, string serverName, string databaseName, string filter, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByServerAsync(string resourceGroupName, string serverName, string skipToken = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -380,24 +286,16 @@ public async Task> ListMetricsAsync(string resourceGr { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - if (filter == null) - { - throw new ArgumentNullException(nameof(filter)); - } - using var message = CreateListMetricsRequest(resourceGroupName, serverName, databaseName, filter); + using var message = CreateListByServerRequest(resourceGroupName, serverName, skipToken); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - MetricListResult value = default; + DatabaseListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = MetricListResult.DeserializeMetricListResult(document.RootElement); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -405,14 +303,13 @@ public async Task> ListMetricsAsync(string resourceGr } } - /// Returns database metrics. + /// Gets a list of databases. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// An OData filter expression that describes a subset of metrics to return. + /// The String to use. /// The cancellation token to use. - /// , , , or is null. - public Response ListMetrics(string resourceGroupName, string serverName, string databaseName, string filter, CancellationToken cancellationToken = default) + /// or is null. + public Response ListByServer(string resourceGroupName, string serverName, string skipToken = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -422,24 +319,16 @@ public Response ListMetrics(string resourceGroupName, string s { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - if (filter == null) - { - throw new ArgumentNullException(nameof(filter)); - } - using var message = CreateListMetricsRequest(resourceGroupName, serverName, databaseName, filter); + using var message = CreateListByServerRequest(resourceGroupName, serverName, skipToken); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - MetricListResult value = default; + DatabaseListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = MetricListResult.DeserializeMetricListResult(document.RootElement); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -447,7 +336,7 @@ public Response ListMetrics(string resourceGroupName, string s } } - internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -462,20 +351,19 @@ internal HttpMessage CreateListMetricDefinitionsRequest(string resourceGroupName uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/metricDefinitions", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Returns database metric definitions. + /// Gets a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The cancellation token to use. /// , , or is null. - public async Task> ListMetricDefinitionsAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -490,15 +378,15 @@ public async Task> ListMetricDefinitionsAsy throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListMetricDefinitionsRequest(resourceGroupName, serverName, databaseName); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - MetricDefinitionListResult value = default; + Database value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = MetricDefinitionListResult.DeserializeMetricDefinitionListResult(document.RootElement); + value = Database.DeserializeDatabase(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -506,13 +394,13 @@ public async Task> ListMetricDefinitionsAsy } } - /// Returns database metric definitions. + /// Gets a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The cancellation token to use. /// , , or is null. - public Response ListMetricDefinitions(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -527,15 +415,15 @@ public Response ListMetricDefinitions(string resourc throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListMetricDefinitionsRequest(resourceGroupName, serverName, databaseName); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - MetricDefinitionListResult value = default; + Database value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = MetricDefinitionListResult.DeserializeMetricDefinitionListResult(document.RootElement); + value = Database.DeserializeDatabase(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -543,11 +431,11 @@ public Response ListMetricDefinitions(string resourc } } - internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, Database parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -556,19 +444,26 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/databases", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; return message; } - /// Gets a list of databases. + /// Creates a new database or updates an existing database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the database. + /// The requested database resource state. /// The cancellation token to use. - /// or is null. - public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -578,29 +473,36 @@ public async Task> ListByServerAsync(string resourc { throw new ArgumentNullException(nameof(serverName)); } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateListByServerRequest(resourceGroupName, serverName); + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - DatabaseListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 201: + case 202: + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Gets a list of databases. + /// Creates a new database or updates an existing database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the database. + /// The requested database resource state. /// The cancellation token to use. - /// or is null. - public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -610,28 +512,33 @@ public Response ListByServer(string resourceGroupName, strin { throw new ArgumentNullException(nameof(serverName)); } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateListByServerRequest(resourceGroupName, serverName); + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - DatabaseListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 201: + case 202: + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -642,19 +549,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a database. + /// Deletes the database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The cancellation token to use. /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -669,29 +575,26 @@ public async Task> GetAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName); + using var message = CreateDeleteRequest(resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - Database value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = Database.DeserializeDatabase(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + case 204: + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Gets a database. + /// Deletes the database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The cancellation token to use. /// , , or is null. - public Response Get(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + public Response Delete(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -706,27 +609,24 @@ public Response Get(string resourceGroupName, string serverName, strin throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName); + using var message = CreateDeleteRequest(resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - Database value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = Database.DeserializeDatabase(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + case 204: + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, Database parameters) + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -737,7 +637,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -747,14 +647,14 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin return message; } - /// Creates a new database or updates an existing database. + /// Updates an existing database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The requested database resource state. /// The cancellation token to use. /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -773,12 +673,11 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, parameters); + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: case 202: return message.Response; default: @@ -786,14 +685,14 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } } - /// Creates a new database or updates an existing database. + /// Updates an existing database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. /// The requested database resource state. /// The cancellation token to use. /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default) + public Response Update(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -812,12 +711,11 @@ public Response CreateOrUpdate(string resourceGroupName, string serverName, stri throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, parameters); + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: case 202: return message.Response; default: @@ -825,11 +723,11 @@ public Response CreateOrUpdate(string resourceGroupName, string serverName, stri } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateListByElasticPoolRequest(string resourceGroupName, string serverName, string elasticPoolName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -838,20 +736,22 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/elasticPools/", false); + uri.AppendPath(elasticPoolName, true); + uri.AppendPath("/databases", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); return message; } - /// Deletes the database. + /// Gets a list of databases in an elastic pool. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. + /// The name of the elastic pool. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByElasticPoolAsync(string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -861,31 +761,34 @@ public async Task DeleteAsync(string resourceGroupName, string serverN { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) + if (elasticPoolName == null) { - throw new ArgumentNullException(nameof(databaseName)); + throw new ArgumentNullException(nameof(elasticPoolName)); } - using var message = CreateDeleteRequest(resourceGroupName, serverName, databaseName); + using var message = CreateListByElasticPoolRequest(resourceGroupName, serverName, elasticPoolName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - case 204: - return message.Response; + { + DatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Deletes the database. + /// Gets a list of databases in an elastic pool. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. + /// The name of the elastic pool. /// The cancellation token to use. - /// , , or is null. - public Response Delete(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByElasticPool(string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -895,29 +798,32 @@ public Response Delete(string resourceGroupName, string serverName, string datab { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) + if (elasticPoolName == null) { - throw new ArgumentNullException(nameof(databaseName)); + throw new ArgumentNullException(nameof(elasticPoolName)); } - using var message = CreateDeleteRequest(resourceGroupName, serverName, databaseName); + using var message = CreateListByElasticPoolRequest(resourceGroupName, serverName, elasticPoolName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - case 204: - return message.Response; + { + DatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters) + internal HttpMessage CreateFailoverRequest(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -928,24 +834,24 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/failover", false); + if (replicaType != null) + { + uri.AppendQuery("replicaType", replicaType.Value.ToString(), true); + } + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; return message; } - /// Updates an existing database. + /// Failovers a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// The requested database resource state. + /// The name of the database to failover. + /// The type of replica to be failed over. /// The cancellation token to use. - /// , , , or is null. - public async Task UpdateAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task FailoverAsync(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -959,12 +865,8 @@ public async Task UpdateAsync(string resourceGroupName, string serverN { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters); + using var message = CreateFailoverRequest(resourceGroupName, serverName, databaseName, replicaType); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -976,14 +878,14 @@ public async Task UpdateAsync(string resourceGroupName, string serverN } } - /// Updates an existing database. + /// Failovers a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database. - /// The requested database resource state. + /// The name of the database to failover. + /// The type of replica to be failed over. /// The cancellation token to use. - /// , , , or is null. - public Response Update(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default) + /// , , or is null. + public Response Failover(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -997,12 +899,8 @@ public Response Update(string resourceGroupName, string serverName, string datab { throw new ArgumentNullException(nameof(databaseName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters); + using var message = CreateFailoverRequest(resourceGroupName, serverName, databaseName, replicaType); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1014,7 +912,7 @@ public Response Update(string resourceGroupName, string serverName, string datab } } - internal HttpMessage CreateListByElasticPoolRequest(string resourceGroupName, string serverName, string elasticPoolName) + internal HttpMessage CreateListInaccessibleByServerRequest(string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1027,22 +925,19 @@ internal HttpMessage CreateListByElasticPoolRequest(string resourceGroupName, st uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/elasticPools/", false); - uri.AppendPath(elasticPoolName, true); - uri.AppendPath("/databases", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/inaccessibleDatabases", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a list of databases in an elastic pool. + /// Gets a list of inaccessible databases in a logical server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the elastic pool. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByElasticPoolAsync(string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListInaccessibleByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1052,12 +947,8 @@ public async Task> ListByElasticPoolAsync(string re { throw new ArgumentNullException(nameof(serverName)); } - if (elasticPoolName == null) - { - throw new ArgumentNullException(nameof(elasticPoolName)); - } - using var message = CreateListByElasticPoolRequest(resourceGroupName, serverName, elasticPoolName); + using var message = CreateListInaccessibleByServerRequest(resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1073,13 +964,12 @@ public async Task> ListByElasticPoolAsync(string re } } - /// Gets a list of databases in an elastic pool. + /// Gets a list of inaccessible databases in a logical server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the elastic pool. /// The cancellation token to use. - /// , , or is null. - public Response ListByElasticPool(string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default) + /// or is null. + public Response ListInaccessibleByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1089,12 +979,8 @@ public Response ListByElasticPool(string resourceGroupName, { throw new ArgumentNullException(nameof(serverName)); } - if (elasticPoolName == null) - { - throw new ArgumentNullException(nameof(elasticPoolName)); - } - using var message = CreateListByElasticPoolRequest(resourceGroupName, serverName, elasticPoolName); + using var message = CreateListInaccessibleByServerRequest(resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1126,7 +1012,7 @@ internal HttpMessage CreatePauseRequest(string resourceGroupName, string serverN uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/pause", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1214,7 +1100,7 @@ internal HttpMessage CreateResumeRequest(string resourceGroupName, string server uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/resume", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1302,7 +1188,7 @@ internal HttpMessage CreateUpgradeDataWarehouseRequest(string resourceGroupName, uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/upgradeDataWarehouse", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; return message; } @@ -1389,7 +1275,7 @@ internal HttpMessage CreateRenameRequest(string resourceGroupName, string server uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/move", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); @@ -1472,7 +1358,7 @@ public Response Rename(string resourceGroupName, string serverName, string datab } } - internal HttpMessage CreateFailoverRequest(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType) + internal HttpMessage CreateImportRequest(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1487,24 +1373,127 @@ internal HttpMessage CreateFailoverRequest(string resourceGroupName, string serv uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/failover", false); - if (replicaType != null) + uri.AppendPath("/import", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Imports a bacpac into a new database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The database import request parameters. + /// The cancellation token to use. + /// , , , or is null. + public async Task ImportAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) { - uri.AppendQuery("replicaType", replicaType.Value.ToString(), true); + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateImportRequest(resourceGroupName, serverName, databaseName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Imports a bacpac into a new database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The database import request parameters. + /// The cancellation token to use. + /// , , , or is null. + public Response Import(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateImportRequest(resourceGroupName, serverName, databaseName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + } + + internal HttpMessage CreateExportRequest(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/export", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; return message; } - /// Failovers a database. + /// Exports a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to failover. - /// The type of replica to be failed over. + /// The name of the database. + /// The database export request parameters. /// The cancellation token to use. - /// , , or is null. - public async Task FailoverAsync(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task ExportAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1518,8 +1507,12 @@ public async Task FailoverAsync(string resourceGroupName, string serve { throw new ArgumentNullException(nameof(databaseName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateFailoverRequest(resourceGroupName, serverName, databaseName, replicaType); + using var message = CreateExportRequest(resourceGroupName, serverName, databaseName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1531,14 +1524,14 @@ public async Task FailoverAsync(string resourceGroupName, string serve } } - /// Failovers a database. + /// Exports a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to failover. - /// The type of replica to be failed over. + /// The name of the database. + /// The database export request parameters. /// The cancellation token to use. - /// , , or is null. - public Response Failover(string resourceGroupName, string serverName, string databaseName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Export(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -1552,8 +1545,12 @@ public Response Failover(string resourceGroupName, string serverName, string dat { throw new ArgumentNullException(nameof(databaseName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateFailoverRequest(resourceGroupName, serverName, databaseName, replicaType); + using var message = CreateExportRequest(resourceGroupName, serverName, databaseName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1565,7 +1562,7 @@ public Response Failover(string resourceGroupName, string serverName, string dat } } - internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName, string skipToken) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1582,9 +1579,10 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string r /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The String to use. /// The cancellation token to use. /// , , or is null. - public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, string skipToken = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -1599,7 +1597,7 @@ public async Task> ListByServerNextPageAsync(string throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName, skipToken); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1619,9 +1617,10 @@ public async Task> ListByServerNextPageAsync(string /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The String to use. /// The cancellation token to use. /// , , or is null. - public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, string skipToken = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -1636,7 +1635,7 @@ public Response ListByServerNextPage(string nextLink, string throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName, skipToken); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1748,5 +1747,92 @@ public Response ListByElasticPoolNextPage(string nextLink, s throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } + + internal HttpMessage CreateListInaccessibleByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of inaccessible databases in a logical server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListInaccessibleByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListInaccessibleByServerNextPageRequest(nextLink, resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of inaccessible databases in a logical server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public Response ListInaccessibleByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListInaccessibleByServerNextPageRequest(nextLink, resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseListResult.DeserializeDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersOperations.cs new file mode 100644 index 0000000000000..5a5fd97aa77e6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersOperations.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The DeletedServers service client. + public partial class DeletedServersOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal DeletedServersRestOperations RestClient { get; } + + /// Initializes a new instance of DeletedServersOperations for mocking. + protected DeletedServersOperations() + { + } + + /// Initializes a new instance of DeletedServersOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal DeletedServersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new DeletedServersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a deleted server. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + public virtual async Task> GetAsync(string locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(locationName, deletedServerName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a deleted server. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + public virtual Response Get(string locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(locationName, deletedServerName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of all deleted servers in a subscription. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of all deleted servers in a subscription. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.List"); + scope.Start(); + try + { + var response = RestClient.List(cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of deleted servers for a location. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// is null. + public virtual AsyncPageable ListByLocationAsync(string locationName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.ListByLocation"); + scope.Start(); + try + { + var response = await RestClient.ListByLocationAsync(locationName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.ListByLocation"); + scope.Start(); + try + { + var response = await RestClient.ListByLocationNextPageAsync(nextLink, locationName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of deleted servers for a location. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// is null. + public virtual Pageable ListByLocation(string locationName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.ListByLocation"); + scope.Start(); + try + { + var response = RestClient.ListByLocation(locationName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.ListByLocation"); + scope.Start(); + try + { + var response = RestClient.ListByLocationNextPage(nextLink, locationName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Recovers a deleted server. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartRecoverAsync(string locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (deletedServerName == null) + { + throw new ArgumentNullException(nameof(deletedServerName)); + } + + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.StartRecover"); + scope.Start(); + try + { + var originalResponse = await RestClient.RecoverAsync(locationName, deletedServerName, cancellationToken).ConfigureAwait(false); + return new DeletedServersRecoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateRecoverRequest(locationName, deletedServerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Recovers a deleted server. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// or is null. + public virtual DeletedServersRecoverOperation StartRecover(string locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (deletedServerName == null) + { + throw new ArgumentNullException(nameof(deletedServerName)); + } + + using var scope = _clientDiagnostics.CreateScope("DeletedServersOperations.StartRecover"); + scope.Start(); + try + { + var originalResponse = RestClient.Recover(locationName, deletedServerName, cancellationToken); + return new DeletedServersRecoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateRecoverRequest(locationName, deletedServerName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersRecoverOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersRecoverOperation.cs new file mode 100644 index 0000000000000..99995492e4262 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersRecoverOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Recovers a deleted server. + public partial class DeletedServersRecoverOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of DeletedServersRecoverOperation for mocking. + protected DeletedServersRecoverOperation() + { + } + + internal DeletedServersRecoverOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeletedServersRecoverOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override DeletedServer Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + DeletedServer IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return DeletedServer.DeserializeDeletedServer(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return DeletedServer.DeserializeDeletedServer(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersRestOperations.cs new file mode 100644 index 0000000000000..d8cca6d69f0e4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DeletedServersRestOperations.cs @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class DeletedServersRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of DeletedServersRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public DeletedServersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/deletedServers", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of all deleted servers in a subscription. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeletedServerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeletedServerListResult.DeserializeDeletedServerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of all deleted servers in a subscription. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeletedServerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeletedServerListResult.DeserializeDeletedServerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string locationName, string deletedServerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/deletedServers/", false); + uri.AppendPath(deletedServerName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a deleted server. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (deletedServerName == null) + { + throw new ArgumentNullException(nameof(deletedServerName)); + } + + using var message = CreateGetRequest(locationName, deletedServerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeletedServer value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeletedServer.DeserializeDeletedServer(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a deleted server. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// or is null. + public Response Get(string locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (deletedServerName == null) + { + throw new ArgumentNullException(nameof(deletedServerName)); + } + + using var message = CreateGetRequest(locationName, deletedServerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeletedServer value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeletedServer.DeserializeDeletedServer(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByLocationRequest(string locationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/deletedServers", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of deleted servers for a location. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// is null. + public async Task> ListByLocationAsync(string locationName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationRequest(locationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeletedServerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeletedServerListResult.DeserializeDeletedServerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of deleted servers for a location. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// is null. + public Response ListByLocation(string locationName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationRequest(locationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeletedServerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeletedServerListResult.DeserializeDeletedServerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRecoverRequest(string locationName, string deletedServerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/deletedServers/", false); + uri.AppendPath(deletedServerName, true); + uri.AppendPath("/recover", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Recovers a deleted server. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// or is null. + public async Task RecoverAsync(string locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (deletedServerName == null) + { + throw new ArgumentNullException(nameof(deletedServerName)); + } + + using var message = CreateRecoverRequest(locationName, deletedServerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Recovers a deleted server. + /// The name of the region where the resource is located. + /// The name of the deleted server. + /// The cancellation token to use. + /// or is null. + public Response Recover(string locationName, string deletedServerName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (deletedServerName == null) + { + throw new ArgumentNullException(nameof(deletedServerName)); + } + + using var message = CreateRecoverRequest(locationName, deletedServerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of all deleted servers in a subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeletedServerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeletedServerListResult.DeserializeDeletedServerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of all deleted servers in a subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeletedServerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeletedServerListResult.DeserializeDeletedServerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByLocationNextPageRequest(string nextLink, string locationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of deleted servers for a location. + /// The URL to the next page of results. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// or is null. + public async Task> ListByLocationNextPageAsync(string nextLink, string locationName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationNextPageRequest(nextLink, locationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeletedServerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeletedServerListResult.DeserializeDeletedServerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of deleted servers for a location. + /// The URL to the next page of results. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// or is null. + public Response ListByLocationNextPage(string nextLink, string locationName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationNextPageRequest(nextLink, locationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeletedServerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeletedServerListResult.DeserializeDeletedServerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolRestOperations.cs index bb1784d92df1d..f36d7e27af0fe 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolRestOperations.cs @@ -61,7 +61,7 @@ internal HttpMessage CreateCancelRequest(string resourceGroupName, string server uri.AppendPath("/operations/", false); uri.AppendPath(operationId, true); uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -148,7 +148,7 @@ internal HttpMessage CreateListByElasticPoolRequest(string resourceGroupName, st uri.AppendPath("/elasticPools/", false); uri.AppendPath(elasticPoolName, true); uri.AppendPath("/operations", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolsRestOperations.cs index a0c874fab1f0b..da31afb47a40c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ElasticPoolsRestOperations.cs @@ -264,7 +264,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string { uri.AppendQuery("$skip", skip.Value, true); } - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -351,7 +351,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/elasticPools/", false); uri.AppendPath(elasticPoolName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -446,7 +446,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/elasticPools/", false); uri.AppendPath(elasticPoolName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -549,7 +549,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/elasticPools/", false); uri.AppendPath(elasticPoolName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -637,7 +637,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/elasticPools/", false); uri.AppendPath(elasticPoolName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -739,7 +739,7 @@ internal HttpMessage CreateFailoverRequest(string resourceGroupName, string serv uri.AppendPath("/elasticPools/", false); uri.AppendPath(elasticPoolName, true); uri.AppendPath("/failover", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorsOperations.cs index 94769545ded07..9ad03552ae1c8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorsOperations.cs @@ -177,13 +177,14 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Revalidates an existing encryption protector. + /// Updates an existing encryption protector. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the encryption protector to be updated. + /// The requested encryption protector resource state. /// The cancellation token to use. - /// or is null. - public virtual async Task StartRevalidateAsync(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, EncryptionProtector parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -193,13 +194,17 @@ public virtual async Task StartRevalida { throw new ArgumentNullException(nameof(serverName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("EncryptionProtectorsOperations.StartRevalidate"); + using var scope = _clientDiagnostics.CreateScope("EncryptionProtectorsOperations.StartCreateOrUpdate"); scope.Start(); try { - var originalResponse = await RestClient.RevalidateAsync(resourceGroupName, serverName, encryptionProtectorName, cancellationToken).ConfigureAwait(false); - return new EncryptionProtectorsRevalidateOperation(_clientDiagnostics, _pipeline, RestClient.CreateRevalidateRequest(resourceGroupName, serverName, encryptionProtectorName).Request, originalResponse); + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters, cancellationToken).ConfigureAwait(false); + return new EncryptionProtectorsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, encryptionProtectorName, parameters).Request, originalResponse); } catch (Exception e) { @@ -208,13 +213,14 @@ public virtual async Task StartRevalida } } - /// Revalidates an existing encryption protector. + /// Updates an existing encryption protector. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the encryption protector to be updated. + /// The requested encryption protector resource state. /// The cancellation token to use. - /// or is null. - public virtual EncryptionProtectorsRevalidateOperation StartRevalidate(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual EncryptionProtectorsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, EncryptionProtector parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -224,13 +230,17 @@ public virtual EncryptionProtectorsRevalidateOperation StartRevalidate(string re { throw new ArgumentNullException(nameof(serverName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("EncryptionProtectorsOperations.StartRevalidate"); + using var scope = _clientDiagnostics.CreateScope("EncryptionProtectorsOperations.StartCreateOrUpdate"); scope.Start(); try { - var originalResponse = RestClient.Revalidate(resourceGroupName, serverName, encryptionProtectorName, cancellationToken); - return new EncryptionProtectorsRevalidateOperation(_clientDiagnostics, _pipeline, RestClient.CreateRevalidateRequest(resourceGroupName, serverName, encryptionProtectorName).Request, originalResponse); + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, encryptionProtectorName, parameters, cancellationToken); + return new EncryptionProtectorsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, encryptionProtectorName, parameters).Request, originalResponse); } catch (Exception e) { @@ -239,14 +249,13 @@ public virtual EncryptionProtectorsRevalidateOperation StartRevalidate(string re } } - /// Updates an existing encryption protector. + /// Revalidates an existing encryption protector. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the encryption protector to be updated. - /// The requested encryption protector resource state. /// The cancellation token to use. - /// , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, EncryptionProtector parameters, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task StartRevalidateAsync(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -256,17 +265,13 @@ public virtual async Task StartCrea { throw new ArgumentNullException(nameof(serverName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var scope = _clientDiagnostics.CreateScope("EncryptionProtectorsOperations.StartCreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("EncryptionProtectorsOperations.StartRevalidate"); scope.Start(); try { - var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters, cancellationToken).ConfigureAwait(false); - return new EncryptionProtectorsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, encryptionProtectorName, parameters).Request, originalResponse); + var originalResponse = await RestClient.RevalidateAsync(resourceGroupName, serverName, encryptionProtectorName, cancellationToken).ConfigureAwait(false); + return new EncryptionProtectorsRevalidateOperation(_clientDiagnostics, _pipeline, RestClient.CreateRevalidateRequest(resourceGroupName, serverName, encryptionProtectorName).Request, originalResponse); } catch (Exception e) { @@ -275,14 +280,13 @@ public virtual async Task StartCrea } } - /// Updates an existing encryption protector. + /// Revalidates an existing encryption protector. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the encryption protector to be updated. - /// The requested encryption protector resource state. /// The cancellation token to use. - /// , , or is null. - public virtual EncryptionProtectorsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, EncryptionProtector parameters, CancellationToken cancellationToken = default) + /// or is null. + public virtual EncryptionProtectorsRevalidateOperation StartRevalidate(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -292,17 +296,13 @@ public virtual EncryptionProtectorsCreateOrUpdateOperation StartCreateOrUpdate(s { throw new ArgumentNullException(nameof(serverName)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var scope = _clientDiagnostics.CreateScope("EncryptionProtectorsOperations.StartCreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("EncryptionProtectorsOperations.StartRevalidate"); scope.Start(); try { - var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, encryptionProtectorName, parameters, cancellationToken); - return new EncryptionProtectorsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, encryptionProtectorName, parameters).Request, originalResponse); + var originalResponse = RestClient.Revalidate(resourceGroupName, serverName, encryptionProtectorName, cancellationToken); + return new EncryptionProtectorsRevalidateOperation(_clientDiagnostics, _pipeline, RestClient.CreateRevalidateRequest(resourceGroupName, serverName, encryptionProtectorName).Request, originalResponse); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorsRestOperations.cs index a598bee05d356..2dcede6894734 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/EncryptionProtectorsRestOperations.cs @@ -43,85 +43,6 @@ public EncryptionProtectorsRestOperations(ClientDiagnostics clientDiagnostics, H _pipeline = pipeline; } - internal HttpMessage CreateRevalidateRequest(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/servers/", false); - uri.AppendPath(serverName, true); - uri.AppendPath("/encryptionProtector/", false); - uri.AppendPath(encryptionProtectorName.ToString(), true); - uri.AppendPath("/revalidate", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); - request.Uri = uri; - return message; - } - - /// Revalidates an existing encryption protector. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The name of the encryption protector to be updated. - /// The cancellation token to use. - /// or is null. - public async Task RevalidateAsync(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (serverName == null) - { - throw new ArgumentNullException(nameof(serverName)); - } - - using var message = CreateRevalidateRequest(resourceGroupName, serverName, encryptionProtectorName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - - /// Revalidates an existing encryption protector. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The name of the server. - /// The name of the encryption protector to be updated. - /// The cancellation token to use. - /// or is null. - public Response Revalidate(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) - { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (serverName == null) - { - throw new ArgumentNullException(nameof(serverName)); - } - - using var message = CreateRevalidateRequest(resourceGroupName, serverName, encryptionProtectorName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); @@ -136,7 +57,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/encryptionProtector", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -221,7 +142,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/encryptionProtector/", false); uri.AppendPath(encryptionProtectorName.ToString(), true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -308,7 +229,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/encryptionProtector/", false); uri.AppendPath(encryptionProtectorName.ToString(), true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -386,6 +307,85 @@ public Response CreateOrUpdate(string resourceGroupName, string serverName, Encr } } + internal HttpMessage CreateRevalidateRequest(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/encryptionProtector/", false); + uri.AppendPath(encryptionProtectorName.ToString(), true); + uri.AppendPath("/revalidate", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + return message; + } + + /// Revalidates an existing encryption protector. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the encryption protector to be updated. + /// The cancellation token to use. + /// or is null. + public async Task RevalidateAsync(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateRevalidateRequest(resourceGroupName, serverName, encryptionProtectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Revalidates an existing encryption protector. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the encryption protector to be updated. + /// The cancellation token to use. + /// or is null. + public Response Revalidate(string resourceGroupName, string serverName, EncryptionProtectorName encryptionProtectorName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateRevalidateRequest(resourceGroupName, serverName, encryptionProtectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesRestOperations.cs index a8f55616f0e0a..0bb33b4b3e1fe 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/extendedAuditingSettings/", false); uri.AppendPath("default", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -157,7 +157,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/extendedAuditingSettings/", false); uri.AppendPath("default", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -269,7 +269,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/extendedAuditingSettings", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesRestOperations.cs index dfe2d1272b273..18e5a090f9dd4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/extendedAuditingSettings/", false); uri.AppendPath("default", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -143,7 +143,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/extendedAuditingSettings/", false); uri.AppendPath("default", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -233,7 +233,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/extendedAuditingSettings", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupsRestOperations.cs index 340a8e022c6c2..a61c6f0dba84f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FailoverGroupsRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/failoverGroups/", false); uri.AppendPath(failoverGroupName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -153,7 +153,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/failoverGroups/", false); uri.AppendPath(failoverGroupName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -256,7 +256,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/failoverGroups/", false); uri.AppendPath(failoverGroupName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -344,7 +344,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/failoverGroups/", false); uri.AppendPath(failoverGroupName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -444,7 +444,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/failoverGroups", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -530,7 +530,7 @@ internal HttpMessage CreateFailoverRequest(string resourceGroupName, string serv uri.AppendPath("/failoverGroups/", false); uri.AppendPath(failoverGroupName, true); uri.AppendPath("/failover", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -618,7 +618,7 @@ internal HttpMessage CreateForceFailoverAllowDataLossRequest(string resourceGrou uri.AppendPath("/failoverGroups/", false); uri.AppendPath(failoverGroupName, true); uri.AppendPath("/forceFailoverAllowDataLoss", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FirewallRulesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FirewallRulesOperations.cs index 5131fc8124cdc..1332cf322f864 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FirewallRulesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FirewallRulesOperations.cs @@ -39,6 +39,46 @@ internal FirewallRulesOperations(ClientDiagnostics clientDiagnostics, HttpPipeli _pipeline = pipeline; } + /// Gets a firewall rule. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("FirewallRulesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, firewallRuleName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a firewall rule. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("FirewallRulesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, firewallRuleName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Creates or updates a firewall rule. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -121,18 +161,18 @@ public virtual Response Delete(string resourceGroupName, string serverName, stri } } - /// Gets a firewall rule. + /// Replaces all firewall rules on the server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the firewall rule. + /// The FirewallRuleList to use. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + public virtual async Task> ReplaceAsync(string resourceGroupName, string serverName, FirewallRuleList parameters, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("FirewallRulesOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("FirewallRulesOperations.Replace"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, serverName, firewallRuleName, cancellationToken).ConfigureAwait(false); + return await RestClient.ReplaceAsync(resourceGroupName, serverName, parameters, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -141,18 +181,18 @@ public virtual async Task> GetAsync(string resourceGroupN } } - /// Gets a firewall rule. + /// Replaces all firewall rules on the server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the firewall rule. + /// The FirewallRuleList to use. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + public virtual Response Replace(string resourceGroupName, string serverName, FirewallRuleList parameters, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("FirewallRulesOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("FirewallRulesOperations.Replace"); scope.Start(); try { - return RestClient.Get(resourceGroupName, serverName, firewallRuleName, cancellationToken); + return RestClient.Replace(resourceGroupName, serverName, parameters, cancellationToken); } catch (Exception e) { @@ -161,7 +201,7 @@ public virtual Response Get(string resourceGroupName, string serve } } - /// Returns a list of firewall rules. + /// Gets a list of firewall rules. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. @@ -184,7 +224,7 @@ async Task> FirstPageFunc(int? pageSizeHint) try { var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -192,10 +232,25 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("FirewallRulesOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Returns a list of firewall rules. + /// Gets a list of firewall rules. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. @@ -218,7 +273,22 @@ Page FirstPageFunc(int? pageSizeHint) try { var response = RestClient.ListByServer(resourceGroupName, serverName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("FirewallRulesOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -226,7 +296,7 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FirewallRulesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FirewallRulesRestOperations.cs index bca9a1a943682..1d3fec4760fa1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FirewallRulesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/FirewallRulesRestOperations.cs @@ -43,6 +43,101 @@ public FirewallRulesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipe _pipeline = pipeline; } + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string firewallRuleName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/firewallRules/", false); + uri.AppendPath(firewallRuleName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a firewall rule. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (firewallRuleName == null) + { + throw new ArgumentNullException(nameof(firewallRuleName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, firewallRuleName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FirewallRule value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = FirewallRule.DeserializeFirewallRule(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a firewall rule. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the firewall rule. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (firewallRuleName == null) + { + throw new ArgumentNullException(nameof(firewallRuleName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, firewallRuleName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FirewallRule value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = FirewallRule.DeserializeFirewallRule(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters) { var message = _pipeline.CreateMessage(); @@ -58,7 +153,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/firewallRules/", false); uri.AppendPath(firewallRuleName, true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -169,7 +264,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/firewallRules/", false); uri.AppendPath(firewallRuleName, true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -240,7 +335,7 @@ public Response Delete(string resourceGroupName, string serverName, string firew } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string firewallRuleName) + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -253,21 +348,19 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/firewallRules/", false); - uri.AppendPath(firewallRuleName, true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/firewallRules", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the firewall rule. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -277,12 +370,101 @@ public async Task> GetAsync(string resourceGroupName, str { throw new ArgumentNullException(nameof(serverName)); } - if (firewallRuleName == null) + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) { - throw new ArgumentNullException(nameof(firewallRuleName)); + case 200: + { + FirewallRuleListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = FirewallRuleListResult.DeserializeFirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } + } - using var message = CreateGetRequest(resourceGroupName, serverName, firewallRuleName); + /// Gets a list of firewall rules. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FirewallRuleListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = FirewallRuleListResult.DeserializeFirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateReplaceRequest(string resourceGroupName, string serverName, FirewallRuleList parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/firewallRules", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Replaces all firewall rules on the server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The FirewallRuleList to use. + /// The cancellation token to use. + /// , , or is null. + public async Task> ReplaceAsync(string resourceGroupName, string serverName, FirewallRuleList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateReplaceRequest(resourceGroupName, serverName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -293,18 +475,20 @@ public async Task> GetAsync(string resourceGroupName, str value = FirewallRule.DeserializeFirewallRule(document.RootElement); return Response.FromValue(value, message.Response); } + case 202: + return Response.FromValue(null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Gets a firewall rule. + /// Replaces all firewall rules on the server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the firewall rule. + /// The FirewallRuleList to use. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response Replace(string resourceGroupName, string serverName, FirewallRuleList parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -314,12 +498,12 @@ public Response Get(string resourceGroupName, string serverName, s { throw new ArgumentNullException(nameof(serverName)); } - if (firewallRuleName == null) + if (parameters == null) { - throw new ArgumentNullException(nameof(firewallRuleName)); + throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateGetRequest(resourceGroupName, serverName, firewallRuleName); + using var message = CreateReplaceRequest(resourceGroupName, serverName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -330,38 +514,38 @@ public Response Get(string resourceGroupName, string serverName, s value = FirewallRule.DeserializeFirewallRule(document.RootElement); return Response.FromValue(value, message.Response); } + case 202: + return Response.FromValue(null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/servers/", false); - uri.AppendPath(serverName, true); - uri.AppendPath("/firewallRules", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Returns a list of firewall rules. + /// Gets a list of firewall rules. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. - /// or is null. - public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -371,7 +555,7 @@ public async Task> ListByServerAsync(string res throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateListByServerRequest(resourceGroupName, serverName); + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -387,13 +571,18 @@ public async Task> ListByServerAsync(string res } } - /// Returns a list of firewall rules. + /// Gets a list of firewall rules. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. - /// or is null. - public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -403,7 +592,7 @@ public Response ListByServer(string resourceGroupName, s throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateListByServerRequest(resourceGroupName, serverName); + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupsRestOperations.cs index d61530d268072..b355d2031db18 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstanceFailoverGroupsRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string locationN uri.AppendPath(locationName, true); uri.AppendPath("/instanceFailoverGroups/", false); uri.AppendPath(failoverGroupName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -153,7 +153,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(locationName, true); uri.AppendPath("/instanceFailoverGroups/", false); uri.AppendPath(failoverGroupName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -256,7 +256,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string locati uri.AppendPath(locationName, true); uri.AppendPath("/instanceFailoverGroups/", false); uri.AppendPath(failoverGroupName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -343,7 +343,7 @@ internal HttpMessage CreateListByLocationRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/instanceFailoverGroups", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -429,7 +429,7 @@ internal HttpMessage CreateFailoverRequest(string resourceGroupName, string loca uri.AppendPath("/instanceFailoverGroups/", false); uri.AppendPath(failoverGroupName, true); uri.AppendPath("/failover", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -517,7 +517,7 @@ internal HttpMessage CreateForceFailoverAllowDataLossRequest(string resourceGrou uri.AppendPath("/instanceFailoverGroups/", false); uri.AppendPath(failoverGroupName, true); uri.AppendPath("/forceFailoverAllowDataLoss", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolsRestOperations.cs index ea7ff673ad13b..8d1efa4e46d23 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolsRestOperations.cs @@ -56,7 +56,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string instanceP uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/instancePools/", false); uri.AppendPath(instancePoolName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -139,7 +139,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/instancePools/", false); uri.AppendPath(instancePoolName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -230,7 +230,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string instan uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/instancePools/", false); uri.AppendPath(instancePoolName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -306,7 +306,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string instan uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/instancePools/", false); uri.AppendPath(instancePoolName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -394,7 +394,7 @@ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/instancePools", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -464,7 +464,7 @@ internal HttpMessage CreateListRequest() uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Sql/instancePools", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobAgentsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobAgentsRestOperations.cs index 1d0169c582856..90f58fc857e30 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobAgentsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobAgentsRestOperations.cs @@ -57,7 +57,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/jobAgents", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +142,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/jobAgents/", false); uri.AppendPath(jobAgentName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -237,7 +237,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/jobAgents/", false); uri.AppendPath(jobAgentName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -340,7 +340,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/jobAgents/", false); uri.AppendPath(jobAgentName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -428,7 +428,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/jobAgents/", false); uri.AppendPath(jobAgentName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobCredentialsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobCredentialsRestOperations.cs index 9b19b477062f7..751340e90e69a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobCredentialsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobCredentialsRestOperations.cs @@ -59,7 +59,7 @@ internal HttpMessage CreateListByAgentRequest(string resourceGroupName, string s uri.AppendPath("/jobAgents/", false); uri.AppendPath(jobAgentName, true); uri.AppendPath("/credentials", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -156,7 +156,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(jobAgentName, true); uri.AppendPath("/credentials/", false); uri.AppendPath(credentialName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -263,7 +263,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(jobAgentName, true); uri.AppendPath("/credentials/", false); uri.AppendPath(credentialName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -386,7 +386,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(jobAgentName, true); uri.AppendPath("/credentials/", false); uri.AppendPath(credentialName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobExecutionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobExecutionsRestOperations.cs index 2abb49e6a4a27..867c3cf5bec26 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobExecutionsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobExecutionsRestOperations.cs @@ -87,7 +87,7 @@ internal HttpMessage CreateListByAgentRequest(string resourceGroupName, string s { uri.AppendQuery("$top", top.Value, true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -201,7 +201,7 @@ internal HttpMessage CreateCancelRequest(string resourceGroupName, string server uri.AppendPath("/executions/", false); uri.AppendPath(jobExecutionId, true); uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -300,7 +300,7 @@ internal HttpMessage CreateCreateRequest(string resourceGroupName, string server uri.AppendPath("/jobs/", false); uri.AppendPath(jobName, true); uri.AppendPath("/start", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -428,7 +428,7 @@ internal HttpMessage CreateListByJobRequest(string resourceGroupName, string ser { uri.AppendQuery("$top", top.Value, true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -551,7 +551,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(jobName, true); uri.AppendPath("/executions/", false); uri.AppendPath(jobExecutionId, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -662,7 +662,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(jobName, true); uri.AppendPath("/executions/", false); uri.AppendPath(jobExecutionId, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobStepExecutionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobStepExecutionsRestOperations.cs index 598a1ac29551d..72d0c384f4aa2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobStepExecutionsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobStepExecutionsRestOperations.cs @@ -91,7 +91,7 @@ internal HttpMessage CreateListByJobExecutionRequest(string resourceGroupName, s { uri.AppendQuery("$top", top.Value, true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -218,7 +218,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(jobExecutionId, true); uri.AppendPath("/steps/", false); uri.AppendPath(stepName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobStepsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobStepsRestOperations.cs index 8a6d7a5bc6bf4..dc79ecb1f76ea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobStepsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobStepsRestOperations.cs @@ -63,7 +63,7 @@ internal HttpMessage CreateListByVersionRequest(string resourceGroupName, string uri.AppendPath("/versions/", false); uri.AppendPath(jobVersion, true); uri.AppendPath("/steps", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -176,7 +176,7 @@ internal HttpMessage CreateGetByVersionRequest(string resourceGroupName, string uri.AppendPath(jobVersion, true); uri.AppendPath("/steps/", false); uri.AppendPath(stepName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -296,7 +296,7 @@ internal HttpMessage CreateListByJobRequest(string resourceGroupName, string ser uri.AppendPath("/jobs/", false); uri.AppendPath(jobName, true); uri.AppendPath("/steps", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -405,7 +405,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(jobName, true); uri.AppendPath("/steps/", false); uri.AppendPath(stepName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -524,7 +524,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(jobName, true); uri.AppendPath("/steps/", false); uri.AppendPath(stepName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -659,7 +659,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(jobName, true); uri.AppendPath("/steps/", false); uri.AppendPath(stepName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobTargetExecutionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobTargetExecutionsRestOperations.cs index baad809d13621..b18c8f007f842 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobTargetExecutionsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobTargetExecutionsRestOperations.cs @@ -91,7 +91,7 @@ internal HttpMessage CreateListByJobExecutionRequest(string resourceGroupName, s { uri.AppendQuery("$top", top.Value, true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -247,7 +247,7 @@ internal HttpMessage CreateListByStepRequest(string resourceGroupName, string se { uri.AppendQuery("$top", top.Value, true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -386,7 +386,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(stepName, true); uri.AppendPath("/targets/", false); uri.AppendPath(targetId, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobTargetGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobTargetGroupsRestOperations.cs index a462d6636a4e2..6a8ec6005980e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobTargetGroupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobTargetGroupsRestOperations.cs @@ -59,7 +59,7 @@ internal HttpMessage CreateListByAgentRequest(string resourceGroupName, string s uri.AppendPath("/jobAgents/", false); uri.AppendPath(jobAgentName, true); uri.AppendPath("/targetGroups", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -156,7 +156,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(jobAgentName, true); uri.AppendPath("/targetGroups/", false); uri.AppendPath(targetGroupName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -263,7 +263,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(jobAgentName, true); uri.AppendPath("/targetGroups/", false); uri.AppendPath(targetGroupName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -386,7 +386,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(jobAgentName, true); uri.AppendPath("/targetGroups/", false); uri.AppendPath(targetGroupName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobVersionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobVersionsRestOperations.cs index e9d7b2f1beeaf..a2dcb275a1d02 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobVersionsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobVersionsRestOperations.cs @@ -61,7 +61,7 @@ internal HttpMessage CreateListByJobRequest(string resourceGroupName, string ser uri.AppendPath("/jobs/", false); uri.AppendPath(jobName, true); uri.AppendPath("/versions", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -170,7 +170,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(jobName, true); uri.AppendPath("/versions/", false); uri.AppendPath(jobVersion, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobsRestOperations.cs index 39ce0c31bc5ab..33ec04185f347 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/JobsRestOperations.cs @@ -59,7 +59,7 @@ internal HttpMessage CreateListByAgentRequest(string resourceGroupName, string s uri.AppendPath("/jobAgents/", false); uri.AppendPath(jobAgentName, true); uri.AppendPath("/jobs", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -156,7 +156,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(jobAgentName, true); uri.AppendPath("/jobs/", false); uri.AppendPath(jobName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -263,7 +263,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(jobAgentName, true); uri.AppendPath("/jobs/", false); uri.AppendPath(jobName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -386,7 +386,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(jobAgentName, true); uri.AppendPath("/jobs/", false); uri.AppendPath(jobName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsCreateOrUpdateOperation.cs new file mode 100644 index 0000000000000..a0e0b5b269cbe --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsCreateOrUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + public partial class LedgerDigestUploadsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of LedgerDigestUploadsCreateOrUpdateOperation for mocking. + protected LedgerDigestUploadsCreateOrUpdateOperation() + { + } + + internal LedgerDigestUploadsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "LedgerDigestUploadsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override LedgerDigestUploads Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + LedgerDigestUploads IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return LedgerDigestUploads.DeserializeLedgerDigestUploads(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return LedgerDigestUploads.DeserializeLedgerDigestUploads(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsDisableOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsDisableOperation.cs new file mode 100644 index 0000000000000..8149da9336a37 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsDisableOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + public partial class LedgerDigestUploadsDisableOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of LedgerDigestUploadsDisableOperation for mocking. + protected LedgerDigestUploadsDisableOperation() + { + } + + internal LedgerDigestUploadsDisableOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "LedgerDigestUploadsDisableOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override LedgerDigestUploads Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + LedgerDigestUploads IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return LedgerDigestUploads.DeserializeLedgerDigestUploads(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return LedgerDigestUploads.DeserializeLedgerDigestUploads(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsOperations.cs new file mode 100644 index 0000000000000..9e71674a87b35 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsOperations.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The LedgerDigestUploads service client. + public partial class LedgerDigestUploadsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal LedgerDigestUploadsRestOperations RestClient { get; } + + /// Initializes a new instance of LedgerDigestUploadsOperations for mocking. + protected LedgerDigestUploadsOperations() + { + } + + /// Initializes a new instance of LedgerDigestUploadsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal LedgerDigestUploadsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new LedgerDigestUploadsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets the current ledger digest upload configuration for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the current ledger digest upload configuration for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, ledgerDigestUploads, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets all ledger digest upload settings on a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all ledger digest upload settings on a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The LedgerDigestUploads to use. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, LedgerDigestUploads parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, cancellationToken).ConfigureAwait(false); + return new LedgerDigestUploadsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The LedgerDigestUploads to use. + /// The cancellation token to use. + /// , , , or is null. + public virtual LedgerDigestUploadsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, LedgerDigestUploads parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, cancellationToken); + return new LedgerDigestUploadsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDisableAsync(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.StartDisable"); + scope.Start(); + try + { + var originalResponse = await RestClient.DisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, cancellationToken).ConfigureAwait(false); + return new LedgerDigestUploadsDisableOperation(_clientDiagnostics, _pipeline, RestClient.CreateDisableRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + /// , , or is null. + public virtual LedgerDigestUploadsDisableOperation StartDisable(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var scope = _clientDiagnostics.CreateScope("LedgerDigestUploadsOperations.StartDisable"); + scope.Start(); + try + { + var originalResponse = RestClient.Disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads, cancellationToken); + return new LedgerDigestUploadsDisableOperation(_clientDiagnostics, _pipeline, RestClient.CreateDisableRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsRestOperations.cs new file mode 100644 index 0000000000000..e4e605860d8ec --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LedgerDigestUploadsRestOperations.cs @@ -0,0 +1,535 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class LedgerDigestUploadsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of LedgerDigestUploadsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public LedgerDigestUploadsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/ledgerDigestUploads/", false); + uri.AppendPath(ledgerDigestUploads.ToString(), true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the current ledger digest upload configuration for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LedgerDigestUploads value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LedgerDigestUploads.DeserializeLedgerDigestUploads(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the current ledger digest upload configuration for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LedgerDigestUploads value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LedgerDigestUploads.DeserializeLedgerDigestUploads(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, LedgerDigestUploads parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/ledgerDigestUploads/", false); + uri.AppendPath(ledgerDigestUploads.ToString(), true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The LedgerDigestUploads to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, LedgerDigestUploads parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The LedgerDigestUploads to use. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, LedgerDigestUploads parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/ledgerDigestUploads", false); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets all ledger digest upload settings on a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LedgerDigestUploadsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LedgerDigestUploadsListResult.DeserializeLedgerDigestUploadsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all ledger digest upload settings on a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LedgerDigestUploadsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LedgerDigestUploadsListResult.DeserializeLedgerDigestUploadsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDisableRequest(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/ledgerDigestUploads/", false); + uri.AppendPath(ledgerDigestUploads.ToString(), true); + uri.AppendPath("/disable", false); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + /// , , or is null. + public async Task DisableAsync(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateDisableRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The LedgerDigestUploadsName to use. + /// The cancellation token to use. + /// , , or is null. + public Response Disable(string resourceGroupName, string serverName, string databaseName, LedgerDigestUploadsName ledgerDigestUploads, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateDisableRequest(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets all ledger digest upload settings on a database. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LedgerDigestUploadsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LedgerDigestUploadsListResult.DeserializeLedgerDigestUploadsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all ledger digest upload settings on a database. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LedgerDigestUploadsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LedgerDigestUploadsListResult.DeserializeLedgerDigestUploadsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsCopyByResourceGroupOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsCopyByResourceGroupOperation.cs new file mode 100644 index 0000000000000..a576026211d6f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsCopyByResourceGroupOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Copy an existing long term retention backup to a different server. + public partial class LongTermRetentionBackupsCopyByResourceGroupOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of LongTermRetentionBackupsCopyByResourceGroupOperation for mocking. + protected LongTermRetentionBackupsCopyByResourceGroupOperation() + { + } + + internal LongTermRetentionBackupsCopyByResourceGroupOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "LongTermRetentionBackupsCopyByResourceGroupOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override LongTermRetentionBackupOperationResult Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + LongTermRetentionBackupOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return LongTermRetentionBackupOperationResult.DeserializeLongTermRetentionBackupOperationResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return LongTermRetentionBackupOperationResult.DeserializeLongTermRetentionBackupOperationResult(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsCopyOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsCopyOperation.cs new file mode 100644 index 0000000000000..0d9e00d9b10fc --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsCopyOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Copy an existing long term retention backup. + public partial class LongTermRetentionBackupsCopyOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of LongTermRetentionBackupsCopyOperation for mocking. + protected LongTermRetentionBackupsCopyOperation() + { + } + + internal LongTermRetentionBackupsCopyOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "LongTermRetentionBackupsCopyOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override LongTermRetentionBackupOperationResult Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + LongTermRetentionBackupOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return LongTermRetentionBackupOperationResult.DeserializeLongTermRetentionBackupOperationResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return LongTermRetentionBackupOperationResult.DeserializeLongTermRetentionBackupOperationResult(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsOperations.cs index 499b0ce99c84e..8bf01fd7aefd3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsOperations.cs @@ -40,19 +40,18 @@ internal LongTermRetentionBackupsOperations(ClientDiagnostics clientDiagnostics, } /// Gets a long term retention backup. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - public virtual async Task> GetByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.GetByResourceGroup"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.Get"); scope.Start(); try { - return await RestClient.GetByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -62,19 +61,18 @@ public virtual async Task> GetByResourceGroupA } /// Gets a long term retention backup. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - public virtual Response GetByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + public virtual Response Get(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.GetByResourceGroup"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.Get"); scope.Start(); try { - return RestClient.GetByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); + return RestClient.Get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); } catch (Exception e) { @@ -84,18 +82,19 @@ public virtual Response GetByResourceGroup(string resou } /// Gets a long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - public virtual async Task> GetAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + public virtual async Task> GetByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.GetByResourceGroup"); scope.Start(); try { - return await RestClient.GetAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); + return await RestClient.GetByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -105,18 +104,19 @@ public virtual async Task> GetAsync(string loc } /// Gets a long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - public virtual Response Get(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + public virtual Response GetByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.GetByResourceGroup"); scope.Start(); try { - return RestClient.Get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); + return RestClient.GetByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); } catch (Exception e) { @@ -126,20 +126,15 @@ public virtual Response Get(string locationName, string } /// Lists all long term retention backups for a database. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - public virtual AsyncPageable ListByResourceGroupDatabaseAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -155,11 +150,11 @@ public virtual AsyncPageable ListByResourceGroupDatabas async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupDatabase"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByDatabase"); scope.Start(); try { - var response = await RestClient.ListByResourceGroupDatabaseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByDatabaseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -170,11 +165,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupDatabase"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByDatabase"); scope.Start(); try { - var response = await RestClient.ListByResourceGroupDatabaseNextPageAsync(nextLink, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -187,20 +182,15 @@ async Task> NextPageFunc(string nextLink, int? pag } /// Lists all long term retention backups for a database. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - public virtual Pageable ListByResourceGroupDatabase(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual Pageable ListByDatabase(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -216,11 +206,11 @@ public virtual Pageable ListByResourceGroupDatabase(str Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupDatabase"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByDatabase"); scope.Start(); try { - var response = RestClient.ListByResourceGroupDatabase(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -231,11 +221,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupDatabase"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByDatabase"); scope.Start(); try { - var response = RestClient.ListByResourceGroupDatabaseNextPage(nextLink, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByDatabaseNextPage(nextLink, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -248,18 +238,13 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Lists the long term retention backups for a given location. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByResourceGroupLocationAsync(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// is null. + public virtual AsyncPageable ListByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -267,11 +252,11 @@ public virtual AsyncPageable ListByResourceGroupLocatio async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupLocation"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByLocation"); scope.Start(); try { - var response = await RestClient.ListByResourceGroupLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -282,11 +267,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupLocation"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByLocation"); scope.Start(); try { - var response = await RestClient.ListByResourceGroupLocationNextPageAsync(nextLink, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByLocationNextPageAsync(nextLink, locationName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -299,18 +284,13 @@ async Task> NextPageFunc(string nextLink, int? pag } /// Lists the long term retention backups for a given location. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByResourceGroupLocation(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// is null. + public virtual Pageable ListByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -318,11 +298,11 @@ public virtual Pageable ListByResourceGroupLocation(str Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupLocation"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByLocation"); scope.Start(); try { - var response = RestClient.ListByResourceGroupLocation(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -333,11 +313,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupLocation"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByLocation"); scope.Start(); try { - var response = RestClient.ListByResourceGroupLocationNextPage(nextLink, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByLocationNextPage(nextLink, locationName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -350,19 +330,14 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Lists the long term retention backups for a given server. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByResourceGroupServerAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual AsyncPageable ListByServerAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -374,11 +349,11 @@ public virtual AsyncPageable ListByResourceGroupServerA async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupServer"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByServer"); scope.Start(); try { - var response = await RestClient.ListByResourceGroupServerAsync(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -389,11 +364,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupServer"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByServer"); scope.Start(); try { - var response = await RestClient.ListByResourceGroupServerNextPageAsync(nextLink, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByServerNextPageAsync(nextLink, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -406,19 +381,14 @@ async Task> NextPageFunc(string nextLink, int? pag } /// Lists the long term retention backups for a given server. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByResourceGroupServer(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual Pageable ListByServer(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -430,11 +400,11 @@ public virtual Pageable ListByResourceGroupServer(strin Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupServer"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByServer"); scope.Start(); try { - var response = RestClient.ListByResourceGroupServer(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -445,11 +415,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupServer"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByServer"); scope.Start(); try { - var response = RestClient.ListByResourceGroupServerNextPage(nextLink, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByServerNextPage(nextLink, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -462,15 +432,20 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Lists all long term retention backups for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByDatabaseAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public virtual AsyncPageable ListByResourceGroupDatabaseAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -486,11 +461,11 @@ public virtual AsyncPageable ListByDatabaseAsync(string async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByDatabase"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupDatabase"); scope.Start(); try { - var response = await RestClient.ListByDatabaseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupDatabaseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -501,11 +476,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByDatabase"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupDatabase"); scope.Start(); try { - var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupDatabaseNextPageAsync(nextLink, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -518,15 +493,20 @@ async Task> NextPageFunc(string nextLink, int? pag } /// Lists all long term retention backups for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByDatabase(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public virtual Pageable ListByResourceGroupDatabase(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -542,11 +522,11 @@ public virtual Pageable ListByDatabase(string locationN Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByDatabase"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupDatabase"); scope.Start(); try { - var response = RestClient.ListByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByResourceGroupDatabase(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -557,11 +537,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByDatabase"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupDatabase"); scope.Start(); try { - var response = RestClient.ListByDatabaseNextPage(nextLink, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByResourceGroupDatabaseNextPage(nextLink, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -574,13 +554,18 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Lists the long term retention backups for a given location. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual AsyncPageable ListByResourceGroupLocationAsync(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -588,11 +573,11 @@ public virtual AsyncPageable ListByLocationAsync(string async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByLocation"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupLocation"); scope.Start(); try { - var response = await RestClient.ListByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -603,11 +588,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByLocation"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupLocation"); scope.Start(); try { - var response = await RestClient.ListByLocationNextPageAsync(nextLink, locationName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupLocationNextPageAsync(nextLink, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -620,13 +605,18 @@ async Task> NextPageFunc(string nextLink, int? pag } /// Lists the long term retention backups for a given location. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// is null. - public virtual Pageable ListByLocation(string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public virtual Pageable ListByResourceGroupLocation(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -634,11 +624,11 @@ public virtual Pageable ListByLocation(string locationN Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByLocation"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupLocation"); scope.Start(); try { - var response = RestClient.ListByLocation(locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByResourceGroupLocation(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -649,11 +639,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByLocation"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupLocation"); scope.Start(); try { - var response = RestClient.ListByLocationNextPage(nextLink, locationName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByResourceGroupLocationNextPage(nextLink, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -666,14 +656,19 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Lists the long term retention backups for a given server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByServerAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual AsyncPageable ListByResourceGroupServerAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -685,11 +680,11 @@ public virtual AsyncPageable ListByServerAsync(string l async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByServer"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupServer"); scope.Start(); try { - var response = await RestClient.ListByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupServerAsync(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -700,11 +695,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByServer"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupServer"); scope.Start(); try { - var response = await RestClient.ListByServerNextPageAsync(nextLink, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupServerNextPageAsync(nextLink, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -717,14 +712,19 @@ async Task> NextPageFunc(string nextLink, int? pag } /// Lists the long term retention backups for a given server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByServer(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual Pageable ListByResourceGroupServer(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -736,11 +736,11 @@ public virtual Pageable ListByServer(string locationNam Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByServer"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupServer"); scope.Start(); try { - var response = RestClient.ListByServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByResourceGroupServer(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -751,11 +751,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByServer"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.ListByResourceGroupServer"); scope.Start(); try { - var response = RestClient.ListByServerNextPage(nextLink, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); + var response = RestClient.ListByResourceGroupServerNextPage(nextLink, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -767,20 +767,16 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Deletes a long term retention backup. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// Copy an existing long term retention backup. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. + /// The parameters needed for long term retention copy request. /// The cancellation token to use. - /// , , , , or is null. - public virtual async Task StartDeleteByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public virtual async Task StartCopyAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -797,13 +793,17 @@ public virtual async Task Deletes a long term retention backup. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// Copy an existing long term retention backup. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. + /// The parameters needed for long term retention copy request. /// The cancellation token to use. - /// , , , , or is null. - public virtual LongTermRetentionBackupsDeleteByResourceGroupOperation StartDeleteByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public virtual LongTermRetentionBackupsCopyOperation StartCopy(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -842,13 +838,17 @@ public virtual LongTermRetentionBackupsDeleteByResourceGroupOperation StartDelet { throw new ArgumentNullException(nameof(backupName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartDeleteByResourceGroup"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartCopy"); scope.Start(); try { - var originalResponse = RestClient.DeleteByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); - return new LongTermRetentionBackupsDeleteByResourceGroupOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).Request, originalResponse); + var originalResponse = RestClient.Copy(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, cancellationToken); + return new LongTermRetentionBackupsCopyOperation(_clientDiagnostics, _pipeline, RestClient.CreateCopyRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).Request, originalResponse); } catch (Exception e) { @@ -857,14 +857,15 @@ public virtual LongTermRetentionBackupsDeleteByResourceGroupOperation StartDelet } } - /// Deletes a long term retention backup. + /// Updates an existing long term retention backup. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. + /// The requested backup resource state. /// The cancellation token to use. - /// , , , or is null. - public virtual async Task StartDeleteAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public virtual async Task StartUpdateAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) { if (locationName == null) { @@ -882,13 +883,17 @@ public virtual async Task StartDeleteAs { throw new ArgumentNullException(nameof(backupName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartDelete"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartUpdate"); scope.Start(); try { - var originalResponse = await RestClient.DeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); - return new LongTermRetentionBackupsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).Request, originalResponse); + var originalResponse = await RestClient.UpdateAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, cancellationToken).ConfigureAwait(false); + return new LongTermRetentionBackupsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).Request, originalResponse); } catch (Exception e) { @@ -897,14 +902,15 @@ public virtual async Task StartDeleteAs } } - /// Deletes a long term retention backup. + /// Updates an existing long term retention backup. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. + /// The requested backup resource state. /// The cancellation token to use. - /// , , , or is null. - public virtual LongTermRetentionBackupsDeleteOperation StartDelete(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public virtual LongTermRetentionBackupsUpdateOperation StartUpdate(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) { if (locationName == null) { @@ -922,13 +928,387 @@ public virtual LongTermRetentionBackupsDeleteOperation StartDelete(string locati { throw new ArgumentNullException(nameof(backupName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartDelete"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartUpdate"); scope.Start(); try { - var originalResponse = RestClient.Delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); - return new LongTermRetentionBackupsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).Request, originalResponse); + var originalResponse = RestClient.Update(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, cancellationToken); + return new LongTermRetentionBackupsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a long term retention backup. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartDeleteAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); + return new LongTermRetentionBackupsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a long term retention backup. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , , , or is null. + public virtual LongTermRetentionBackupsDeleteOperation StartDelete(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); + return new LongTermRetentionBackupsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Copy an existing long term retention backup to a different server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The parameters needed for long term retention copy request. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual async Task StartCopyByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartCopyByResourceGroup"); + scope.Start(); + try + { + var originalResponse = await RestClient.CopyByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, cancellationToken).ConfigureAwait(false); + return new LongTermRetentionBackupsCopyByResourceGroupOperation(_clientDiagnostics, _pipeline, RestClient.CreateCopyByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Copy an existing long term retention backup to a different server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The parameters needed for long term retention copy request. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual LongTermRetentionBackupsCopyByResourceGroupOperation StartCopyByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartCopyByResourceGroup"); + scope.Start(); + try + { + var originalResponse = RestClient.CopyByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, cancellationToken); + return new LongTermRetentionBackupsCopyByResourceGroupOperation(_clientDiagnostics, _pipeline, RestClient.CreateCopyByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates an existing long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The requested backup resource state. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual async Task StartUpdateByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartUpdateByResourceGroup"); + scope.Start(); + try + { + var originalResponse = await RestClient.UpdateByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, cancellationToken).ConfigureAwait(false); + return new LongTermRetentionBackupsUpdateByResourceGroupOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates an existing long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The requested backup resource state. + /// The cancellation token to use. + /// , , , , , or is null. + public virtual LongTermRetentionBackupsUpdateByResourceGroupOperation StartUpdateByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartUpdateByResourceGroup"); + scope.Start(); + try + { + var originalResponse = RestClient.UpdateByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters, cancellationToken); + return new LongTermRetentionBackupsUpdateByResourceGroupOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , , , , or is null. + public virtual async Task StartDeleteByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartDeleteByResourceGroup"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); + return new LongTermRetentionBackupsDeleteByResourceGroupOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , , , , or is null. + public virtual LongTermRetentionBackupsDeleteByResourceGroupOperation StartDeleteByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionBackupsOperations.StartDeleteByResourceGroup"); + scope.Start(); + try + { + var originalResponse = RestClient.DeleteByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); + return new LongTermRetentionBackupsDeleteByResourceGroupOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).Request, originalResponse); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsRestOperations.cs index 0270064b52593..c09df253437e2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsRestOperations.cs @@ -43,17 +43,15 @@ public LongTermRetentionBackupsRestOperations(ClientDiagnostics clientDiagnostic _pipeline = pipeline; } - internal HttpMessage CreateGetByResourceGroupRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + internal HttpMessage CreateCopyRequest(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); @@ -62,26 +60,70 @@ internal HttpMessage CreateGetByResourceGroupRequest(string resourceGroupName, s uri.AppendPath(longTermRetentionDatabaseName, true); uri.AppendPath("/longTermRetentionBackups/", false); uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendPath("/copy", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; return message; } - /// Gets a long term retention backup. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// Copy an existing long term retention backup. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. + /// The parameters needed for long term retention copy request. /// The cancellation token to use. - /// , , , , or is null. - public async Task> GetByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CopyAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) + if (locationName == null) { - throw new ArgumentNullException(nameof(resourceGroupName)); + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCopyRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Copy an existing long term retention backup. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The parameters needed for long term retention copy request. + /// The cancellation token to use. + /// , , , , or is null. + public Response Copy(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -98,8 +140,187 @@ public async Task> GetByResourceGroupAsync(str { throw new ArgumentNullException(nameof(backupName)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateGetByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + using var message = CreateCopyRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/longTermRetentionServers/", false); + uri.AppendPath(longTermRetentionServerName, true); + uri.AppendPath("/longTermRetentionDatabases/", false); + uri.AppendPath(longTermRetentionDatabaseName, true); + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/update", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Updates an existing long term retention backup. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The requested backup resource state. + /// The cancellation token to use. + /// , , , , or is null. + public async Task UpdateAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates an existing long term retention backup. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The requested backup resource state. + /// The cancellation token to use. + /// , , , , or is null. + public Response Update(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/longTermRetentionServers/", false); + uri.AppendPath(longTermRetentionServerName, true); + uri.AppendPath("/longTermRetentionDatabases/", false); + uri.AppendPath(longTermRetentionDatabaseName, true); + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a long term retention backup. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + + using var message = CreateGetRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -116,19 +337,14 @@ public async Task> GetByResourceGroupAsync(str } /// Gets a long term retention backup. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , , , , or is null. - public Response GetByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -146,7 +362,7 @@ public Response GetByResourceGroup(string resourceGroup throw new ArgumentNullException(nameof(backupName)); } - using var message = CreateGetByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + using var message = CreateGetRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -162,7 +378,7 @@ public Response GetByResourceGroup(string resourceGroup } } - internal HttpMessage CreateDeleteByResourceGroupRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + internal HttpMessage CreateDeleteRequest(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -171,8 +387,6 @@ internal HttpMessage CreateDeleteByResourceGroupRequest(string resourceGroupName uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); @@ -181,25 +395,20 @@ internal HttpMessage CreateDeleteByResourceGroupRequest(string resourceGroupName uri.AppendPath(longTermRetentionDatabaseName, true); uri.AppendPath("/longTermRetentionBackups/", false); uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; return message; } /// Deletes a long term retention backup. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , , , , or is null. - public async Task DeleteByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -217,7 +426,7 @@ public async Task DeleteByResourceGroupAsync(string resourceGroupName, throw new ArgumentNullException(nameof(backupName)); } - using var message = CreateDeleteByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + using var message = CreateDeleteRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -230,19 +439,14 @@ public async Task DeleteByResourceGroupAsync(string resourceGroupName, } /// Deletes a long term retention backup. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , , , , or is null. - public Response DeleteByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Delete(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -260,7 +464,7 @@ public Response DeleteByResourceGroup(string resourceGroupName, string locationN throw new ArgumentNullException(nameof(backupName)); } - using var message = CreateDeleteByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + using var message = CreateDeleteRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -272,7 +476,7 @@ public Response DeleteByResourceGroup(string resourceGroupName, string locationN } } - internal HttpMessage CreateListByResourceGroupDatabaseRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByDatabaseRequest(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -281,8 +485,6 @@ internal HttpMessage CreateListByResourceGroupDatabaseRequest(string resourceGro uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); @@ -298,27 +500,22 @@ internal HttpMessage CreateListByResourceGroupDatabaseRequest(string resourceGro { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Lists all long term retention backups for a database. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByResourceGroupDatabaseAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByDatabaseAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -332,7 +529,7 @@ public async Task> ListByResourceGro throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } - using var message = CreateListByResourceGroupDatabaseRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByDatabaseRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -349,20 +546,15 @@ public async Task> ListByResourceGro } /// Lists all long term retention backups for a database. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - public Response ListByResourceGroupDatabase(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByDatabase(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -376,7 +568,7 @@ public Response ListByResourceGroupDatabase(s throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } - using var message = CreateListByResourceGroupDatabaseRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByDatabaseRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -392,7 +584,7 @@ public Response ListByResourceGroupDatabase(s } } - internal HttpMessage CreateListByResourceGroupLocationRequest(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByLocationRequest(string locationName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -401,8 +593,6 @@ internal HttpMessage CreateListByResourceGroupLocationRequest(string resourceGro uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionBackups", false); @@ -414,31 +604,26 @@ internal HttpMessage CreateListByResourceGroupLocationRequest(string resourceGro { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Lists the long term retention backups for a given location. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public async Task> ListByResourceGroupLocationAsync(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// is null. + public async Task> ListByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } - using var message = CreateListByResourceGroupLocationRequest(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByLocationRequest(locationName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -455,24 +640,19 @@ public async Task> ListByResourceGro } /// Lists the long term retention backups for a given location. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public Response ListByResourceGroupLocation(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// is null. + public Response ListByLocation(string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } - using var message = CreateListByResourceGroupLocationRequest(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByLocationRequest(locationName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -488,7 +668,7 @@ public Response ListByResourceGroupLocation(s } } - internal HttpMessage CreateListByResourceGroupServerRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByServerRequest(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -497,8 +677,6 @@ internal HttpMessage CreateListByResourceGroupServerRequest(string resourceGroup uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); @@ -512,21 +690,120 @@ internal HttpMessage CreateListByResourceGroupServerRequest(string resourceGroup { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Lists the long term retention backups for a given server. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByResourceGroupServerAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByServerAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + + using var message = CreateListByServerRequest(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionBackupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists the long term retention backups for a given server. + /// The location of the database. + /// The name of the server. + /// Whether or not to only get the latest backup for each database. + /// Whether to query against just live databases, just deleted databases, or all databases. + /// The cancellation token to use. + /// or is null. + public Response ListByServer(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + + using var message = CreateListByServerRequest(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionBackupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCopyByResourceGroupRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/longTermRetentionServers/", false); + uri.AppendPath(longTermRetentionServerName, true); + uri.AppendPath("/longTermRetentionDatabases/", false); + uri.AppendPath(longTermRetentionDatabaseName, true); + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/copy", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Copy an existing long term retention backup to a different server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The parameters needed for long term retention copy request. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task CopyByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -536,36 +813,171 @@ public async Task> ListByResourceGro { throw new ArgumentNullException(nameof(locationName)); } - if (longTermRetentionServerName == null) + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCopyByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Copy an existing long term retention backup to a different server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The parameters needed for long term retention copy request. + /// The cancellation token to use. + /// , , , , , or is null. + public Response CopyByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CopyLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCopyByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateByResourceGroupRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/longTermRetentionServers/", false); + uri.AppendPath(longTermRetentionServerName, true); + uri.AppendPath("/longTermRetentionDatabases/", false); + uri.AppendPath(longTermRetentionDatabaseName, true); + uri.AppendPath("/longTermRetentionBackups/", false); + uri.AppendPath(backupName, true); + uri.AppendPath("/update", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Updates an existing long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. + /// The requested backup resource state. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task UpdateByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (longTermRetentionServerName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionServerName)); + } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) { - throw new ArgumentNullException(nameof(longTermRetentionServerName)); + throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateListByResourceGroupServerRequest(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateUpdateByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Lists the long term retention backups for a given server. + /// Updates an existing long term retention backup. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. - /// Whether or not to only get the latest backup for each database. - /// Whether to query against just live databases, just deleted databases, or all databases. + /// The name of the database. + /// The backup name. + /// The requested backup resource state. /// The cancellation token to use. - /// , , or is null. - public Response ListByResourceGroupServer(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public Response UpdateByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, UpdateLongTermRetentionBackupParameters parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -579,24 +991,32 @@ public Response ListByResourceGroupServer(str { throw new ArgumentNullException(nameof(longTermRetentionServerName)); } + if (longTermRetentionDatabaseName == null) + { + throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); + } + if (backupName == null) + { + throw new ArgumentNullException(nameof(backupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateListByResourceGroupServerRequest(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateUpdateByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - LongTermRetentionBackupListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LongTermRetentionBackupListResult.DeserializeLongTermRetentionBackupListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + internal HttpMessage CreateGetByResourceGroupRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -605,6 +1025,8 @@ internal HttpMessage CreateGetRequest(string locationName, string longTermRetent uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); @@ -613,21 +1035,26 @@ internal HttpMessage CreateGetRequest(string locationName, string longTermRetent uri.AppendPath(longTermRetentionDatabaseName, true); uri.AppendPath("/longTermRetentionBackups/", false); uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Gets a long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> GetByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -645,7 +1072,7 @@ public async Task> GetAsync(string locationNam throw new ArgumentNullException(nameof(backupName)); } - using var message = CreateGetRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + using var message = CreateGetByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -662,14 +1089,19 @@ public async Task> GetAsync(string locationNam } /// Gets a long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , , , or is null. - public Response Get(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response GetByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -687,7 +1119,7 @@ public Response Get(string locationName, string longTer throw new ArgumentNullException(nameof(backupName)); } - using var message = CreateGetRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + using var message = CreateGetByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -703,7 +1135,7 @@ public Response Get(string locationName, string longTer } } - internal HttpMessage CreateDeleteRequest(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) + internal HttpMessage CreateDeleteByResourceGroupRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -712,6 +1144,8 @@ internal HttpMessage CreateDeleteRequest(string locationName, string longTermRet uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); @@ -720,20 +1154,25 @@ internal HttpMessage CreateDeleteRequest(string locationName, string longTermRet uri.AppendPath(longTermRetentionDatabaseName, true); uri.AppendPath("/longTermRetentionBackups/", false); uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; return message; } /// Deletes a long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , , , or is null. - public async Task DeleteAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task DeleteByResourceGroupAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -751,7 +1190,7 @@ public async Task DeleteAsync(string locationName, string longTermRete throw new ArgumentNullException(nameof(backupName)); } - using var message = CreateDeleteRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + using var message = CreateDeleteByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -764,14 +1203,19 @@ public async Task DeleteAsync(string locationName, string longTermRete } /// Deletes a long term retention backup. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// The backup name. /// The cancellation token to use. - /// , , , or is null. - public Response Delete(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response DeleteByResourceGroup(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -789,7 +1233,7 @@ public Response Delete(string locationName, string longTermRetentionServerName, throw new ArgumentNullException(nameof(backupName)); } - using var message = CreateDeleteRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + using var message = CreateDeleteByResourceGroupRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -801,7 +1245,7 @@ public Response Delete(string locationName, string longTermRetentionServerName, } } - internal HttpMessage CreateListByDatabaseRequest(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByResourceGroupDatabaseRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -810,6 +1254,8 @@ internal HttpMessage CreateListByDatabaseRequest(string locationName, string lon uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); @@ -825,22 +1271,27 @@ internal HttpMessage CreateListByDatabaseRequest(string locationName, string lon { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Lists all long term retention backups for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByDatabaseAsync(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListByResourceGroupDatabaseAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -854,7 +1305,7 @@ public async Task> ListByDatabaseAsy throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } - using var message = CreateListByDatabaseRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupDatabaseRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -871,15 +1322,20 @@ public async Task> ListByDatabaseAsy } /// Lists all long term retention backups for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public Response ListByDatabase(string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListByResourceGroupDatabase(string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -893,7 +1349,7 @@ public Response ListByDatabase(string locatio throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } - using var message = CreateListByDatabaseRequest(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupDatabaseRequest(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -909,7 +1365,7 @@ public Response ListByDatabase(string locatio } } - internal HttpMessage CreateListByLocationRequest(string locationName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByResourceGroupLocationRequest(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -918,6 +1374,8 @@ internal HttpMessage CreateListByLocationRequest(string locationName, bool? only uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionBackups", false); @@ -929,26 +1387,31 @@ internal HttpMessage CreateListByLocationRequest(string locationName, bool? only { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Lists the long term retention backups for a given location. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// is null. - public async Task> ListByLocationAsync(string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByResourceGroupLocationAsync(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } - using var message = CreateListByLocationRequest(locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupLocationRequest(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -965,19 +1428,24 @@ public async Task> ListByLocationAsy } /// Lists the long term retention backups for a given location. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// is null. - public Response ListByLocation(string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public Response ListByResourceGroupLocation(string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } - using var message = CreateListByLocationRequest(locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupLocationRequest(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -993,7 +1461,7 @@ public Response ListByLocation(string locatio } } - internal HttpMessage CreateListByServerRequest(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByResourceGroupServerRequest(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1002,6 +1470,8 @@ internal HttpMessage CreateListByServerRequest(string locationName, string longT uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/longTermRetentionServers/", false); @@ -1015,21 +1485,26 @@ internal HttpMessage CreateListByServerRequest(string locationName, string longT { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Lists the long term retention backups for a given server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public async Task> ListByServerAsync(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByResourceGroupServerAsync(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1039,7 +1514,7 @@ public async Task> ListByServerAsync throw new ArgumentNullException(nameof(longTermRetentionServerName)); } - using var message = CreateListByServerRequest(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupServerRequest(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1056,14 +1531,19 @@ public async Task> ListByServerAsync } /// Lists the long term retention backups for a given server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public Response ListByServer(string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByResourceGroupServer(string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1073,7 +1553,7 @@ public Response ListByServer(string locationN throw new ArgumentNullException(nameof(longTermRetentionServerName)); } - using var message = CreateListByServerRequest(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupServerRequest(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1089,7 +1569,7 @@ public Response ListByServer(string locationN } } - internal HttpMessage CreateListByResourceGroupDatabaseNextPageRequest(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1104,24 +1584,19 @@ internal HttpMessage CreateListByResourceGroupDatabaseNextPageRequest(string nex /// Lists all long term retention backups for a database. /// The URL to the next page of results. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , , or is null. - public async Task> ListByResourceGroupDatabaseNextPageAsync(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1135,7 +1610,7 @@ public async Task> ListByResourceGro throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } - using var message = CreateListByResourceGroupDatabaseNextPageRequest(nextLink, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByDatabaseNextPageRequest(nextLink, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1153,24 +1628,19 @@ public async Task> ListByResourceGro /// Lists all long term retention backups for a database. /// The URL to the next page of results. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , , or is null. - public Response ListByResourceGroupDatabaseNextPage(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1184,7 +1654,7 @@ public Response ListByResourceGroupDatabaseNe throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } - using var message = CreateListByResourceGroupDatabaseNextPageRequest(nextLink, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByDatabaseNextPageRequest(nextLink, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1200,7 +1670,7 @@ public Response ListByResourceGroupDatabaseNe } } - internal HttpMessage CreateListByResourceGroupLocationNextPageRequest(string nextLink, string resourceGroupName, string locationName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByLocationNextPageRequest(string nextLink, string locationName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1215,28 +1685,23 @@ internal HttpMessage CreateListByResourceGroupLocationNextPageRequest(string nex /// Lists the long term retention backups for a given location. /// The URL to the next page of results. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByResourceGroupLocationNextPageAsync(string nextLink, string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByLocationNextPageAsync(string nextLink, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } - using var message = CreateListByResourceGroupLocationNextPageRequest(nextLink, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByLocationNextPageRequest(nextLink, locationName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1254,28 +1719,23 @@ public async Task> ListByResourceGro /// Lists the long term retention backups for a given location. /// The URL to the next page of results. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public Response ListByResourceGroupLocationNextPage(string nextLink, string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// or is null. + public Response ListByLocationNextPage(string nextLink, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } - using var message = CreateListByResourceGroupLocationNextPageRequest(nextLink, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByLocationNextPageRequest(nextLink, locationName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1291,7 +1751,7 @@ public Response ListByResourceGroupLocationNe } } - internal HttpMessage CreateListByResourceGroupServerNextPageRequest(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1306,23 +1766,18 @@ internal HttpMessage CreateListByResourceGroupServerNextPageRequest(string nextL /// Lists the long term retention backups for a given server. /// The URL to the next page of results. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByResourceGroupServerNextPageAsync(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByServerNextPageAsync(string nextLink, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1332,7 +1787,7 @@ public async Task> ListByResourceGro throw new ArgumentNullException(nameof(longTermRetentionServerName)); } - using var message = CreateListByResourceGroupServerNextPageRequest(nextLink, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByServerNextPageRequest(nextLink, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1350,23 +1805,18 @@ public async Task> ListByResourceGro /// Lists the long term retention backups for a given server. /// The URL to the next page of results. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - public Response ListByResourceGroupServerNextPage(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByServerNextPage(string nextLink, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1376,7 +1826,7 @@ public Response ListByResourceGroupServerNext throw new ArgumentNullException(nameof(longTermRetentionServerName)); } - using var message = CreateListByResourceGroupServerNextPageRequest(nextLink, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByServerNextPageRequest(nextLink, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1392,7 +1842,7 @@ public Response ListByResourceGroupServerNext } } - internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByResourceGroupDatabaseNextPageRequest(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1407,19 +1857,24 @@ internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string /// Lists all long term retention backups for a database. /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - public async Task> ListByDatabaseNextPageAsync(string nextLink, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> ListByResourceGroupDatabaseNextPageAsync(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1433,7 +1888,7 @@ public async Task> ListByDatabaseNex throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } - using var message = CreateListByDatabaseNextPageRequest(nextLink, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupDatabaseNextPageRequest(nextLink, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1451,19 +1906,24 @@ public async Task> ListByDatabaseNex /// Lists all long term retention backups for a database. /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// The name of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , , or is null. - public Response ListByDatabaseNextPage(string nextLink, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response ListByResourceGroupDatabaseNextPage(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1477,7 +1937,7 @@ public Response ListByDatabaseNextPage(string throw new ArgumentNullException(nameof(longTermRetentionDatabaseName)); } - using var message = CreateListByDatabaseNextPageRequest(nextLink, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupDatabaseNextPageRequest(nextLink, resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1493,7 +1953,7 @@ public Response ListByDatabaseNextPage(string } } - internal HttpMessage CreateListByLocationNextPageRequest(string nextLink, string locationName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByResourceGroupLocationNextPageRequest(string nextLink, string resourceGroupName, string locationName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1508,23 +1968,28 @@ internal HttpMessage CreateListByLocationNextPageRequest(string nextLink, string /// Lists the long term retention backups for a given location. /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public async Task> ListByLocationNextPageAsync(string nextLink, string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByResourceGroupLocationNextPageAsync(string nextLink, string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } - using var message = CreateListByLocationNextPageRequest(nextLink, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupLocationNextPageRequest(nextLink, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1542,23 +2007,28 @@ public async Task> ListByLocationNex /// Lists the long term retention backups for a given location. /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// or is null. - public Response ListByLocationNextPage(string nextLink, string locationName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByResourceGroupLocationNextPage(string nextLink, string resourceGroupName, string locationName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); } - using var message = CreateListByLocationNextPageRequest(nextLink, locationName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupLocationNextPageRequest(nextLink, resourceGroupName, locationName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1574,7 +2044,7 @@ public Response ListByLocationNextPage(string } } - internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, LongTermRetentionDatabaseState? databaseState) + internal HttpMessage CreateListByResourceGroupServerNextPageRequest(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase, DatabaseState? databaseState) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1589,18 +2059,23 @@ internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string l /// Lists the long term retention backups for a given server. /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByServerNextPageAsync(string nextLink, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListByResourceGroupServerNextPageAsync(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1610,7 +2085,7 @@ public async Task> ListByServerNextP throw new ArgumentNullException(nameof(longTermRetentionServerName)); } - using var message = CreateListByServerNextPageRequest(nextLink, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupServerNextPageRequest(nextLink, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1628,18 +2103,23 @@ public async Task> ListByServerNextP /// Lists the long term retention backups for a given server. /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The location of the database. /// The name of the server. /// Whether or not to only get the latest backup for each database. /// Whether to query against just live databases, just deleted databases, or all databases. /// The cancellation token to use. - /// , , or is null. - public Response ListByServerNextPage(string nextLink, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, LongTermRetentionDatabaseState? databaseState = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListByResourceGroupServerNextPage(string nextLink, string resourceGroupName, string locationName, string longTermRetentionServerName, bool? onlyLatestPerDatabase = null, DatabaseState? databaseState = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } if (locationName == null) { throw new ArgumentNullException(nameof(locationName)); @@ -1649,7 +2129,7 @@ public Response ListByServerNextPage(string n throw new ArgumentNullException(nameof(longTermRetentionServerName)); } - using var message = CreateListByServerNextPageRequest(nextLink, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); + using var message = CreateListByResourceGroupServerNextPageRequest(nextLink, resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsUpdateByResourceGroupOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsUpdateByResourceGroupOperation.cs new file mode 100644 index 0000000000000..86bdcc0c7d7a1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsUpdateByResourceGroupOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Updates an existing long term retention backup. + public partial class LongTermRetentionBackupsUpdateByResourceGroupOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of LongTermRetentionBackupsUpdateByResourceGroupOperation for mocking. + protected LongTermRetentionBackupsUpdateByResourceGroupOperation() + { + } + + internal LongTermRetentionBackupsUpdateByResourceGroupOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "LongTermRetentionBackupsUpdateByResourceGroupOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override LongTermRetentionBackupOperationResult Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + LongTermRetentionBackupOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return LongTermRetentionBackupOperationResult.DeserializeLongTermRetentionBackupOperationResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return LongTermRetentionBackupOperationResult.DeserializeLongTermRetentionBackupOperationResult(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsUpdateOperation.cs new file mode 100644 index 0000000000000..c04840d7f8b3a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionBackupsUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Updates an existing long term retention backup. + public partial class LongTermRetentionBackupsUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of LongTermRetentionBackupsUpdateOperation for mocking. + protected LongTermRetentionBackupsUpdateOperation() + { + } + + internal LongTermRetentionBackupsUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "LongTermRetentionBackupsUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override LongTermRetentionBackupOperationResult Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + LongTermRetentionBackupOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return LongTermRetentionBackupOperationResult.DeserializeLongTermRetentionBackupOperationResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return LongTermRetentionBackupOperationResult.DeserializeLongTermRetentionBackupOperationResult(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsRestOperations.cs index 250146c8d4822..0c3875847dd24 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string locationName, string managedInstanc uri.AppendPath(databaseName, true); uri.AppendPath("/longTermRetentionManagedInstanceBackups/", false); uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -167,7 +167,7 @@ internal HttpMessage CreateDeleteRequest(string locationName, string managedInst uri.AppendPath(databaseName, true); uri.AppendPath("/longTermRetentionManagedInstanceBackups/", false); uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; return message; } @@ -272,7 +272,7 @@ internal HttpMessage CreateListByDatabaseRequest(string locationName, string man { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -378,7 +378,7 @@ internal HttpMessage CreateListByInstanceRequest(string locationName, string man { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -472,7 +472,7 @@ internal HttpMessage CreateListByLocationRequest(string locationName, bool? only { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -555,7 +555,7 @@ internal HttpMessage CreateGetByResourceGroupRequest(string resourceGroupName, s uri.AppendPath(databaseName, true); uri.AppendPath("/longTermRetentionManagedInstanceBackups/", false); uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -674,7 +674,7 @@ internal HttpMessage CreateDeleteByResourceGroupRequest(string resourceGroupName uri.AppendPath(databaseName, true); uri.AppendPath("/longTermRetentionManagedInstanceBackups/", false); uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; return message; } @@ -791,7 +791,7 @@ internal HttpMessage CreateListByResourceGroupDatabaseRequest(string resourceGro { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -909,7 +909,7 @@ internal HttpMessage CreateListByResourceGroupInstanceRequest(string resourceGro { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1015,7 +1015,7 @@ internal HttpMessage CreateListByResourceGroupLocationRequest(string resourceGro { uri.AppendQuery("databaseState", databaseState.Value.ToString(), true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesCreateOrUpdateOperation.cs new file mode 100644 index 0000000000000..4066b4e923c4c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesCreateOrUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Sets a database's long term retention policy. + public partial class LongTermRetentionPoliciesCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of LongTermRetentionPoliciesCreateOrUpdateOperation for mocking. + protected LongTermRetentionPoliciesCreateOrUpdateOperation() + { + } + + internal LongTermRetentionPoliciesCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "LongTermRetentionPoliciesCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override LongTermRetentionPolicy Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + LongTermRetentionPolicy IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return LongTermRetentionPolicy.DeserializeLongTermRetentionPolicy(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return LongTermRetentionPolicy.DeserializeLongTermRetentionPolicy(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs similarity index 51% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs index 35d4eb00fd6f8..9237725672d16 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/BackupLongTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesOperations.cs @@ -9,31 +9,32 @@ using System.Threading; using System.Threading.Tasks; using Azure; +using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql { - /// The BackupLongTermRetentionPolicies service client. - public partial class BackupLongTermRetentionPoliciesOperations + /// The LongTermRetentionPolicies service client. + public partial class LongTermRetentionPoliciesOperations { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; - internal BackupLongTermRetentionPoliciesRestOperations RestClient { get; } + internal LongTermRetentionPoliciesRestOperations RestClient { get; } - /// Initializes a new instance of BackupLongTermRetentionPoliciesOperations for mocking. - protected BackupLongTermRetentionPoliciesOperations() + /// Initializes a new instance of LongTermRetentionPoliciesOperations for mocking. + protected LongTermRetentionPoliciesOperations() { } - /// Initializes a new instance of BackupLongTermRetentionPoliciesOperations. + /// Initializes a new instance of LongTermRetentionPoliciesOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. - internal BackupLongTermRetentionPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + internal LongTermRetentionPoliciesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { - RestClient = new BackupLongTermRetentionPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new LongTermRetentionPoliciesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } @@ -44,9 +45,9 @@ internal BackupLongTermRetentionPoliciesOperations(ClientDiagnostics clientDiagn /// The name of the database. /// The policy name. Should always be Default. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("BackupLongTermRetentionPoliciesOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionPoliciesOperations.Get"); scope.Start(); try { @@ -65,9 +66,9 @@ public virtual async Task> GetAsync(stri /// The name of the database. /// The policy name. Should always be Default. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("BackupLongTermRetentionPoliciesOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionPoliciesOperations.Get"); scope.Start(); try { @@ -85,19 +86,53 @@ public virtual Response Get(string resourceGroupN /// The name of the server. /// The name of the database. /// The cancellation token to use. - public virtual async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("BackupLongTermRetentionPoliciesOperations.ListByDatabase"); - scope.Start(); - try + if (resourceGroupName == null) { - return await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + throw new ArgumentNullException(nameof(resourceGroupName)); } - catch (Exception e) + if (serverName == null) { - scope.Failed(e); - throw; + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionPoliciesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionPoliciesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// Gets a database's long term retention policy. @@ -105,19 +140,53 @@ public virtual async Task> ListByDatabas /// The name of the server. /// The name of the database. /// The cancellation token to use. - public virtual Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("BackupLongTermRetentionPoliciesOperations.ListByDatabase"); - scope.Start(); - try + if (resourceGroupName == null) { - return RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); + throw new ArgumentNullException(nameof(resourceGroupName)); } - catch (Exception e) + if (serverName == null) { - scope.Failed(e); - throw; + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionPoliciesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionPoliciesOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// Sets a database's long term retention policy. @@ -128,7 +197,7 @@ public virtual Response ListByDatabase(string res /// The long term retention policy info. /// The cancellation token to use. /// , , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, BackupLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default) + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -147,12 +216,12 @@ public virtual async Task The long term retention policy info. /// The cancellation token to use. /// , , , or is null. - public virtual BackupLongTermRetentionPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, BackupLongTermRetentionPolicy parameters, CancellationToken cancellationToken = default) + public virtual LongTermRetentionPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -188,12 +257,12 @@ public virtual BackupLongTermRetentionPoliciesCreateOrUpdateOperation StartCreat throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("BackupLongTermRetentionPoliciesOperations.StartCreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("LongTermRetentionPoliciesOperations.StartCreateOrUpdate"); scope.Start(); try { var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, parameters, cancellationToken); - return new BackupLongTermRetentionPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, policyName, parameters).Request, originalResponse); + return new LongTermRetentionPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, policyName, parameters).Request, originalResponse); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesRestOperations.cs new file mode 100644 index 0000000000000..7e26f35e0b14a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongTermRetentionPoliciesRestOperations.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class LongTermRetentionPoliciesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of LongTermRetentionPoliciesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public LongTermRetentionPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/backupLongTermRetentionPolicies/", false); + uri.AppendPath(policyName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a database's long term retention policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The policy name. Should always be Default. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, policyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionPolicy value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionPolicy.DeserializeLongTermRetentionPolicy(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a database's long term retention policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The policy name. Should always be Default. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, policyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionPolicy value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionPolicy.DeserializeLongTermRetentionPolicy(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicy parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/backupLongTermRetentionPolicies/", false); + uri.AppendPath(policyName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Sets a database's long term retention policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The policy name. Should always be Default. + /// The long term retention policy info. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicy parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, policyName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Sets a database's long term retention policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The policy name. Should always be Default. + /// The long term retention policy info. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, LongTermRetentionPolicyName policyName, LongTermRetentionPolicy parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, policyName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/backupLongTermRetentionPolicies", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a database's long term retention policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionPolicyListResult.DeserializeLongTermRetentionPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a database's long term retention policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionPolicyListResult.DeserializeLongTermRetentionPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a database's long term retention policy. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LongTermRetentionPolicyListResult.DeserializeLongTermRetentionPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a database's long term retention policy. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LongTermRetentionPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LongTermRetentionPolicyListResult.DeserializeLongTermRetentionPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs new file mode 100644 index 0000000000000..12f269cb129d4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The MaintenanceWindowOptions service client. + public partial class MaintenanceWindowOptionsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal MaintenanceWindowOptionsRestOperations RestClient { get; } + + /// Initializes a new instance of MaintenanceWindowOptionsOperations for mocking. + protected MaintenanceWindowOptionsOperations() + { + } + + /// Initializes a new instance of MaintenanceWindowOptionsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal MaintenanceWindowOptionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new MaintenanceWindowOptionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a list of available maintenance windows. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database to get maintenance windows options for. + /// Maintenance window options name. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MaintenanceWindowOptionsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of available maintenance windows. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database to get maintenance windows options for. + /// Maintenance window options name. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MaintenanceWindowOptionsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionActivitiesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionsRestOperations.cs similarity index 63% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionActivitiesRestOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionsRestOperations.cs index cc76ffe362c54..93fe915c986f3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionActivitiesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowOptionsRestOperations.cs @@ -16,20 +16,20 @@ namespace Azure.ResourceManager.Sql { - internal partial class TransparentDataEncryptionActivitiesRestOperations + internal partial class MaintenanceWindowOptionsRestOperations { private string subscriptionId; private Uri endpoint; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; - /// Initializes a new instance of TransparentDataEncryptionActivitiesRestOperations. + /// Initializes a new instance of MaintenanceWindowOptionsRestOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. /// is null. - public TransparentDataEncryptionActivitiesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + public MaintenanceWindowOptionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { if (subscriptionId == null) { @@ -43,7 +43,7 @@ public TransparentDataEncryptionActivitiesRestOperations(ClientDiagnostics clien _pipeline = pipeline; } - internal HttpMessage CreateListByConfigurationRequest(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -58,23 +58,22 @@ internal HttpMessage CreateListByConfigurationRequest(string resourceGroupName, uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/transparentDataEncryption/", false); - uri.AppendPath(transparentDataEncryptionName.ToString(), true); - uri.AppendPath("/operationResults", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/maintenanceWindowOptions/current", false); + uri.AppendQuery("maintenanceWindowOptionsName", maintenanceWindowOptionsName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Returns a database's transparent data encryption operation result. + /// Gets a list of available maintenance windows. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which the transparent data encryption applies. - /// The name of the transparent data encryption configuration. + /// The name of the database to get maintenance windows options for. + /// Maintenance window options name. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByConfigurationAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -88,16 +87,20 @@ public async Task> ListByC { throw new ArgumentNullException(nameof(databaseName)); } + if (maintenanceWindowOptionsName == null) + { + throw new ArgumentNullException(nameof(maintenanceWindowOptionsName)); + } - using var message = CreateListByConfigurationRequest(resourceGroupName, serverName, databaseName, transparentDataEncryptionName); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - TransparentDataEncryptionActivityListResult value = default; + MaintenanceWindowOptions value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TransparentDataEncryptionActivityListResult.DeserializeTransparentDataEncryptionActivityListResult(document.RootElement); + value = MaintenanceWindowOptions.DeserializeMaintenanceWindowOptions(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -105,14 +108,14 @@ public async Task> ListByC } } - /// Returns a database's transparent data encryption operation result. + /// Gets a list of available maintenance windows. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which the transparent data encryption applies. - /// The name of the transparent data encryption configuration. + /// The name of the database to get maintenance windows options for. + /// Maintenance window options name. /// The cancellation token to use. - /// , , or is null. - public Response ListByConfiguration(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -126,16 +129,20 @@ public Response ListByConfiguration { throw new ArgumentNullException(nameof(databaseName)); } + if (maintenanceWindowOptionsName == null) + { + throw new ArgumentNullException(nameof(maintenanceWindowOptionsName)); + } - using var message = CreateListByConfigurationRequest(resourceGroupName, serverName, databaseName, transparentDataEncryptionName); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - TransparentDataEncryptionActivityListResult value = default; + MaintenanceWindowOptions value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TransparentDataEncryptionActivityListResult.DeserializeTransparentDataEncryptionActivityListResult(document.RootElement); + value = MaintenanceWindowOptions.DeserializeMaintenanceWindowOptions(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsOperations.cs new file mode 100644 index 0000000000000..9476e3afee816 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsOperations.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The MaintenanceWindows service client. + public partial class MaintenanceWindowsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal MaintenanceWindowsRestOperations RestClient { get; } + + /// Initializes a new instance of MaintenanceWindowsOperations for mocking. + protected MaintenanceWindowsOperations() + { + } + + /// Initializes a new instance of MaintenanceWindowsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal MaintenanceWindowsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new MaintenanceWindowsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets maintenance windows settings for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database to get maintenance windows for. + /// Maintenance window name. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MaintenanceWindowsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets maintenance windows settings for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database to get maintenance windows for. + /// Maintenance window name. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MaintenanceWindowsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, databaseName, maintenanceWindowName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Sets maintenance windows settings for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database to set maintenance windows for. + /// Maintenance window name. + /// The MaintenanceWindows to use. + /// The cancellation token to use. + public virtual async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MaintenanceWindowsOperations.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Sets maintenance windows settings for a database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database to set maintenance windows for. + /// Maintenance window name. + /// The MaintenanceWindows to use. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("MaintenanceWindowsOperations.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsRestOperations.cs similarity index 64% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesRestOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsRestOperations.cs index 42669a2170266..229ecb54f129e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabaseThreatDetectionPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/MaintenanceWindowsRestOperations.cs @@ -16,20 +16,20 @@ namespace Azure.ResourceManager.Sql { - internal partial class DatabaseThreatDetectionPoliciesRestOperations + internal partial class MaintenanceWindowsRestOperations { private string subscriptionId; private Uri endpoint; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; - /// Initializes a new instance of DatabaseThreatDetectionPoliciesRestOperations. + /// Initializes a new instance of MaintenanceWindowsRestOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. /// is null. - public DatabaseThreatDetectionPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + public MaintenanceWindowsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { if (subscriptionId == null) { @@ -43,7 +43,7 @@ public DatabaseThreatDetectionPoliciesRestOperations(ClientDiagnostics clientDia _pipeline = pipeline; } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -58,22 +58,22 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/securityAlertPolicies/", false); - uri.AppendPath(securityAlertPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/maintenanceWindows/current", false); + uri.AppendQuery("maintenanceWindowName", maintenanceWindowName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a database's threat detection policy. + /// Gets maintenance windows settings for a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which database Threat Detection policy is defined. - /// The name of the security alert policy. + /// The name of the database to get maintenance windows for. + /// Maintenance window name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -87,16 +87,20 @@ public async Task> GetAsync(string resourc { throw new ArgumentNullException(nameof(databaseName)); } + if (maintenanceWindowName == null) + { + throw new ArgumentNullException(nameof(maintenanceWindowName)); + } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, maintenanceWindowName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - DatabaseSecurityAlertPolicy value = default; + MaintenanceWindows value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement); + value = MaintenanceWindows.DeserializeMaintenanceWindows(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -104,14 +108,14 @@ public async Task> GetAsync(string resourc } } - /// Gets a database's threat detection policy. + /// Gets maintenance windows settings for a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which database Threat Detection policy is defined. - /// The name of the security alert policy. + /// The name of the database to get maintenance windows for. + /// Maintenance window name. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -125,16 +129,20 @@ public Response Get(string resourceGroupName, strin { throw new ArgumentNullException(nameof(databaseName)); } + if (maintenanceWindowName == null) + { + throw new ArgumentNullException(nameof(maintenanceWindowName)); + } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, maintenanceWindowName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - DatabaseSecurityAlertPolicy value = default; + MaintenanceWindows value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement); + value = MaintenanceWindows.DeserializeMaintenanceWindows(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -142,7 +150,7 @@ public Response Get(string resourceGroupName, strin } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters) + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -157,11 +165,10 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/securityAlertPolicies/", false); - uri.AppendPath(securityAlertPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/maintenanceWindows/current", false); + uri.AppendQuery("maintenanceWindowName", maintenanceWindowName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(parameters); @@ -169,15 +176,15 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin return message; } - /// Creates or updates a database's threat detection policy. + /// Sets maintenance windows settings for a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which database Threat Detection policy is defined. - /// The name of the security alert policy. - /// The database Threat Detection policy. + /// The name of the database to set maintenance windows for. + /// Maintenance window name. + /// The MaintenanceWindows to use. /// The cancellation token to use. - /// , , , or is null. - public async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -191,37 +198,35 @@ public async Task> CreateOrUpdateAsync(str { throw new ArgumentNullException(nameof(databaseName)); } + if (maintenanceWindowName == null) + { + throw new ArgumentNullException(nameof(maintenanceWindowName)); + } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters); + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - { - DatabaseSecurityAlertPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Creates or updates a database's threat detection policy. + /// Sets maintenance windows settings for a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which database Threat Detection policy is defined. - /// The name of the security alert policy. - /// The database Threat Detection policy. + /// The name of the database to set maintenance windows for. + /// Maintenance window name. + /// The MaintenanceWindows to use. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, SecurityAlertPolicyName securityAlertPolicyName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -235,23 +240,21 @@ public Response CreateOrUpdate(string resourceGroup { throw new ArgumentNullException(nameof(databaseName)); } + if (maintenanceWindowName == null) + { + throw new ArgumentNullException(nameof(maintenanceWindowName)); + } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters); + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - { - DatabaseSecurityAlertPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesRestOperations.cs index 811fe7fa9a54e..b80b711c02dc1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(databaseName, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -264,7 +264,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string manage uri.AppendPath(databaseName, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -368,7 +368,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/backupShortTermRetentionPolicies", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs new file mode 100644 index 0000000000000..2d1a7979d9643 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedDatabaseColumns service client. + public partial class ManagedDatabaseColumnsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedDatabaseColumnsRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedDatabaseColumnsOperations for mocking. + protected ManagedDatabaseColumnsOperations() + { + } + + /// Initializes a new instance of ManagedDatabaseColumnsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedDatabaseColumnsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedDatabaseColumnsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get managed database column. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The name of the column. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get managed database column. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The name of the column. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List managed database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List managed database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List managed database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public virtual AsyncPageable ListByTableAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.ListByTable"); + scope.Start(); + try + { + var response = await RestClient.ListByTableAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.ListByTable"); + scope.Start(); + try + { + var response = await RestClient.ListByTableNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List managed database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public virtual Pageable ListByTable(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.ListByTable"); + scope.Start(); + try + { + var response = RestClient.ListByTable(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseColumnsOperations.ListByTable"); + scope.Start(); + try + { + var response = RestClient.ListByTableNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnsRestOperations.cs new file mode 100644 index 0000000000000..e7217679696c3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnsRestOperations.cs @@ -0,0 +1,656 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedDatabaseColumnsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedDatabaseColumnsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedDatabaseColumnsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, IEnumerable schema, IEnumerable table, IEnumerable column, IEnumerable orderBy, string skiptoken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/columns", false); + if (schema != null) + { + uri.AppendQueryDelimited("schema", schema, ",", true); + } + if (table != null) + { + uri.AppendQueryDelimited("table", table, ",", true); + } + if (column != null) + { + uri.AppendQueryDelimited("column", column, ",", true); + } + if (orderBy != null) + { + uri.AppendQueryDelimited("orderBy", orderBy, ",", true); + } + if (skiptoken != null) + { + uri.AppendQuery("$skiptoken", skiptoken, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List managed database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List managed database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTableRequest(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/columns", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List managed database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> ListByTableAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateListByTableRequest(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List managed database columns. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public Response ListByTable(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateListByTableRequest(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendPath("/columns/", false); + uri.AppendPath(columnName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get managed database column. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The name of the column. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (columnName == null) + { + throw new ArgumentNullException(nameof(columnName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumn value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumn.DeserializeDatabaseColumn(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get managed database column. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The name of the column. + /// The cancellation token to use. + /// , , , , , or is null. + public Response Get(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + if (columnName == null) + { + throw new ArgumentNullException(nameof(columnName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumn value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumn.DeserializeDatabaseColumn(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, IEnumerable schema, IEnumerable table, IEnumerable column, IEnumerable orderBy, string skiptoken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List managed database columns. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List managed database columns. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The ArrayOfGet3ItemsItem to use. + /// The ArrayOfGet4ItemsItem to use. + /// The ArrayOfGet5ItemsItem to use. + /// The ArrayOfGet6ItemsItem to use. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, IEnumerable schema = null, IEnumerable table = null, IEnumerable column = null, IEnumerable orderBy = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTableNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List managed database columns. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , , or is null. + public async Task> ListByTableNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateListByTableNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List managed database columns. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , , or is null. + public Response ListByTableNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateListByTableNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseColumnListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseColumnListResult.DeserializeDatabaseColumnListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs new file mode 100644 index 0000000000000..19621f7f11e3e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedDatabaseQueries service client. + public partial class ManagedDatabaseQueriesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedDatabaseQueriesRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedDatabaseQueriesOperations for mocking. + protected ManagedDatabaseQueriesOperations() + { + } + + /// Initializes a new instance of ManagedDatabaseQueriesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedDatabaseQueriesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedDatabaseQueriesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get query by query id. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseQueriesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, databaseName, queryId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get query by query id. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseQueriesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, databaseName, queryId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get query execution statistics by query id. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListByQueryAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (queryId == null) + { + throw new ArgumentNullException(nameof(queryId)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseQueriesOperations.ListByQuery"); + scope.Start(); + try + { + var response = await RestClient.ListByQueryAsync(resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseQueriesOperations.ListByQuery"); + scope.Start(); + try + { + var response = await RestClient.ListByQueryNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Get query execution statistics by query id. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListByQuery(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (queryId == null) + { + throw new ArgumentNullException(nameof(queryId)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseQueriesOperations.ListByQuery"); + scope.Start(); + try + { + var response = RestClient.ListByQuery(resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseQueriesOperations.ListByQuery"); + scope.Start(); + try + { + var response = RestClient.ListByQueryNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseQueriesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseQueriesRestOperations.cs new file mode 100644 index 0000000000000..e06fef29fdb35 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseQueriesRestOperations.cs @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedDatabaseQueriesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedDatabaseQueriesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedDatabaseQueriesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string databaseName, string queryId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/queries/", false); + uri.AppendPath(queryId, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get query by query id. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (queryId == null) + { + throw new ArgumentNullException(nameof(queryId)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, queryId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceQuery value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceQuery.DeserializeManagedInstanceQuery(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get query by query id. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (queryId == null) + { + throw new ArgumentNullException(nameof(queryId)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, queryId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceQuery value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceQuery.DeserializeManagedInstanceQuery(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByQueryRequest(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime, string endTime, QueryTimeGrainType? interval) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/queries/", false); + uri.AppendPath(queryId, true); + uri.AppendPath("/statistics", false); + if (startTime != null) + { + uri.AppendQuery("startTime", startTime, true); + } + if (endTime != null) + { + uri.AppendQuery("endTime", endTime, true); + } + if (interval != null) + { + uri.AppendQuery("interval", interval.Value.ToString(), true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get query execution statistics by query id. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByQueryAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (queryId == null) + { + throw new ArgumentNullException(nameof(queryId)); + } + + using var message = CreateListByQueryRequest(resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceQueryStatistics value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceQueryStatistics.DeserializeManagedInstanceQueryStatistics(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get query execution statistics by query id. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByQuery(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (queryId == null) + { + throw new ArgumentNullException(nameof(queryId)); + } + + using var message = CreateListByQueryRequest(resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceQueryStatistics value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceQueryStatistics.DeserializeManagedInstanceQueryStatistics(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByQueryNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime, string endTime, QueryTimeGrainType? interval) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get query execution statistics by query id. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> ListByQueryNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (queryId == null) + { + throw new ArgumentNullException(nameof(queryId)); + } + + using var message = CreateListByQueryNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceQueryStatistics value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceQueryStatistics.DeserializeManagedInstanceQueryStatistics(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get query execution statistics by query id. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The String to use. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. + /// The cancellation token to use. + /// , , , , or is null. + public Response ListByQueryNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (queryId == null) + { + throw new ArgumentNullException(nameof(queryId)); + } + + using var message = CreateListByQueryNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceQueryStatistics value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceQueryStatistics.DeserializeManagedInstanceQueryStatistics(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs new file mode 100644 index 0000000000000..12dcde75bd1b7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedDatabaseRecommendedSensitivityLabels service client. + public partial class ManagedDatabaseRecommendedSensitivityLabelsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedDatabaseRecommendedSensitivityLabelsRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedDatabaseRecommendedSensitivityLabelsOperations for mocking. + protected ManagedDatabaseRecommendedSensitivityLabelsOperations() + { + } + + /// Initializes a new instance of ManagedDatabaseRecommendedSensitivityLabelsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedDatabaseRecommendedSensitivityLabelsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedDatabaseRecommendedSensitivityLabelsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + public virtual async Task UpdateAsync(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseRecommendedSensitivityLabelsOperations.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseRecommendedSensitivityLabelsOperations.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, managedInstanceName, databaseName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsRestOperations.cs new file mode 100644 index 0000000000000..cbc0436bd3665 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsRestOperations.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedDatabaseRecommendedSensitivityLabelsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedDatabaseRecommendedSensitivityLabelsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedDatabaseRecommendedSensitivityLabelsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/recommendedSensitivityLabels", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateAsync(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, managedInstanceName, databaseName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + public Response Update(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, managedInstanceName, databaseName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs index faabd4ee9d47d..77a012d8d7fca 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs @@ -39,7 +39,7 @@ internal ManagedDatabaseRestoreDetailsOperations(ClientDiagnostics clientDiagnos } /// Gets managed database restore details. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The name of the restore details to retrieve. @@ -60,7 +60,7 @@ public virtual async Task> GetAsyn } /// Gets managed database restore details. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The name of the restore details to retrieve. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailsRestOperations.cs index 59f373b57d8a5..ec12aa036c783 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseRestoreDetailsRestOperations.cs @@ -60,14 +60,14 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(databaseName, true); uri.AppendPath("/restoreDetails/", false); uri.AppendPath(restoreDetailsName.ToString(), true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Gets managed database restore details. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The name of the restore details to retrieve. @@ -105,7 +105,7 @@ public async Task> GetAsync(string } /// Gets managed database restore details. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The name of the restore details to retrieve. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs new file mode 100644 index 0000000000000..b3ffe8071b861 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedDatabaseSchemas service client. + public partial class ManagedDatabaseSchemasOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedDatabaseSchemasRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedDatabaseSchemasOperations for mocking. + protected ManagedDatabaseSchemasOperations() + { + } + + /// Initializes a new instance of ManagedDatabaseSchemasOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedDatabaseSchemasOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedDatabaseSchemasRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get managed database schema. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSchemasOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get managed database schema. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSchemasOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, databaseName, schemaName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List managed database schemas. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSchemasOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSchemasOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List managed database schemas. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSchemasOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, managedInstanceName, databaseName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSchemasOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemasRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemasRestOperations.cs new file mode 100644 index 0000000000000..d156300a685e8 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemasRestOperations.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedDatabaseSchemasRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedDatabaseSchemasRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedDatabaseSchemasRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List managed database schemas. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List managed database schemas. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get managed database schema. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, schemaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchema value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSchema.DeserializeDatabaseSchema(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get managed database schema. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, schemaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchema value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSchema.DeserializeDatabaseSchema(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List managed database schemas. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchemaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List managed database schemas. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseSchemaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseSchemaListResult.DeserializeDatabaseSchemaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesRestOperations.cs index 5a2bb433e10b6..c48e571ddcf3f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(databaseName, true); uri.AppendPath("/securityAlertPolicies/", false); uri.AppendPath(securityAlertPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/securityAlertPolicies/", false); uri.AppendPath(securityAlertPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -273,7 +273,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/securityAlertPolicies", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs new file mode 100644 index 0000000000000..50bb9d64e432c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedDatabaseSecurityEvents service client. + public partial class ManagedDatabaseSecurityEventsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedDatabaseSecurityEventsRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedDatabaseSecurityEventsOperations for mocking. + protected ManagedDatabaseSecurityEventsOperations() + { + } + + /// Initializes a new instance of ManagedDatabaseSecurityEventsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedDatabaseSecurityEventsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedDatabaseSecurityEventsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a list of security events. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security events are retrieved. + /// An OData filter expression that filters elements in the collection. + /// The number of elements in the collection to skip. + /// The number of elements to return from the collection. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, int? skip = null, int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSecurityEventsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSecurityEventsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of security events. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security events are retrieved. + /// An OData filter expression that filters elements in the collection. + /// The number of elements in the collection to skip. + /// The number of elements to return from the collection. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, int? skip = null, int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSecurityEventsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSecurityEventsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityEventsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityEventsRestOperations.cs new file mode 100644 index 0000000000000..c0eb8f8326b53 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSecurityEventsRestOperations.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedDatabaseSecurityEventsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedDatabaseSecurityEventsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedDatabaseSecurityEventsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, string filter, int? skip, int? top, string skiptoken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/securityEvents", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (skip != null) + { + uri.AppendQuery("$skip", skip.Value, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + if (skiptoken != null) + { + uri.AppendQuery("$skiptoken", skiptoken, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of security events. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security events are retrieved. + /// An OData filter expression that filters elements in the collection. + /// The number of elements in the collection to skip. + /// The number of elements to return from the collection. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, int? skip = null, int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SecurityEventCollection value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SecurityEventCollection.DeserializeSecurityEventCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of security events. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security events are retrieved. + /// An OData filter expression that filters elements in the collection. + /// The number of elements in the collection to skip. + /// The number of elements to return from the collection. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, int? skip = null, int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SecurityEventCollection value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SecurityEventCollection.DeserializeSecurityEventCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter, int? skip, int? top, string skiptoken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of security events. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security events are retrieved. + /// An OData filter expression that filters elements in the collection. + /// The number of elements in the collection to skip. + /// The number of elements to return from the collection. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, int? skip = null, int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SecurityEventCollection value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SecurityEventCollection.DeserializeSecurityEventCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of security events. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security events are retrieved. + /// An OData filter expression that filters elements in the collection. + /// The number of elements in the collection to skip. + /// The number of elements to return from the collection. + /// An opaque token that identifies a starting point in the collection. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, int? skip = null, int? top = null, string skiptoken = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SecurityEventCollection value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SecurityEventCollection.DeserializeSecurityEventCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs index 091935c6c3ac9..be6b42b3079e5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs @@ -273,14 +273,58 @@ public virtual Response EnableRecommendation(string resourceGroupName, string ma } } + /// Update sensitivity labels of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + public virtual async Task UpdateAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSensitivityLabelsOperations.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update sensitivity labels of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseSensitivityLabelsOperations.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, managedInstanceName, databaseName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Gets the sensitivity labels of a given database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual AsyncPageable ListCurrentByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListCurrentByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -301,7 +345,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -316,7 +360,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi scope.Start(); try { - var response = await RestClient.ListCurrentByDatabaseNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, filter, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListCurrentByDatabaseNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -332,10 +376,12 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual Pageable ListCurrentByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public virtual Pageable ListCurrentByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -356,7 +402,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListCurrentByDatabase(resourceGroupName, managedInstanceName, databaseName, filter, cancellationToken); + var response = RestClient.ListCurrentByDatabase(resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -371,7 +417,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListCurrentByDatabaseNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, filter, cancellationToken); + var response = RestClient.ListCurrentByDatabaseNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -387,12 +433,12 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual AsyncPageable ListRecommendedByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListRecommendedByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -413,7 +459,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -428,7 +474,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi scope.Start(); try { - var response = await RestClient.ListRecommendedByDatabaseNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListRecommendedByDatabaseNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -444,12 +490,12 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual Pageable ListRecommendedByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public virtual Pageable ListRecommendedByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -470,7 +516,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListRecommendedByDatabase(resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter, cancellationToken); + var response = RestClient.ListRecommendedByDatabase(resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -485,7 +531,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListRecommendedByDatabaseNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter, cancellationToken); + var response = RestClient.ListRecommendedByDatabaseNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelsRestOperations.cs index 202ac20ae0836..bd3b9a4d24482 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSensitivityLabelsRestOperations.cs @@ -66,7 +66,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath(sensitivityLabelSource.ToSerialString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -201,7 +201,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath("current", true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -350,7 +350,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath("current", true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -473,7 +473,7 @@ internal HttpMessage CreateDisableRecommendationRequest(string resourceGroupName uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath("recommended", true); uri.AppendPath("/disable", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -596,7 +596,7 @@ internal HttpMessage CreateEnableRecommendationRequest(string resourceGroupName, uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath("recommended", true); uri.AppendPath("/enable", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -695,7 +695,7 @@ public Response EnableRecommendation(string resourceGroupName, string managedIns } } - internal HttpMessage CreateListCurrentByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, string filter) + internal HttpMessage CreateListCurrentByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -711,11 +711,19 @@ internal HttpMessage CreateListCurrentByDatabaseRequest(string resourceGroupName uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/currentSensitivityLabels", false); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (count != null) + { + uri.AppendQuery("$count", count.Value, true); + } if (filter != null) { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -725,10 +733,12 @@ internal HttpMessage CreateListCurrentByDatabaseRequest(string resourceGroupName /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public async Task> ListCurrentByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListCurrentByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -743,7 +753,7 @@ public async Task> ListCurrentByDatabaseAsy throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListCurrentByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, filter); + using var message = CreateListCurrentByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -763,10 +773,12 @@ public async Task> ListCurrentByDatabaseAsy /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public Response ListCurrentByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public Response ListCurrentByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -781,7 +793,7 @@ public Response ListCurrentByDatabase(string resourc throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListCurrentByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, filter); + using var message = CreateListCurrentByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -797,11 +809,11 @@ public Response ListCurrentByDatabase(string resourc } } - internal HttpMessage CreateListRecommendedByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, bool? includeDisabledRecommendations, string skipToken, string filter) + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -812,20 +824,119 @@ internal HttpMessage CreateListRecommendedByDatabaseRequest(string resourceGroup uri.AppendPath(managedInstanceName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/recommendedSensitivityLabels", false); - if (includeDisabledRecommendations != null) + uri.AppendPath("/currentSensitivityLabels", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Update sensitivity labels of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) { - uri.AppendQuery("includeDisabledRecommendations", includeDisabledRecommendations.Value, true); + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, managedInstanceName, databaseName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update sensitivity labels of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + public Response Update(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, managedInstanceName, databaseName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); } + } + + internal HttpMessage CreateListRecommendedByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/recommendedSensitivityLabels", false); if (skipToken != null) { uri.AppendQuery("$skipToken", skipToken, true); } + if (includeDisabledRecommendations != null) + { + uri.AppendQuery("includeDisabledRecommendations", includeDisabledRecommendations.Value, true); + } if (filter != null) { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -835,12 +946,12 @@ internal HttpMessage CreateListRecommendedByDatabaseRequest(string resourceGroup /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public async Task> ListRecommendedByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListRecommendedByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -855,7 +966,7 @@ public async Task> ListRecommendedByDatabas throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListRecommendedByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter); + using var message = CreateListRecommendedByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -875,12 +986,12 @@ public async Task> ListRecommendedByDatabas /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public Response ListRecommendedByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListRecommendedByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -895,7 +1006,7 @@ public Response ListRecommendedByDatabase(string res throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListRecommendedByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter); + using var message = CreateListRecommendedByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -911,7 +1022,7 @@ public Response ListRecommendedByDatabase(string res } } - internal HttpMessage CreateListCurrentByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter) + internal HttpMessage CreateListCurrentByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? count, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -929,10 +1040,12 @@ internal HttpMessage CreateListCurrentByDatabaseNextPageRequest(string nextLink, /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. - public async Task> ListCurrentByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListCurrentByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -951,7 +1064,7 @@ public async Task> ListCurrentByDatabaseNex throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListCurrentByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, filter); + using var message = CreateListCurrentByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -972,10 +1085,12 @@ public async Task> ListCurrentByDatabaseNex /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. - public Response ListCurrentByDatabaseNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public Response ListCurrentByDatabaseNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -994,7 +1109,7 @@ public Response ListCurrentByDatabaseNextPage(string throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListCurrentByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, filter); + using var message = CreateListCurrentByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1010,7 +1125,7 @@ public Response ListCurrentByDatabaseNextPage(string } } - internal HttpMessage CreateListRecommendedByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, bool? includeDisabledRecommendations, string skipToken, string filter) + internal HttpMessage CreateListRecommendedByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1028,12 +1143,12 @@ internal HttpMessage CreateListRecommendedByDatabaseNextPageRequest(string nextL /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. - public async Task> ListRecommendedByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListRecommendedByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -1052,7 +1167,7 @@ public async Task> ListRecommendedByDatabas throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListRecommendedByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter); + using var message = CreateListRecommendedByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1073,12 +1188,12 @@ public async Task> ListRecommendedByDatabas /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. - public Response ListRecommendedByDatabaseNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListRecommendedByDatabaseNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -1097,7 +1212,7 @@ public Response ListRecommendedByDatabaseNextPage(st throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListRecommendedByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, includeDisabledRecommendations, skipToken, filter); + using var message = CreateListRecommendedByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, skipToken, includeDisabledRecommendations, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTablesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTablesOperations.cs new file mode 100644 index 0000000000000..bb0a08b2392fe --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTablesOperations.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedDatabaseTables service client. + public partial class ManagedDatabaseTablesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedDatabaseTablesRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedDatabaseTablesOperations for mocking. + protected ManagedDatabaseTablesOperations() + { + } + + /// Initializes a new instance of ManagedDatabaseTablesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedDatabaseTablesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedDatabaseTablesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Get managed database table. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTablesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get managed database table. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTablesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List managed database tables. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public virtual AsyncPageable ListBySchemaAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTablesOperations.ListBySchema"); + scope.Start(); + try + { + var response = await RestClient.ListBySchemaAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTablesOperations.ListBySchema"); + scope.Start(); + try + { + var response = await RestClient.ListBySchemaNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, schemaName, filter, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List managed database tables. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public virtual Pageable ListBySchema(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTablesOperations.ListBySchema"); + scope.Start(); + try + { + var response = RestClient.ListBySchema(resourceGroupName, managedInstanceName, databaseName, schemaName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTablesOperations.ListBySchema"); + scope.Start(); + try + { + var response = RestClient.ListBySchemaNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, schemaName, filter, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTablesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTablesRestOperations.cs new file mode 100644 index 0000000000000..61fe1fa91f9fd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTablesRestOperations.cs @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedDatabaseTablesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedDatabaseTablesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedDatabaseTablesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListBySchemaRequest(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/tables", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List managed database tables. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListBySchemaAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateListBySchemaRequest(resourceGroupName, managedInstanceName, databaseName, schemaName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseTableListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List managed database tables. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , or is null. + public Response ListBySchema(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateListBySchemaRequest(resourceGroupName, managedInstanceName, databaseName, schemaName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseTableListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/schemas/", false); + uri.AppendPath(schemaName, true); + uri.AppendPath("/tables/", false); + uri.AppendPath(tableName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Get managed database table. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseTable value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseTable.DeserializeDatabaseTable(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get managed database table. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// The name of the table. + /// The cancellation token to use. + /// , , , , or is null. + public Response Get(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + if (tableName == null) + { + throw new ArgumentNullException(nameof(tableName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseTable value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseTable.DeserializeDatabaseTable(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySchemaNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// List managed database tables. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public async Task> ListBySchemaNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateListBySchemaNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, schemaName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseTableListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List managed database tables. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the database. + /// The name of the schema. + /// An OData filter expression that filters elements in the collection. + /// The cancellation token to use. + /// , , , , or is null. + public Response ListBySchemaNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string filter = null, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (schemaName == null) + { + throw new ArgumentNullException(nameof(schemaName)); + } + + using var message = CreateListBySchemaNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName, schemaName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseTableListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseTableListResult.DeserializeDatabaseTableListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs new file mode 100644 index 0000000000000..0616a48526238 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedDatabaseTransparentDataEncryption service client. + public partial class ManagedDatabaseTransparentDataEncryptionOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedDatabaseTransparentDataEncryptionRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedDatabaseTransparentDataEncryptionOperations for mocking. + protected ManagedDatabaseTransparentDataEncryptionOperations() + { + } + + /// Initializes a new instance of ManagedDatabaseTransparentDataEncryptionOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedDatabaseTransparentDataEncryptionOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedDatabaseTransparentDataEncryptionRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a managed database's transparent data encryption. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTransparentDataEncryptionOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, databaseName, tdeName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a managed database's transparent data encryption. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTransparentDataEncryptionOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, databaseName, tdeName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a database's transparent data encryption configuration. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security alert policy is defined. + /// The name of the transparent data encryption configuration. + /// The database transparent data encryption. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, ManagedTransparentDataEncryption parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTransparentDataEncryptionOperations.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, tdeName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a database's transparent data encryption configuration. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security alert policy is defined. + /// The name of the transparent data encryption configuration. + /// The database transparent data encryption. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, ManagedTransparentDataEncryption parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTransparentDataEncryptionOperations.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, tdeName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of managed database's transparent data encryptions. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTransparentDataEncryptionOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTransparentDataEncryptionOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, managedInstanceName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of managed database's transparent data encryptions. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTransparentDataEncryptionOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, managedInstanceName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseTransparentDataEncryptionOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, managedInstanceName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionRestOperations.cs new file mode 100644 index 0000000000000..88092adc39a13 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionRestOperations.cs @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedDatabaseTransparentDataEncryptionRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedDatabaseTransparentDataEncryptionRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedDatabaseTransparentDataEncryptionRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/transparentDataEncryption/", false); + uri.AppendPath(tdeName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a managed database's transparent data encryption. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, tdeName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedTransparentDataEncryption value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedTransparentDataEncryption.DeserializeManagedTransparentDataEncryption(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a managed database's transparent data encryption. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, tdeName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedTransparentDataEncryption value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedTransparentDataEncryption.DeserializeManagedTransparentDataEncryption(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, ManagedTransparentDataEncryption parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/transparentDataEncryption/", false); + uri.AppendPath(tdeName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Updates a database's transparent data encryption configuration. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security alert policy is defined. + /// The name of the transparent data encryption configuration. + /// The database transparent data encryption. + /// The cancellation token to use. + /// , , , or is null. + public async Task> CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, ManagedTransparentDataEncryption parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, databaseName, tdeName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagedTransparentDataEncryption value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedTransparentDataEncryption.DeserializeManagedTransparentDataEncryption(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Updates a database's transparent data encryption configuration. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the security alert policy is defined. + /// The name of the transparent data encryption configuration. + /// The database transparent data encryption. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, string databaseName, TransparentDataEncryptionName tdeName, ManagedTransparentDataEncryption parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, databaseName, tdeName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ManagedTransparentDataEncryption value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedTransparentDataEncryption.DeserializeManagedTransparentDataEncryption(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/transparentDataEncryption", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of managed database's transparent data encryptions. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedTransparentDataEncryptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedTransparentDataEncryptionListResult.DeserializeManagedTransparentDataEncryptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of managed database's transparent data encryptions. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedTransparentDataEncryptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedTransparentDataEncryptionListResult.DeserializeManagedTransparentDataEncryptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of managed database's transparent data encryptions. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedTransparentDataEncryptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedTransparentDataEncryptionListResult.DeserializeManagedTransparentDataEncryptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of managed database's transparent data encryptions. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the managed database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, managedInstanceName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedTransparentDataEncryptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedTransparentDataEncryptionListResult.DeserializeManagedTransparentDataEncryptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs index 48e67cd7ae2d4..4e2bbd23f997b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesRestOperations.cs @@ -64,7 +64,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(ruleId, true); uri.AppendPath("/baselines/", false); uri.AppendPath(baselineName.ToSerialString(), true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -179,7 +179,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(ruleId, true); uri.AppendPath("/baselines/", false); uri.AppendPath(baselineName.ToSerialString(), true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -308,7 +308,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage uri.AppendPath(ruleId, true); uri.AppendPath("/baselines/", false); uri.AppendPath(baselineName.ToSerialString(), true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs index 546109c172f9b..c703dc63c5e49 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs @@ -39,20 +39,20 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(ClientDiagnostics _pipeline = pipeline; } - /// Gets a vulnerability assessment scan record of a database. + /// Convert an existing scan result to a human readable format. If already exists nothing happens. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the database. + /// The name of the scanned database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public virtual async Task> ExportAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScansOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScansOperations.Export"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, cancellationToken).ConfigureAwait(false); + return await RestClient.ExportAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -61,20 +61,20 @@ public virtual async Task> GetAsync( } } - /// Gets a vulnerability assessment scan record of a database. + /// Convert an existing scan result to a human readable format. If already exists nothing happens. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the database. + /// The name of the scanned database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public virtual Response Export(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScansOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScansOperations.Export"); scope.Start(); try { - return RestClient.Get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, cancellationToken); + return RestClient.Export(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, cancellationToken); } catch (Exception e) { @@ -83,20 +83,20 @@ public virtual Response Get(string resourceGr } } - /// Convert an existing scan result to a human readable format. If already exists nothing happens. + /// Gets a vulnerability assessment scan record of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the scanned database. + /// The name of the database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - public virtual async Task> ExportAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScansOperations.Export"); + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScansOperations.Get"); scope.Start(); try { - return await RestClient.ExportAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -105,20 +105,20 @@ public virtual async Task> } } - /// Convert an existing scan result to a human readable format. If already exists nothing happens. + /// Gets a vulnerability assessment scan record of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the scanned database. + /// The name of the database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - public virtual Response Export(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScansOperations.Export"); + using var scope = _clientDiagnostics.CreateScope("ManagedDatabaseVulnerabilityAssessmentScansOperations.Get"); scope.Start(); try { - return RestClient.Export(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, cancellationToken); + return RestClient.Get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, cancellationToken); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansRestOperations.cs index 6b27119708ef8..0b28a7c65d02d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansRestOperations.cs @@ -43,11 +43,11 @@ public ManagedDatabaseVulnerabilityAssessmentScansRestOperations(ClientDiagnosti _pipeline = pipeline; } - internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName) + internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -60,21 +60,23 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendPath("/scans", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/scans/", false); + uri.AppendPath(scanId, true); + uri.AppendPath("/initiateScan", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); return message; } - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The name of the vulnerability assessment. + /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task InitiateScanAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -88,31 +90,32 @@ public async Task> ListByD { throw new ArgumentNullException(nameof(databaseName)); } + if (scanId == null) + { + throw new ArgumentNullException(nameof(scanId)); + } - using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + using var message = CreateInitiateScanRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - VulnerabilityAssessmentScanRecordListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The name of the vulnerability assessment. + /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// , , or is null. - public Response ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response InitiateScan(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -126,28 +129,28 @@ public Response ListByDatabase(stri { throw new ArgumentNullException(nameof(databaseName)); } + if (scanId == null) + { + throw new ArgumentNullException(nameof(scanId)); + } - using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + using var message = CreateInitiateScanRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - VulnerabilityAssessmentScanRecordListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) + internal HttpMessage CreateExportRequest(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -162,21 +165,22 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); uri.AppendPath("/scans/", false); uri.AppendPath(scanId, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/export", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a vulnerability assessment scan record of a database. + /// Convert an existing scan result to a human readable format. If already exists nothing happens. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the database. + /// The name of the scanned database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// The cancellation token to use. /// , , , or is null. - public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public async Task> ExportAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -195,15 +199,16 @@ public async Task> GetAsync(string r throw new ArgumentNullException(nameof(scanId)); } - using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateExportRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { - VulnerabilityAssessmentScanRecord value = default; + DatabaseVulnerabilityAssessmentScansExport value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement); + value = DatabaseVulnerabilityAssessmentScansExport.DeserializeDatabaseVulnerabilityAssessmentScansExport(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -211,15 +216,15 @@ public async Task> GetAsync(string r } } - /// Gets a vulnerability assessment scan record of a database. + /// Convert an existing scan result to a human readable format. If already exists nothing happens. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the database. + /// The name of the scanned database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// The cancellation token to use. /// , , , or is null. - public Response Get(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public Response Export(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -238,15 +243,16 @@ public Response Get(string resourceGroupName, throw new ArgumentNullException(nameof(scanId)); } - using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateExportRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { - VulnerabilityAssessmentScanRecord value = default; + DatabaseVulnerabilityAssessmentScansExport value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement); + value = DatabaseVulnerabilityAssessmentScansExport.DeserializeDatabaseVulnerabilityAssessmentScansExport(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -254,11 +260,11 @@ public Response Get(string resourceGroupName, } } - internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -271,23 +277,21 @@ internal HttpMessage CreateInitiateScanRequest(string resourceGroupName, string uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanId, true); - uri.AppendPath("/initiateScan", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendPath("/scans", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); return message; } - /// Executes a Vulnerability Assessment database scan. + /// Lists the vulnerability assessment scans of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// , , , or is null. - public async Task InitiateScanAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -301,32 +305,31 @@ public async Task InitiateScanAsync(string resourceGroupName, string m { throw new ArgumentNullException(nameof(databaseName)); } - if (scanId == null) - { - throw new ArgumentNullException(nameof(scanId)); - } - using var message = CreateInitiateScanRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + VulnerabilityAssessmentScanRecordListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Executes a Vulnerability Assessment database scan. + /// Lists the vulnerability assessment scans of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. - /// , , , or is null. - public Response InitiateScan(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -340,28 +343,28 @@ public Response InitiateScan(string resourceGroupName, string managedInstanceNam { throw new ArgumentNullException(nameof(databaseName)); } - if (scanId == null) - { - throw new ArgumentNullException(nameof(scanId)); - } - using var message = CreateInitiateScanRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateListByDatabaseRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + VulnerabilityAssessmentScanRecordListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = VulnerabilityAssessmentScanRecordListResult.DeserializeVulnerabilityAssessmentScanRecordListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateExportRequest(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -376,22 +379,21 @@ internal HttpMessage CreateExportRequest(string resourceGroupName, string manage uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); uri.AppendPath("/scans/", false); uri.AppendPath(scanId, true); - uri.AppendPath("/export", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Convert an existing scan result to a human readable format. If already exists nothing happens. + /// Gets a vulnerability assessment scan record of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the scanned database. + /// The name of the database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. /// , , , or is null. - public async Task> ExportAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -410,16 +412,15 @@ public async Task> ExportAs throw new ArgumentNullException(nameof(scanId)); } - using var message = CreateExportRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - DatabaseVulnerabilityAssessmentScansExport value = default; + VulnerabilityAssessmentScanRecord value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DatabaseVulnerabilityAssessmentScansExport.DeserializeDatabaseVulnerabilityAssessmentScansExport(document.RootElement); + value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -427,15 +428,15 @@ public async Task> ExportAs } } - /// Convert an existing scan result to a human readable format. If already exists nothing happens. + /// Gets a vulnerability assessment scan record of a database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the scanned database. + /// The name of the database. /// The name of the vulnerability assessment. - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// The cancellation token to use. /// , , , or is null. - public Response Export(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string managedInstanceName, string databaseName, VulnerabilityAssessmentName vulnerabilityAssessmentName, string scanId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -454,16 +455,15 @@ public Response Export(string resour throw new ArgumentNullException(nameof(scanId)); } - using var message = CreateExportRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - DatabaseVulnerabilityAssessmentScansExport value = default; + VulnerabilityAssessmentScanRecord value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DatabaseVulnerabilityAssessmentScansExport.DeserializeDatabaseVulnerabilityAssessmentScansExport(document.RootElement); + value = VulnerabilityAssessmentScanRecord.DeserializeVulnerabilityAssessmentScanRecord(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsRestOperations.cs index 07e63adc457c0..f7173f9e6179d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -274,7 +274,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -361,7 +361,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/vulnerabilityAssessments", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabasesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabasesOperations.cs index 067e4379d2368..8b6dc371ca389 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabasesOperations.cs @@ -40,7 +40,7 @@ internal ManagedDatabasesOperations(ClientDiagnostics clientDiagnostics, HttpPip } /// Gets a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The cancellation token to use. @@ -60,7 +60,7 @@ public virtual async Task> GetAsync(string resourceGro } /// Gets a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The cancellation token to use. @@ -80,7 +80,7 @@ public virtual Response Get(string resourceGroupName, string ma } /// Gets a list of managed databases. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// or is null. @@ -129,7 +129,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHin } /// Gets a list of managed databases. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// or is null. @@ -178,7 +178,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Gets a list of inaccessible managed databases in a managed instance. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// or is null. @@ -227,7 +227,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHin } /// Gets a list of inaccessible managed databases in a managed instance. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// or is null. @@ -276,7 +276,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Creates a new database or updates an existing database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The requested database resource state. @@ -316,7 +316,7 @@ public virtual async Task StartCreateOr } /// Creates a new database or updates an existing database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The requested database resource state. @@ -356,7 +356,7 @@ public virtual ManagedDatabasesCreateOrUpdateOperation StartCreateOrUpdate(strin } /// Deletes a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The cancellation token to use. @@ -391,7 +391,7 @@ public virtual async Task StartDeleteAsync(stri } /// Deletes a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The cancellation token to use. @@ -426,7 +426,7 @@ public virtual ManagedDatabasesDeleteOperation StartDelete(string resourceGroupN } /// Updates an existing database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The requested database resource state. @@ -466,7 +466,7 @@ public virtual async Task StartUpdateAsync(stri } /// Updates an existing database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The requested database resource state. @@ -506,7 +506,7 @@ public virtual ManagedDatabasesUpdateOperation StartUpdate(string resourceGroupN } /// Completes the restore operation on a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The definition for completing the restore of this managed database. @@ -546,7 +546,7 @@ public virtual async Task StartComplet } /// Completes the restore operation on a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The definition for completing the restore of this managed database. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabasesRestOperations.cs index f4df3991b4f8d..7c5d3cf36f3fc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabasesRestOperations.cs @@ -57,14 +57,14 @@ internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/databases", false); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Gets a list of managed databases. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// or is null. @@ -96,7 +96,7 @@ public async Task> ListByInstanceAsync(strin } /// Gets a list of managed databases. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// or is null. @@ -142,14 +142,14 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(managedInstanceName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Gets a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The cancellation token to use. @@ -186,7 +186,7 @@ public async Task> GetAsync(string resourceGroupName, } /// Gets a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The cancellation token to use. @@ -237,7 +237,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(managedInstanceName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -248,7 +248,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Creates a new database or updates an existing database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The requested database resource state. @@ -287,7 +287,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Creates a new database or updates an existing database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The requested database resource state. @@ -340,13 +340,13 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage uri.AppendPath(managedInstanceName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } /// Deletes a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The cancellation token to use. @@ -380,7 +380,7 @@ public async Task DeleteAsync(string resourceGroupName, string managed } /// Deletes a managed database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The cancellation token to use. @@ -428,7 +428,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string manage uri.AppendPath(managedInstanceName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -439,7 +439,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string manage } /// Updates an existing database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The requested database resource state. @@ -477,7 +477,7 @@ public async Task UpdateAsync(string resourceGroupName, string managed } /// Updates an existing database. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The name of the database. /// The requested database resource state. @@ -514,11 +514,11 @@ public Response Update(string resourceGroupName, string managedInstanceName, str } } - internal HttpMessage CreateListInaccessibleByInstanceRequest(string resourceGroupName, string managedInstanceName) + internal HttpMessage CreateCompleteRestoreRequest(string resourceGroupName, string managedInstanceName, string databaseName, CompleteDatabaseRestoreDefinition parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -527,19 +527,26 @@ internal HttpMessage CreateListInaccessibleByInstanceRequest(string resourceGrou uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); - uri.AppendPath("/inaccessibleManagedDatabases", false); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/completeRestore", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; return message; } - /// Gets a list of inaccessible managed databases in a managed instance. - /// The name of the resource group. The name is case insensitive. + /// Completes the restore operation on a managed database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The name of the database. + /// The definition for completing the restore of this managed database. /// The cancellation token to use. - /// or is null. - public async Task> ListInaccessibleByInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task CompleteRestoreAsync(string resourceGroupName, string managedInstanceName, string databaseName, CompleteDatabaseRestoreDefinition parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -549,29 +556,35 @@ public async Task> ListInaccessibleByInstanc { throw new ArgumentNullException(nameof(managedInstanceName)); } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateListInaccessibleByInstanceRequest(resourceGroupName, managedInstanceName); + using var message = CreateCompleteRestoreRequest(resourceGroupName, managedInstanceName, databaseName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ManagedDatabaseListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedDatabaseListResult.DeserializeManagedDatabaseListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Gets a list of inaccessible managed databases in a managed instance. - /// The name of the resource group. The name is case insensitive. + /// Completes the restore operation on a managed database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The name of the database. + /// The definition for completing the restore of this managed database. /// The cancellation token to use. - /// or is null. - public Response ListInaccessibleByInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response CompleteRestore(string resourceGroupName, string managedInstanceName, string databaseName, CompleteDatabaseRestoreDefinition parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -581,28 +594,32 @@ public Response ListInaccessibleByInstance(string res { throw new ArgumentNullException(nameof(managedInstanceName)); } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateListInaccessibleByInstanceRequest(resourceGroupName, managedInstanceName); + using var message = CreateCompleteRestoreRequest(resourceGroupName, managedInstanceName, databaseName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ManagedDatabaseListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedDatabaseListResult.DeserializeManagedDatabaseListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCompleteRestoreRequest(string resourceGroupName, string managedInstanceName, string databaseName, CompleteDatabaseRestoreDefinition parameters) + internal HttpMessage CreateListInaccessibleByInstanceRequest(string resourceGroupName, string managedInstanceName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -611,26 +628,19 @@ internal HttpMessage CreateCompleteRestoreRequest(string resourceGroupName, stri uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/completeRestore", false); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendPath("/inaccessibleManagedDatabases", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; + request.Headers.Add("Accept", "application/json"); return message; } - /// Completes the restore operation on a managed database. - /// The name of the resource group. The name is case insensitive. + /// Gets a list of inaccessible managed databases in a managed instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the database. - /// The definition for completing the restore of this managed database. /// The cancellation token to use. - /// , , , or is null. - public async Task CompleteRestoreAsync(string resourceGroupName, string managedInstanceName, string databaseName, CompleteDatabaseRestoreDefinition parameters, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListInaccessibleByInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -640,35 +650,29 @@ public async Task CompleteRestoreAsync(string resourceGroupName, strin { throw new ArgumentNullException(nameof(managedInstanceName)); } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateCompleteRestoreRequest(resourceGroupName, managedInstanceName, databaseName, parameters); + using var message = CreateListInaccessibleByInstanceRequest(resourceGroupName, managedInstanceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + ManagedDatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedDatabaseListResult.DeserializeManagedDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Completes the restore operation on a managed database. - /// The name of the resource group. The name is case insensitive. + /// Gets a list of inaccessible managed databases in a managed instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The name of the database. - /// The definition for completing the restore of this managed database. /// The cancellation token to use. - /// , , , or is null. - public Response CompleteRestore(string resourceGroupName, string managedInstanceName, string databaseName, CompleteDatabaseRestoreDefinition parameters, CancellationToken cancellationToken = default) + /// or is null. + public Response ListInaccessibleByInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -678,22 +682,18 @@ public Response CompleteRestore(string resourceGroupName, string managedInstance { throw new ArgumentNullException(nameof(managedInstanceName)); } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateCompleteRestoreRequest(resourceGroupName, managedInstanceName, databaseName, parameters); + using var message = CreateListInaccessibleByInstanceRequest(resourceGroupName, managedInstanceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + ManagedDatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedDatabaseListResult.DeserializeManagedDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -714,7 +714,7 @@ internal HttpMessage CreateListByInstanceNextPageRequest(string nextLink, string /// Gets a list of managed databases. /// The URL to the next page of results. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// , , or is null. @@ -751,7 +751,7 @@ public async Task> ListByInstanceNextPageAsy /// Gets a list of managed databases. /// The URL to the next page of results. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// , , or is null. @@ -801,7 +801,7 @@ internal HttpMessage CreateListInaccessibleByInstanceNextPageRequest(string next /// Gets a list of inaccessible managed databases in a managed instance. /// The URL to the next page of results. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// , , or is null. @@ -838,7 +838,7 @@ public async Task> ListInaccessibleByInstanc /// Gets a list of inaccessible managed databases in a managed instance. /// The URL to the next page of results. - /// The name of the resource group. The name is case insensitive. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs index 612ad0027a0e5..818a666d47e09 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs @@ -42,14 +42,15 @@ internal ManagedInstanceAdministratorsOperations(ClientDiagnostics clientDiagnos /// Gets a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAdministratorsOperations.Get"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, administratorName, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -61,14 +62,15 @@ public virtual async Task> GetAsync(strin /// Gets a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAdministratorsOperations.Get"); scope.Start(); try { - return RestClient.Get(resourceGroupName, managedInstanceName, cancellationToken); + return RestClient.Get(resourceGroupName, managedInstanceName, administratorName, cancellationToken); } catch (Exception e) { @@ -178,10 +180,11 @@ Page NextPageFunc(string nextLink, int? pageSizeHi /// Creates or updates a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The requested administrator parameters. /// The cancellation token to use. /// , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default) + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -200,8 +203,8 @@ public virtual async Task scope.Start(); try { - var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, cancellationToken).ConfigureAwait(false); - return new ManagedInstanceAdministratorsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, parameters).Request, originalResponse); + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters, cancellationToken).ConfigureAwait(false); + return new ManagedInstanceAdministratorsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, administratorName, parameters).Request, originalResponse); } catch (Exception e) { @@ -213,10 +216,11 @@ public virtual async Task /// Creates or updates a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The requested administrator parameters. /// The cancellation token to use. /// , , or is null. - public virtual ManagedInstanceAdministratorsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string managedInstanceName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default) + public virtual ManagedInstanceAdministratorsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -235,8 +239,8 @@ public virtual ManagedInstanceAdministratorsCreateOrUpdateOperation StartCreateO scope.Start(); try { - var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, managedInstanceName, parameters, cancellationToken); - return new ManagedInstanceAdministratorsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, parameters).Request, originalResponse); + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, managedInstanceName, administratorName, parameters, cancellationToken); + return new ManagedInstanceAdministratorsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, administratorName, parameters).Request, originalResponse); } catch (Exception e) { @@ -248,9 +252,10 @@ public virtual ManagedInstanceAdministratorsCreateOrUpdateOperation StartCreateO /// Deletes a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The cancellation token to use. /// or is null. - public virtual async Task StartDeleteAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public virtual async Task StartDeleteAsync(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -265,8 +270,8 @@ public virtual async Task StartDel scope.Start(); try { - var originalResponse = await RestClient.DeleteAsync(resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); - return new ManagedInstanceAdministratorsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, managedInstanceName).Request, originalResponse); + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, managedInstanceName, administratorName, cancellationToken).ConfigureAwait(false); + return new ManagedInstanceAdministratorsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, managedInstanceName, administratorName).Request, originalResponse); } catch (Exception e) { @@ -278,9 +283,10 @@ public virtual async Task StartDel /// Deletes a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The cancellation token to use. /// or is null. - public virtual ManagedInstanceAdministratorsDeleteOperation StartDelete(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public virtual ManagedInstanceAdministratorsDeleteOperation StartDelete(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -295,8 +301,8 @@ public virtual ManagedInstanceAdministratorsDeleteOperation StartDelete(string r scope.Start(); try { - var originalResponse = RestClient.Delete(resourceGroupName, managedInstanceName, cancellationToken); - return new ManagedInstanceAdministratorsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, managedInstanceName).Request, originalResponse); + var originalResponse = RestClient.Delete(resourceGroupName, managedInstanceName, administratorName, cancellationToken); + return new ManagedInstanceAdministratorsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, managedInstanceName, administratorName).Request, originalResponse); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorsRestOperations.cs index 00129af3d3561..fe8b7a82ed81a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAdministratorsRestOperations.cs @@ -57,7 +57,7 @@ internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/administrators", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -127,7 +127,7 @@ public Response ListByInstance(string re } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, AdministratorName administratorName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -141,8 +141,8 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/administrators/", false); - uri.AppendPath("ActiveDirectory", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendPath(administratorName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -151,9 +151,10 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn /// Gets a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The cancellation token to use. /// or is null. - public async Task> GetAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -164,7 +165,7 @@ public async Task> GetAsync(string resour throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateGetRequest(resourceGroupName, managedInstanceName); + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, administratorName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -183,9 +184,10 @@ public async Task> GetAsync(string resour /// Gets a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The cancellation token to use. /// or is null. - public Response Get(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -196,7 +198,7 @@ public Response Get(string resourceGroupName, stri throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateGetRequest(resourceGroupName, managedInstanceName); + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, administratorName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -212,7 +214,7 @@ public Response Get(string resourceGroupName, stri } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string managedInstanceName, ManagedInstanceAdministrator parameters) + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, ManagedInstanceAdministrator parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -226,8 +228,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/administrators/", false); - uri.AppendPath("ActiveDirectory", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendPath(administratorName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -240,10 +242,11 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin /// Creates or updates a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The requested administrator parameters. /// The cancellation token to use. /// , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -258,7 +261,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, parameters); + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, administratorName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -274,10 +277,11 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string /// Creates or updates a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The requested administrator parameters. /// The cancellation token to use. /// , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -292,7 +296,7 @@ public Response CreateOrUpdate(string resourceGroupName, string managedInstanceN throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, parameters); + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, administratorName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -305,7 +309,7 @@ public Response CreateOrUpdate(string resourceGroupName, string managedInstanceN } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string managedInstanceName) + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string managedInstanceName, AdministratorName administratorName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -319,8 +323,8 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/administrators/", false); - uri.AppendPath("ActiveDirectory", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendPath(administratorName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -328,9 +332,10 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage /// Deletes a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The cancellation token to use. /// or is null. - public async Task DeleteAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -341,7 +346,7 @@ public async Task DeleteAsync(string resourceGroupName, string managed throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateDeleteRequest(resourceGroupName, managedInstanceName); + using var message = CreateDeleteRequest(resourceGroupName, managedInstanceName, administratorName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -356,9 +361,10 @@ public async Task DeleteAsync(string resourceGroupName, string managed /// Deletes a managed instance administrator. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The AdministratorName to use. /// The cancellation token to use. /// or is null. - public Response Delete(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public Response Delete(string resourceGroupName, string managedInstanceName, AdministratorName administratorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -369,7 +375,7 @@ public Response Delete(string resourceGroupName, string managedInstanceName, Can throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateDeleteRequest(resourceGroupName, managedInstanceName); + using var message = CreateDeleteRequest(resourceGroupName, managedInstanceName, administratorName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation.cs new file mode 100644 index 0000000000000..2cfe17710e51f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property. + public partial class ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation for mocking. + protected ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation() + { + } + + internal ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ManagedInstanceAzureADOnlyAuthentication Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ManagedInstanceAzureADOnlyAuthentication IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ManagedInstanceAzureADOnlyAuthentication.DeserializeManagedInstanceAzureADOnlyAuthentication(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ManagedInstanceAzureADOnlyAuthentication.DeserializeManagedInstanceAzureADOnlyAuthentication(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation.cs new file mode 100644 index 0000000000000..ab6015f726cf5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Sql +{ + /// Deletes an existing server Active Directory only authentication property. + public partial class ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation for mocking. + protected ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation() + { + } + + internal ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs new file mode 100644 index 0000000000000..7eee8531d2a6f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedInstanceAzureADOnlyAuthentications service client. + public partial class ManagedInstanceAzureADOnlyAuthenticationsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedInstanceAzureADOnlyAuthenticationsRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthenticationsOperations for mocking. + protected ManagedInstanceAzureADOnlyAuthenticationsOperations() + { + } + + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthenticationsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedInstanceAzureADOnlyAuthenticationsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedInstanceAzureADOnlyAuthenticationsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a specific Azure Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, authenticationName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a specific Azure Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, authenticationName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of server Azure Active Directory only authentications. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.ListByInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByInstanceAsync(resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.ListByInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByInstanceNextPageAsync(nextLink, resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of server Azure Active Directory only authentications. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.ListByInstance"); + scope.Start(); + try + { + var response = RestClient.ListByInstance(resourceGroupName, managedInstanceName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.ListByInstance"); + scope.Start(); + try + { + var response = RestClient.ListByInstanceNextPage(nextLink, resourceGroupName, managedInstanceName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The required parameters for creating or updating an Active Directory only authentication property. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, ManagedInstanceAzureADOnlyAuthentication parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters, cancellationToken).ConfigureAwait(false); + return new ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, authenticationName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The required parameters for creating or updating an Active Directory only authentication property. + /// The cancellation token to use. + /// , , or is null. + public virtual ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, ManagedInstanceAzureADOnlyAuthentication parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, managedInstanceName, authenticationName, parameters, cancellationToken); + return new ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, authenticationName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing server Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, managedInstanceName, authenticationName, cancellationToken).ConfigureAwait(false); + return new ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, managedInstanceName, authenticationName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes an existing server Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + /// or is null. + public virtual ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation StartDelete(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceAzureADOnlyAuthenticationsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, managedInstanceName, authenticationName, cancellationToken); + return new ManagedInstanceAzureADOnlyAuthenticationsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, managedInstanceName, authenticationName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsRestOperations.cs new file mode 100644 index 0000000000000..0c8a3cbb01372 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsRestOperations.cs @@ -0,0 +1,479 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedInstanceAzureADOnlyAuthenticationsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthenticationsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedInstanceAzureADOnlyAuthenticationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/azureADOnlyAuthentications/", false); + uri.AppendPath(authenticationName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a specific Azure Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, authenticationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceAzureADOnlyAuthentication value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceAzureADOnlyAuthentication.DeserializeManagedInstanceAzureADOnlyAuthentication(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a specific Azure Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + /// or is null. + public Response Get(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, authenticationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceAzureADOnlyAuthentication value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceAzureADOnlyAuthentication.DeserializeManagedInstanceAzureADOnlyAuthentication(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, ManagedInstanceAzureADOnlyAuthentication parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/azureADOnlyAuthentications/", false); + uri.AppendPath(authenticationName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The required parameters for creating or updating an Active Directory only authentication property. + /// The cancellation token to use. + /// , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, ManagedInstanceAzureADOnlyAuthentication parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, authenticationName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The required parameters for creating or updating an Active Directory only authentication property. + /// The cancellation token to use. + /// , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, ManagedInstanceAzureADOnlyAuthentication parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, authenticationName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/azureADOnlyAuthentications/", false); + uri.AppendPath(authenticationName.ToString(), true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + return message; + } + + /// Deletes an existing server Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + /// or is null. + public async Task DeleteAsync(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, managedInstanceName, authenticationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes an existing server Active Directory only authentication property. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of server azure active directory only authentication. + /// The cancellation token to use. + /// or is null. + public Response Delete(string resourceGroupName, string managedInstanceName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, managedInstanceName, authenticationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/azureADOnlyAuthentications", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of server Azure Active Directory only authentications. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public async Task> ListByInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByInstanceRequest(resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceAzureADOnlyAuthListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceAzureADOnlyAuthListResult.DeserializeManagedInstanceAzureADOnlyAuthListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of server Azure Active Directory only authentications. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public Response ListByInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByInstanceRequest(resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceAzureADOnlyAuthListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceAzureADOnlyAuthListResult.DeserializeManagedInstanceAzureADOnlyAuthListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByInstanceNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of server Azure Active Directory only authentications. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByInstanceNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceAzureADOnlyAuthListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceAzureADOnlyAuthListResult.DeserializeManagedInstanceAzureADOnlyAuthListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of server Azure Active Directory only authentications. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + public Response ListByInstanceNextPage(string nextLink, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceAzureADOnlyAuthListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceAzureADOnlyAuthListResult.DeserializeManagedInstanceAzureADOnlyAuthListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorsRestOperations.cs index 0fff3abbcdbd6..5d1bc748730a4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceEncryptionProtectorsRestOperations.cs @@ -59,7 +59,7 @@ internal HttpMessage CreateRevalidateRequest(string resourceGroupName, string ma uri.AppendPath("/encryptionProtector/", false); uri.AppendPath(encryptionProtectorName.ToString(), true); uri.AppendPath("/revalidate", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -136,7 +136,7 @@ internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/encryptionProtector", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -221,7 +221,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(managedInstanceName, true); uri.AppendPath("/encryptionProtector/", false); uri.AppendPath(encryptionProtectorName.ToString(), true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -308,7 +308,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(managedInstanceName, true); uri.AppendPath("/encryptionProtector/", false); uri.AppendPath(encryptionProtectorName.ToString(), true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeysRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeysRestOperations.cs index bcc376ac3b4e3..ae14727cc90bc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeysRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceKeysRestOperations.cs @@ -61,7 +61,7 @@ internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, strin { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -148,7 +148,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(managedInstanceName, true); uri.AppendPath("/keys/", false); uri.AppendPath(keyName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -243,7 +243,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(managedInstanceName, true); uri.AppendPath("/keys/", false); uri.AppendPath(keyName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -346,7 +346,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage uri.AppendPath(managedInstanceName, true); uri.AppendPath("/keys/", false); uri.AppendPath(keyName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesRestOperations.cs index db5e741459aa0..206310f183dae 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(databaseName, true); uri.AppendPath("/backupLongTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/backupLongTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -263,7 +263,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/backupLongTermRetentionPolicies", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperations.cs index 9971860df9212..d893d2dc6ac24 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceOperations.cs @@ -39,18 +39,18 @@ internal ManagedInstanceOperations(ClientDiagnostics clientDiagnostics, HttpPipe _pipeline = pipeline; } - /// Cancels the asynchronous operation on the managed instance. + /// Gets a management operation on a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The Uuid to use. /// The cancellation token to use. - public virtual async Task CancelAsync(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstanceOperations.Cancel"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceOperations.Get"); scope.Start(); try { - return await RestClient.CancelAsync(resourceGroupName, managedInstanceName, operationId, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, operationId, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -59,18 +59,18 @@ public virtual async Task CancelAsync(string resourceGroupName, string } } - /// Cancels the asynchronous operation on the managed instance. + /// Gets a management operation on a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The Uuid to use. /// The cancellation token to use. - public virtual Response Cancel(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstanceOperations.Cancel"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceOperations.Get"); scope.Start(); try { - return RestClient.Cancel(resourceGroupName, managedInstanceName, operationId, cancellationToken); + return RestClient.Get(resourceGroupName, managedInstanceName, operationId, cancellationToken); } catch (Exception e) { @@ -79,18 +79,18 @@ public virtual Response Cancel(string resourceGroupName, string managedInstanceN } } - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The Uuid to use. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) + public virtual async Task CancelAsync(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstanceOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceOperations.Cancel"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, managedInstanceName, operationId, cancellationToken).ConfigureAwait(false); + return await RestClient.CancelAsync(resourceGroupName, managedInstanceName, operationId, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -99,18 +99,18 @@ public virtual async Task> GetAsync(string re } } - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The Uuid to use. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) + public virtual Response Cancel(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstanceOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstanceOperations.Cancel"); scope.Start(); try { - return RestClient.Get(resourceGroupName, managedInstanceName, operationId, cancellationToken); + return RestClient.Cancel(resourceGroupName, managedInstanceName, operationId, cancellationToken); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation.cs new file mode 100644 index 0000000000000..a0cbc99f3c451 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Approve or reject a private endpoint connection with a given name. + public partial class ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation for mocking. + protected ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation() + { + } + + internal ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ManagedInstancePrivateEndpointConnection Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ManagedInstancePrivateEndpointConnection IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ManagedInstancePrivateEndpointConnection.DeserializeManagedInstancePrivateEndpointConnection(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ManagedInstancePrivateEndpointConnection.DeserializeManagedInstancePrivateEndpointConnection(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsDeleteOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsDeleteOperation.cs new file mode 100644 index 0000000000000..2fefb270c8ff4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsDeleteOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Sql +{ + /// Deletes a private endpoint connection with a given name. + public partial class ManagedInstancePrivateEndpointConnectionsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionsDeleteOperation for mocking. + protected ManagedInstancePrivateEndpointConnectionsDeleteOperation() + { + } + + internal ManagedInstancePrivateEndpointConnectionsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ManagedInstancePrivateEndpointConnectionsDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..93b0fef15e4bb --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedInstancePrivateEndpointConnections service client. + public partial class ManagedInstancePrivateEndpointConnectionsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedInstancePrivateEndpointConnectionsRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionsOperations for mocking. + protected ManagedInstancePrivateEndpointConnectionsOperations() + { + } + + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedInstancePrivateEndpointConnectionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedInstancePrivateEndpointConnectionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a private endpoint connection. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the private endpoint connection. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a private endpoint connection. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the private endpoint connection. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, privateEndpointConnectionName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets all private endpoint connections on a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByManagedInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByManagedInstanceNextPageAsync(nextLink, resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all private endpoint connections on a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByManagedInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = RestClient.ListByManagedInstance(resourceGroupName, managedInstanceName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = RestClient.ListByManagedInstanceNextPage(nextLink, resourceGroupName, managedInstanceName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Approve or reject a private endpoint connection with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedInstancePrivateEndpointConnection to use. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, cancellationToken).ConfigureAwait(false); + return new ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Approve or reject a private endpoint connection with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedInstancePrivateEndpointConnection to use. + /// The cancellation token to use. + /// , , , or is null. + public virtual ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, cancellationToken); + return new ManagedInstancePrivateEndpointConnectionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a private endpoint connection with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + return new ManagedInstancePrivateEndpointConnectionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a private endpoint connection with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public virtual ManagedInstancePrivateEndpointConnectionsDeleteOperation StartDelete(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateEndpointConnectionsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, managedInstanceName, privateEndpointConnectionName, cancellationToken); + return new ManagedInstancePrivateEndpointConnectionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsRestOperations.cs new file mode 100644 index 0000000000000..22fea7a7001f5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsRestOperations.cs @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedInstancePrivateEndpointConnectionsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedInstancePrivateEndpointConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a private endpoint connection. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateEndpointConnection value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstancePrivateEndpointConnection.DeserializeManagedInstancePrivateEndpointConnection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a private endpoint connection. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the private endpoint connection. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateEndpointConnection value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstancePrivateEndpointConnection.DeserializeManagedInstancePrivateEndpointConnection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Approve or reject a private endpoint connection with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedInstancePrivateEndpointConnection to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Approve or reject a private endpoint connection with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The ManagedInstancePrivateEndpointConnection to use. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + return message; + } + + /// Deletes a private endpoint connection with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes a private endpoint connection with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (privateEndpointConnectionName == null) + { + throw new ArgumentNullException(nameof(privateEndpointConnectionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByManagedInstanceRequest(string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/privateEndpointConnections", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets all private endpoint connections on a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public async Task> ListByManagedInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateEndpointConnectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstancePrivateEndpointConnectionListResult.DeserializeManagedInstancePrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all private endpoint connections on a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public Response ListByManagedInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateEndpointConnectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstancePrivateEndpointConnectionListResult.DeserializeManagedInstancePrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByManagedInstanceNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets all private endpoint connections on a server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByManagedInstanceNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateEndpointConnectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstancePrivateEndpointConnectionListResult.DeserializeManagedInstancePrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all private endpoint connections on a server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + public Response ListByManagedInstanceNextPage(string nextLink, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateEndpointConnectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstancePrivateEndpointConnectionListResult.DeserializeManagedInstancePrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..e5d48112ebfee --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ManagedInstancePrivateLinkResources service client. + public partial class ManagedInstancePrivateLinkResourcesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ManagedInstancePrivateLinkResourcesRestOperations RestClient { get; } + + /// Initializes a new instance of ManagedInstancePrivateLinkResourcesOperations for mocking. + protected ManagedInstancePrivateLinkResourcesOperations() + { + } + + /// Initializes a new instance of ManagedInstancePrivateLinkResourcesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ManagedInstancePrivateLinkResourcesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ManagedInstancePrivateLinkResourcesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a private link resource for SQL server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the private link resource. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string groupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateLinkResourcesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, groupName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a private link resource for SQL server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the private link resource. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, string groupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateLinkResourcesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, groupName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the private link resources for SQL server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByManagedInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateLinkResourcesOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateLinkResourcesOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByManagedInstanceNextPageAsync(nextLink, resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets the private link resources for SQL server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByManagedInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateLinkResourcesOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = RestClient.ListByManagedInstance(resourceGroupName, managedInstanceName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ManagedInstancePrivateLinkResourcesOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = RestClient.ListByManagedInstanceNextPage(nextLink, resourceGroupName, managedInstanceName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResourcesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResourcesRestOperations.cs new file mode 100644 index 0000000000000..347d44410ce2f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancePrivateLinkResourcesRestOperations.cs @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ManagedInstancePrivateLinkResourcesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ManagedInstancePrivateLinkResourcesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ManagedInstancePrivateLinkResourcesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByManagedInstanceRequest(string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/privateLinkResources", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the private link resources for SQL server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public async Task> ListByManagedInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstancePrivateLinkListResult.DeserializeManagedInstancePrivateLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the private link resources for SQL server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public Response ListByManagedInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstancePrivateLinkListResult.DeserializeManagedInstancePrivateLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string groupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/privateLinkResources/", false); + uri.AppendPath(groupName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a private link resource for SQL server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the private link resource. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string groupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (groupName == null) + { + throw new ArgumentNullException(nameof(groupName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, groupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateLink value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstancePrivateLink.DeserializeManagedInstancePrivateLink(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a private link resource for SQL server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The name of the private link resource. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string managedInstanceName, string groupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (groupName == null) + { + throw new ArgumentNullException(nameof(groupName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, groupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateLink value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstancePrivateLink.DeserializeManagedInstancePrivateLink(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByManagedInstanceNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the private link resources for SQL server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByManagedInstanceNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstancePrivateLinkListResult.DeserializeManagedInstancePrivateLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the private link resources for SQL server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + public Response ListByManagedInstanceNextPage(string nextLink, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstancePrivateLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstancePrivateLinkListResult.DeserializeManagedInstancePrivateLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceRestOperations.cs index 6297c4cec996e..e97a37ad34c46 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceRestOperations.cs @@ -43,11 +43,11 @@ public ManagedInstanceRestOperations(ClientDiagnostics clientDiagnostics, HttpPi _pipeline = pipeline; } - internal HttpMessage CreateCancelRequest(string resourceGroupName, string managedInstanceName, Guid operationId) + internal HttpMessage CreateListByManagedInstanceRequest(string resourceGroupName, string managedInstanceName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -56,21 +56,19 @@ internal HttpMessage CreateCancelRequest(string resourceGroupName, string manage uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); - uri.AppendPath("/operations/", false); - uri.AppendPath(operationId, true); - uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendPath("/operations", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); return message; } - /// Cancels the asynchronous operation on the managed instance. + /// Gets a list of operations performed on the managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The Uuid to use. /// The cancellation token to use. /// or is null. - public async Task CancelAsync(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) + public async Task> ListByManagedInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -81,24 +79,28 @@ public async Task CancelAsync(string resourceGroupName, string managed throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateCancelRequest(resourceGroupName, managedInstanceName, operationId); + using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + { + ManagedInstanceOperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceOperationListResult.DeserializeManagedInstanceOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Cancels the asynchronous operation on the managed instance. + /// Gets a list of operations performed on the managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The Uuid to use. /// The cancellation token to use. /// or is null. - public Response Cancel(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) + public Response ListByManagedInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -109,18 +111,23 @@ public Response Cancel(string resourceGroupName, string managedInstanceName, Gui throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateCancelRequest(resourceGroupName, managedInstanceName, operationId); + using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + { + ManagedInstanceOperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceOperationListResult.DeserializeManagedInstanceOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateListByManagedInstanceRequest(string resourceGroupName, string managedInstanceName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, Guid operationId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -133,19 +140,21 @@ internal HttpMessage CreateListByManagedInstanceRequest(string resourceGroupName uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); - uri.AppendPath("/operations", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a list of operations performed on the managed instance. + /// Gets a management operation on a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The Uuid to use. /// The cancellation token to use. /// or is null. - public async Task> ListByManagedInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -156,15 +165,15 @@ public async Task> ListByManagedIns throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName); + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, operationId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ManagedInstanceOperationListResult value = default; + ManagedInstanceOperation value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedInstanceOperationListResult.DeserializeManagedInstanceOperationListResult(document.RootElement); + value = ManagedInstanceOperation.DeserializeManagedInstanceOperation(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -172,12 +181,13 @@ public async Task> ListByManagedIns } } - /// Gets a list of operations performed on the managed instance. + /// Gets a management operation on a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The Uuid to use. /// The cancellation token to use. /// or is null. - public Response ListByManagedInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -188,15 +198,15 @@ public Response ListByManagedInstance(string throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName); + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, operationId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ManagedInstanceOperationListResult value = default; + ManagedInstanceOperation value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedInstanceOperationListResult.DeserializeManagedInstanceOperationListResult(document.RootElement); + value = ManagedInstanceOperation.DeserializeManagedInstanceOperation(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -204,11 +214,11 @@ public Response ListByManagedInstance(string } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, Guid operationId) + internal HttpMessage CreateCancelRequest(string resourceGroupName, string managedInstanceName, Guid operationId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -219,19 +229,19 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(managedInstanceName, true); uri.AppendPath("/operations/", false); uri.AppendPath(operationId, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The Uuid to use. /// The cancellation token to use. /// or is null. - public async Task> GetAsync(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) + public async Task CancelAsync(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -242,29 +252,24 @@ public async Task> GetAsync(string resourceGr throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateGetRequest(resourceGroupName, managedInstanceName, operationId); + using var message = CreateCancelRequest(resourceGroupName, managedInstanceName, operationId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ManagedInstanceOperation value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedInstanceOperation.DeserializeManagedInstanceOperation(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The Uuid to use. /// The cancellation token to use. /// or is null. - public Response Get(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) + public Response Cancel(string resourceGroupName, string managedInstanceName, Guid operationId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -275,17 +280,12 @@ public Response Get(string resourceGroupName, string m throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateGetRequest(resourceGroupName, managedInstanceName, operationId); + using var message = CreateCancelRequest(resourceGroupName, managedInstanceName, operationId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ManagedInstanceOperation value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedInstanceOperation.DeserializeManagedInstanceOperation(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceTdeCertificatesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceTdeCertificatesRestOperations.cs index 88ef1e6781bfd..723f01395a5c4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceTdeCertificatesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceTdeCertificatesRestOperations.cs @@ -56,7 +56,7 @@ internal HttpMessage CreateCreateRequest(string resourceGroupName, string manage uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/tdeCertificates", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs index 9b61c351a5a12..788c12ff57141 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs @@ -79,7 +79,7 @@ public virtual Response Get(string resou } } - /// Creates or updates the managed instance's vulnerability assessment. + /// 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. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance for which the vulnerability assessment is defined. /// The name of the vulnerability assessment. @@ -100,7 +100,7 @@ public virtual async Task> Crea } } - /// Creates or updates the managed instance's vulnerability assessment. + /// 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. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance for which the vulnerability assessment is defined. /// The name of the vulnerability assessment. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsRestOperations.cs index 6179ae9ed53f1..911931eb0fa72 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(managedInstanceName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -145,7 +145,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(managedInstanceName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -155,7 +155,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin return message; } - /// Creates or updates the managed instance's vulnerability assessment. + /// 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. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance for which the vulnerability assessment is defined. /// The name of the vulnerability assessment. @@ -194,7 +194,7 @@ public async Task> CreateOrUpda } } - /// Creates or updates the managed instance's vulnerability assessment. + /// 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. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance for which the vulnerability assessment is defined. /// The name of the vulnerability assessment. @@ -248,7 +248,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage uri.AppendPath(managedInstanceName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -323,7 +323,7 @@ internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/vulnerabilityAssessments", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancesOperations.cs index d4bbeb9e831ae..8e89b1fd2851a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancesOperations.cs @@ -42,14 +42,15 @@ internal ManagedInstancesOperations(ClientDiagnostics clientDiagnostics, HttpPip /// Gets a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The child resources to include in the response. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.Get"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, expand, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -61,14 +62,15 @@ public virtual async Task> GetAsync(string resourceGro /// Gets a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The child resources to include in the response. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.Get"); scope.Start(); try { - return RestClient.Get(resourceGroupName, managedInstanceName, cancellationToken); + return RestClient.Get(resourceGroupName, managedInstanceName, expand, cancellationToken); } catch (Exception e) { @@ -77,24 +79,30 @@ public virtual Response Get(string resourceGroupName, string ma } } - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in an instance pool. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The instance pool name. + /// The child resources to include in the response. /// The cancellation token to use. - /// is null. - public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + /// or is null. + public virtual AsyncPageable ListByInstancePoolAsync(string resourceGroupName, string instancePoolName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } + if (instancePoolName == null) + { + throw new ArgumentNullException(nameof(instancePoolName)); + } async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByResourceGroup"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByInstancePool"); scope.Start(); try { - var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByInstancePoolAsync(resourceGroupName, instancePoolName, expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -105,11 +113,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByResourceGroup"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByInstancePool"); scope.Start(); try { - var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByInstancePoolNextPageAsync(nextLink, resourceGroupName, instancePoolName, expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -121,24 +129,30 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHin return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in an instance pool. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The instance pool name. + /// The child resources to include in the response. /// The cancellation token to use. - /// is null. - public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + /// or is null. + public virtual Pageable ListByInstancePool(string resourceGroupName, string instancePoolName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } + if (instancePoolName == null) + { + throw new ArgumentNullException(nameof(instancePoolName)); + } Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByResourceGroup"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByInstancePool"); scope.Start(); try { - var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); + var response = RestClient.ListByInstancePool(resourceGroupName, instancePoolName, expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -149,11 +163,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByResourceGroup"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByInstancePool"); scope.Start(); try { - var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken); + var response = RestClient.ListByInstancePoolNextPage(nextLink, resourceGroupName, instancePoolName, expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -165,29 +179,18 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Gets a list of all managed instances in an instance pool. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The instance pool name. + /// Gets a list of all managed instances in the subscription. + /// The child resources to include in the response. /// The cancellation token to use. - /// or is null. - public virtual AsyncPageable ListByInstancePoolAsync(string resourceGroupName, string instancePoolName, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListAsync(string expand = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (instancePoolName == null) - { - throw new ArgumentNullException(nameof(instancePoolName)); - } - async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByInstancePool"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.List"); scope.Start(); try { - var response = await RestClient.ListByInstancePoolAsync(resourceGroupName, instancePoolName, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListAsync(expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -198,11 +201,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByInstancePool"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.List"); scope.Start(); try { - var response = await RestClient.ListByInstancePoolNextPageAsync(nextLink, resourceGroupName, instancePoolName, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListNextPageAsync(nextLink, expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -214,29 +217,18 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHin return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Gets a list of all managed instances in an instance pool. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The instance pool name. + /// Gets a list of all managed instances in the subscription. + /// The child resources to include in the response. /// The cancellation token to use. - /// or is null. - public virtual Pageable ListByInstancePool(string resourceGroupName, string instancePoolName, CancellationToken cancellationToken = default) + public virtual Pageable List(string expand = null, CancellationToken cancellationToken = default) { - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - if (instancePoolName == null) - { - throw new ArgumentNullException(nameof(instancePoolName)); - } - Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByInstancePool"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.List"); scope.Start(); try { - var response = RestClient.ListByInstancePool(resourceGroupName, instancePoolName, cancellationToken); + var response = RestClient.List(expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -247,11 +239,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByInstancePool"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.List"); scope.Start(); try { - var response = RestClient.ListByInstancePoolNextPage(nextLink, resourceGroupName, instancePoolName, cancellationToken); + var response = RestClient.ListNextPage(nextLink, expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -263,17 +255,25 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Gets a list of all managed instances in the subscription. + /// Gets a list of managed instances in a resource group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. - public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + /// is null. + public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.List"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByResourceGroup"); scope.Start(); try { - var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -284,11 +284,11 @@ async Task> FirstPageFunc(int? pageSizeHint) } async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.List"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByResourceGroup"); scope.Start(); try { - var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -300,17 +300,25 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHin return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Gets a list of all managed instances in the subscription. + /// Gets a list of managed instances in a resource group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. - public virtual Pageable List(CancellationToken cancellationToken = default) + /// is null. + public virtual Pageable ListByResourceGroup(string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.List"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByResourceGroup"); scope.Start(); try { - var response = RestClient.List(cancellationToken); + var response = RestClient.ListByResourceGroup(resourceGroupName, expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -321,11 +329,11 @@ Page FirstPageFunc(int? pageSizeHint) } Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.List"); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByResourceGroup"); scope.Start(); try { - var response = RestClient.ListNextPage(nextLink, cancellationToken); + var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -337,13 +345,19 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Failovers a managed instance. - /// The name of the resource group. The name is case insensitive. + /// Get top resource consuming queries of a managed instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The type of replica to be failed over. + /// How many 'top queries' to return. Default is 5. + /// Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. Default value is PT1H. + /// Aggregation function to be used, default value is 'sum'. + /// Metric to be used for ranking top queries. Default is 'cpu'. /// The cancellation token to use. /// or is null. - public virtual async Task StartFailoverAsync(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListByManagedInstanceAsync(string resourceGroupName, string managedInstanceName, int? numberOfQueries = null, string databases = null, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, AggregationFunctionType? aggregationFunction = null, MetricType? observationMetric = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -354,27 +368,52 @@ public virtual async Task StartFailoverAsync( throw new ArgumentNullException(nameof(managedInstanceName)); } - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.StartFailover"); - scope.Start(); - try + async Task> FirstPageFunc(int? pageSizeHint) { - var originalResponse = await RestClient.FailoverAsync(resourceGroupName, managedInstanceName, replicaType, cancellationToken).ConfigureAwait(false); - return new ManagedInstancesFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequest(resourceGroupName, managedInstanceName, replicaType).Request, originalResponse); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - catch (Exception e) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByManagedInstanceNextPageAsync(nextLink, resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Failovers a managed instance. - /// The name of the resource group. The name is case insensitive. + /// Get top resource consuming queries of a managed instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. - /// The type of replica to be failed over. + /// How many 'top queries' to return. Default is 5. + /// Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. Default value is PT1H. + /// Aggregation function to be used, default value is 'sum'. + /// Metric to be used for ranking top queries. Default is 'cpu'. /// The cancellation token to use. /// or is null. - public virtual ManagedInstancesFailoverOperation StartFailover(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + public virtual Pageable ListByManagedInstance(string resourceGroupName, string managedInstanceName, int? numberOfQueries = null, string databases = null, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, AggregationFunctionType? aggregationFunction = null, MetricType? observationMetric = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -385,18 +424,37 @@ public virtual ManagedInstancesFailoverOperation StartFailover(string resourceGr throw new ArgumentNullException(nameof(managedInstanceName)); } - using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.StartFailover"); - scope.Start(); - try + Page FirstPageFunc(int? pageSizeHint) { - var originalResponse = RestClient.Failover(resourceGroupName, managedInstanceName, replicaType, cancellationToken); - return new ManagedInstancesFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequest(resourceGroupName, managedInstanceName, replicaType).Request, originalResponse); + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = RestClient.ListByManagedInstance(resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - catch (Exception e) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.ListByManagedInstance"); + scope.Start(); + try + { + var response = RestClient.ListByManagedInstanceNextPage(nextLink, resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// Creates or updates a managed instance. @@ -598,5 +656,67 @@ public virtual ManagedInstancesUpdateOperation StartUpdate(string resourceGroupN throw; } } + + /// Failovers a managed instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance to failover. + /// The type of replica to be failed over. + /// The cancellation token to use. + /// or is null. + public virtual async Task StartFailoverAsync(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.StartFailover"); + scope.Start(); + try + { + var originalResponse = await RestClient.FailoverAsync(resourceGroupName, managedInstanceName, replicaType, cancellationToken).ConfigureAwait(false); + return new ManagedInstancesFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequest(resourceGroupName, managedInstanceName, replicaType).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Failovers a managed instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance to failover. + /// The type of replica to be failed over. + /// The cancellation token to use. + /// or is null. + public virtual ManagedInstancesFailoverOperation StartFailover(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var scope = _clientDiagnostics.CreateScope("ManagedInstancesOperations.StartFailover"); + scope.Start(); + try + { + var originalResponse = RestClient.Failover(resourceGroupName, managedInstanceName, replicaType, cancellationToken); + return new ManagedInstancesFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequest(resourceGroupName, managedInstanceName, replicaType).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancesRestOperations.cs index e23c06a33ccfa..7664674d6382f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstancesRestOperations.cs @@ -43,88 +43,159 @@ public ManagedInstancesRestOperations(ClientDiagnostics clientDiagnostics, HttpP _pipeline = pipeline; } - internal HttpMessage CreateFailoverRequest(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType) + internal HttpMessage CreateListByInstancePoolRequest(string resourceGroupName, string instancePoolName, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); - uri.AppendPath(managedInstanceName, true); - uri.AppendPath("/failover", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); - if (replicaType != null) + uri.AppendPath("/providers/Microsoft.Sql/instancePools/", false); + uri.AppendPath(instancePoolName, true); + uri.AppendPath("/managedInstances", false); + if (expand != null) { - uri.AppendQuery("replicaType", replicaType.Value.ToString(), true); + uri.AppendQuery("$expand", expand, true); } + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); return message; } - /// Failovers a managed instance. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed instance. - /// The type of replica to be failed over. + /// Gets a list of all managed instances in an instance pool. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The instance pool name. + /// The child resources to include in the response. /// The cancellation token to use. - /// or is null. - public async Task FailoverAsync(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByInstancePoolAsync(string resourceGroupName, string instancePoolName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - if (managedInstanceName == null) + if (instancePoolName == null) { - throw new ArgumentNullException(nameof(managedInstanceName)); + throw new ArgumentNullException(nameof(instancePoolName)); } - using var message = CreateFailoverRequest(resourceGroupName, managedInstanceName, replicaType); + using var message = CreateListByInstancePoolRequest(resourceGroupName, instancePoolName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + ManagedInstanceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceListResult.DeserializeManagedInstanceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Failovers a managed instance. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed instance. - /// The type of replica to be failed over. + /// Gets a list of all managed instances in an instance pool. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The instance pool name. + /// The child resources to include in the response. /// The cancellation token to use. - /// or is null. - public Response Failover(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + /// or is null. + public Response ListByInstancePool(string resourceGroupName, string instancePoolName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - if (managedInstanceName == null) + if (instancePoolName == null) { - throw new ArgumentNullException(nameof(managedInstanceName)); + throw new ArgumentNullException(nameof(instancePoolName)); } - using var message = CreateFailoverRequest(resourceGroupName, managedInstanceName, replicaType); + using var message = CreateListByInstancePoolRequest(resourceGroupName, instancePoolName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + ManagedInstanceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceListResult.DeserializeManagedInstanceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances", false); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of all managed instances in the subscription. + /// The child resources to include in the response. + /// The cancellation token to use. + public async Task> ListAsync(string expand = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedInstanceListResult.DeserializeManagedInstanceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of all managed instances in the subscription. + /// The child resources to include in the response. + /// The cancellation token to use. + public Response List(string expand = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedInstanceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedInstanceListResult.DeserializeManagedInstanceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) + internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -136,7 +207,11 @@ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances", false); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -144,16 +219,17 @@ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) /// Gets a list of managed instances in a resource group. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. /// is null. - public async Task> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + public async Task> ListByResourceGroupAsync(string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateListByResourceGroupRequest(resourceGroupName); + using var message = CreateListByResourceGroupRequest(resourceGroupName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -171,16 +247,17 @@ public async Task> ListByResourceGroupAsync( /// Gets a list of managed instances in a resource group. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. /// is null. - public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + public Response ListByResourceGroup(string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateListByResourceGroupRequest(resourceGroupName); + using var message = CreateListByResourceGroupRequest(resourceGroupName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -196,7 +273,7 @@ public Response ListByResourceGroup(string resourceGr } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -209,7 +286,11 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -218,9 +299,10 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn /// Gets a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The child resources to include in the response. /// The cancellation token to use. /// or is null. - public async Task> GetAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -231,7 +313,7 @@ public async Task> GetAsync(string resourceGroupName, throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateGetRequest(resourceGroupName, managedInstanceName); + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -250,9 +332,10 @@ public async Task> GetAsync(string resourceGroupName, /// Gets a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. + /// The child resources to include in the response. /// The cancellation token to use. /// or is null. - public Response Get(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -263,7 +346,7 @@ public Response Get(string resourceGroupName, string managedIns throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateGetRequest(resourceGroupName, managedInstanceName); + using var message = CreateGetRequest(resourceGroupName, managedInstanceName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -292,7 +375,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -383,7 +466,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string manage uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; return message; } @@ -459,7 +542,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string manage uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -535,7 +618,7 @@ public Response Update(string resourceGroupName, string managedInstanceName, Man } } - internal HttpMessage CreateListByInstancePoolRequest(string resourceGroupName, string instancePoolName) + internal HttpMessage CreateListByManagedInstanceRequest(string resourceGroupName, string managedInstanceName, int? numberOfQueries, string databases, string startTime, string endTime, QueryTimeGrainType? interval, AggregationFunctionType? aggregationFunction, MetricType? observationMetric) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -546,40 +629,75 @@ internal HttpMessage CreateListByInstancePoolRequest(string resourceGroupName, s uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/instancePools/", false); - uri.AppendPath(instancePoolName, true); - uri.AppendPath("/managedInstances", false); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/topqueries", false); + if (numberOfQueries != null) + { + uri.AppendQuery("numberOfQueries", numberOfQueries.Value, true); + } + if (databases != null) + { + uri.AppendQuery("databases", databases, true); + } + if (startTime != null) + { + uri.AppendQuery("startTime", startTime, true); + } + if (endTime != null) + { + uri.AppendQuery("endTime", endTime, true); + } + if (interval != null) + { + uri.AppendQuery("interval", interval.Value.ToString(), true); + } + if (aggregationFunction != null) + { + uri.AppendQuery("aggregationFunction", aggregationFunction.Value.ToString(), true); + } + if (observationMetric != null) + { + uri.AppendQuery("observationMetric", observationMetric.Value.ToString(), true); + } + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a list of all managed instances in an instance pool. + /// Get top resource consuming queries of a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The instance pool name. + /// The name of the managed instance. + /// How many 'top queries' to return. Default is 5. + /// Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. Default value is PT1H. + /// Aggregation function to be used, default value is 'sum'. + /// Metric to be used for ranking top queries. Default is 'cpu'. /// The cancellation token to use. - /// or is null. - public async Task> ListByInstancePoolAsync(string resourceGroupName, string instancePoolName, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByManagedInstanceAsync(string resourceGroupName, string managedInstanceName, int? numberOfQueries = null, string databases = null, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, AggregationFunctionType? aggregationFunction = null, MetricType? observationMetric = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - if (instancePoolName == null) + if (managedInstanceName == null) { - throw new ArgumentNullException(nameof(instancePoolName)); + throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateListByInstancePoolRequest(resourceGroupName, instancePoolName); + using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ManagedInstanceListResult value = default; + TopQueriesListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedInstanceListResult.DeserializeManagedInstanceListResult(document.RootElement); + value = TopQueriesListResult.DeserializeTopQueriesListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -587,31 +705,38 @@ public async Task> ListByInstancePoolAsync(s } } - /// Gets a list of all managed instances in an instance pool. + /// Get top resource consuming queries of a managed instance. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The instance pool name. + /// The name of the managed instance. + /// How many 'top queries' to return. Default is 5. + /// Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. Default value is PT1H. + /// Aggregation function to be used, default value is 'sum'. + /// Metric to be used for ranking top queries. Default is 'cpu'. /// The cancellation token to use. - /// or is null. - public Response ListByInstancePool(string resourceGroupName, string instancePoolName, CancellationToken cancellationToken = default) + /// or is null. + public Response ListByManagedInstance(string resourceGroupName, string managedInstanceName, int? numberOfQueries = null, string databases = null, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, AggregationFunctionType? aggregationFunction = null, MetricType? observationMetric = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - if (instancePoolName == null) + if (managedInstanceName == null) { - throw new ArgumentNullException(nameof(instancePoolName)); + throw new ArgumentNullException(nameof(managedInstanceName)); } - using var message = CreateListByInstancePoolRequest(resourceGroupName, instancePoolName); + using var message = CreateListByManagedInstanceRequest(resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ManagedInstanceListResult value = default; + TopQueriesListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedInstanceListResult.DeserializeManagedInstanceListResult(document.RootElement); + value = TopQueriesListResult.DeserializeTopQueriesListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -619,27 +744,123 @@ public Response ListByInstancePool(string resourceGro } } - internal HttpMessage CreateListRequest() + internal HttpMessage CreateFailoverRequest(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Sql/managedInstances", false); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/failover", false); + if (replicaType != null) + { + uri.AppendQuery("replicaType", replicaType.Value.ToString(), true); + } + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + return message; + } + + /// Failovers a managed instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance to failover. + /// The type of replica to be failed over. + /// The cancellation token to use. + /// or is null. + public async Task FailoverAsync(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateFailoverRequest(resourceGroupName, managedInstanceName, replicaType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Failovers a managed instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance to failover. + /// The type of replica to be failed over. + /// The cancellation token to use. + /// or is null. + public Response Failover(string resourceGroupName, string managedInstanceName, ReplicaType? replicaType = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateFailoverRequest(resourceGroupName, managedInstanceName, replicaType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByInstancePoolNextPageRequest(string nextLink, string resourceGroupName, string instancePoolName, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The instance pool name. + /// The child resources to include in the response. /// The cancellation token to use. - public async Task> ListAsync(CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByInstancePoolNextPageAsync(string nextLink, string resourceGroupName, string instancePoolName, string expand = null, CancellationToken cancellationToken = default) { - using var message = CreateListRequest(); + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (instancePoolName == null) + { + throw new ArgumentNullException(nameof(instancePoolName)); + } + + using var message = CreateListByInstancePoolNextPageRequest(nextLink, resourceGroupName, instancePoolName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -655,11 +876,29 @@ public async Task> ListAsync(CancellationTok } } - /// Gets a list of all managed instances in the subscription. + /// Gets a list of all managed instances in an instance pool. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The instance pool name. + /// The child resources to include in the response. /// The cancellation token to use. - public Response List(CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByInstancePoolNextPage(string nextLink, string resourceGroupName, string instancePoolName, string expand = null, CancellationToken cancellationToken = default) { - using var message = CreateListRequest(); + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (instancePoolName == null) + { + throw new ArgumentNullException(nameof(instancePoolName)); + } + + using var message = CreateListByInstancePoolNextPageRequest(nextLink, resourceGroupName, instancePoolName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -675,7 +914,7 @@ public Response List(CancellationToken cancellationTo } } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -688,23 +927,19 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// The URL to the next page of results. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. - /// or is null. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default) + /// is null. + public async Task> ListNextPageAsync(string nextLink, string expand = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + using var message = CreateListNextPageRequest(nextLink, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -720,23 +955,19 @@ public async Task> ListByResourceGroupNextPa } } - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// The URL to the next page of results. - /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. - /// or is null. - public Response ListByResourceGroupNextPage(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default) + /// is null. + public Response ListNextPage(string nextLink, string expand = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - if (resourceGroupName == null) - { - throw new ArgumentNullException(nameof(resourceGroupName)); - } - using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + using var message = CreateListNextPageRequest(nextLink, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -752,7 +983,7 @@ public Response ListByResourceGroupNextPage(string ne } } - internal HttpMessage CreateListByInstancePoolNextPageRequest(string nextLink, string resourceGroupName, string instancePoolName) + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -765,13 +996,13 @@ internal HttpMessage CreateListByInstancePoolNextPageRequest(string nextLink, st return message; } - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of managed instances in a resource group. /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The instance pool name. + /// The child resources to include in the response. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByInstancePoolNextPageAsync(string nextLink, string resourceGroupName, string instancePoolName, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -781,12 +1012,8 @@ public async Task> ListByInstancePoolNextPag { throw new ArgumentNullException(nameof(resourceGroupName)); } - if (instancePoolName == null) - { - throw new ArgumentNullException(nameof(instancePoolName)); - } - using var message = CreateListByInstancePoolNextPageRequest(nextLink, resourceGroupName, instancePoolName); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -802,13 +1029,13 @@ public async Task> ListByInstancePoolNextPag } } - /// Gets a list of all managed instances in an instance pool. + /// Gets a list of managed instances in a resource group. /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. - /// The instance pool name. + /// The child resources to include in the response. /// The cancellation token to use. - /// , , or is null. - public Response ListByInstancePoolNextPage(string nextLink, string resourceGroupName, string instancePoolName, CancellationToken cancellationToken = default) + /// or is null. + public Response ListByResourceGroupNextPage(string nextLink, string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -818,12 +1045,8 @@ public Response ListByInstancePoolNextPage(string nex { throw new ArgumentNullException(nameof(resourceGroupName)); } - if (instancePoolName == null) - { - throw new ArgumentNullException(nameof(instancePoolName)); - } - using var message = CreateListByInstancePoolNextPageRequest(nextLink, resourceGroupName, instancePoolName); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -839,7 +1062,7 @@ public Response ListByInstancePoolNextPage(string nex } } - internal HttpMessage CreateListNextPageRequest(string nextLink) + internal HttpMessage CreateListByManagedInstanceNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName, int? numberOfQueries, string databases, string startTime, string endTime, QueryTimeGrainType? interval, AggregationFunctionType? aggregationFunction, MetricType? observationMetric) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -852,26 +1075,43 @@ internal HttpMessage CreateListNextPageRequest(string nextLink) return message; } - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// How many 'top queries' to return. Default is 5. + /// Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. Default value is PT1H. + /// Aggregation function to be used, default value is 'sum'. + /// Metric to be used for ranking top queries. Default is 'cpu'. /// The cancellation token to use. - /// is null. - public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByManagedInstanceNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, int? numberOfQueries = null, string databases = null, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, AggregationFunctionType? aggregationFunction = null, MetricType? observationMetric = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } - using var message = CreateListNextPageRequest(nextLink); + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ManagedInstanceListResult value = default; + TopQueriesListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedInstanceListResult.DeserializeManagedInstanceListResult(document.RootElement); + value = TopQueriesListResult.DeserializeTopQueriesListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -879,26 +1119,43 @@ public async Task> ListNextPageAsync(string } } - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// How many 'top queries' to return. Default is 5. + /// Comma separated list of databases to be included into search. All DB's are included if this parameter is not specified. + /// Start time for observed period. + /// End time for observed period. + /// The time step to be used to summarize the metric values. Default value is PT1H. + /// Aggregation function to be used, default value is 'sum'. + /// Metric to be used for ranking top queries. Default is 'cpu'. /// The cancellation token to use. - /// is null. - public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByManagedInstanceNextPage(string nextLink, string resourceGroupName, string managedInstanceName, int? numberOfQueries = null, string databases = null, string startTime = null, string endTime = null, QueryTimeGrainType? interval = null, AggregationFunctionType? aggregationFunction = null, MetricType? observationMetric = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } - using var message = CreateListNextPageRequest(nextLink); + using var message = CreateListByManagedInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName, numberOfQueries, databases, startTime, endTime, interval, aggregationFunction, observationMetric); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ManagedInstanceListResult value = default; + TopQueriesListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedInstanceListResult.DeserializeManagedInstanceListResult(document.RootElement); + value = TopQueriesListResult.DeserializeTopQueriesListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateOperation.cs index 09705139912b6..012d4fe56d70c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateOperation.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateOperation.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Sql { - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. public partial class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateOperation : Operation, IOperationSource { private readonly ArmOperationHelpers _operation; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs index 964caefc60040..233e0b728c567 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs @@ -189,12 +189,12 @@ Page NextPageFunc(string nextLink, int? p return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The String to use. /// The policy name. Should always be "default". - /// The long term retention policy info. + /// The short term retention policy info. /// The cancellation token to use. /// , , , or is null. public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName, ManagedBackupShortTermRetentionPolicy parameters, CancellationToken cancellationToken = default) @@ -230,12 +230,12 @@ public virtual async Task Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The String to use. /// The policy name. Should always be "default". - /// The long term retention policy info. + /// The short term retention policy info. /// The cancellation token to use. /// , , , or is null. public virtual ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName, ManagedBackupShortTermRetentionPolicy parameters, CancellationToken cancellationToken = default) @@ -271,12 +271,12 @@ public virtual ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesC } } - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The String to use. /// The policy name. Should always be "default". - /// The long term retention policy info. + /// The short term retention policy info. /// The cancellation token to use. /// , , , or is null. public virtual async Task StartUpdateAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName, ManagedBackupShortTermRetentionPolicy parameters, CancellationToken cancellationToken = default) @@ -312,12 +312,12 @@ public virtual async Task Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The String to use. /// The policy name. Should always be "default". - /// The long term retention policy info. + /// The short term retention policy info. /// The cancellation token to use. /// , , , or is null. public virtual ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateOperation StartUpdate(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName, ManagedBackupShortTermRetentionPolicy parameters, CancellationToken cancellationToken = default) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesRestOperations.cs index cd0c8e5f5745a..44984f5cab68d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(restorableDroppedDatabaseId, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -159,7 +159,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(restorableDroppedDatabaseId, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -169,12 +169,12 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin return message; } - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The String to use. /// The policy name. Should always be "default". - /// The long term retention policy info. + /// The short term retention policy info. /// The cancellation token to use. /// , , , or is null. public async Task CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName, ManagedBackupShortTermRetentionPolicy parameters, CancellationToken cancellationToken = default) @@ -208,12 +208,12 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } } - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The String to use. /// The policy name. Should always be "default". - /// The long term retention policy info. + /// The short term retention policy info. /// The cancellation token to use. /// , , , or is null. public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName, ManagedBackupShortTermRetentionPolicy parameters, CancellationToken cancellationToken = default) @@ -264,7 +264,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string manage uri.AppendPath(restorableDroppedDatabaseId, true); uri.AppendPath("/backupShortTermRetentionPolicies/", false); uri.AppendPath(policyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -274,12 +274,12 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string manage return message; } - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The String to use. /// The policy name. Should always be "default". - /// The long term retention policy info. + /// The short term retention policy info. /// The cancellation token to use. /// , , , or is null. public async Task UpdateAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName, ManagedBackupShortTermRetentionPolicy parameters, CancellationToken cancellationToken = default) @@ -313,12 +313,12 @@ public async Task UpdateAsync(string resourceGroupName, string managed } } - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the managed instance. /// The String to use. /// The policy name. Should always be "default". - /// The long term retention policy info. + /// The short term retention policy info. /// The cancellation token to use. /// , , , or is null. public Response Update(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedShortTermRetentionPolicyName policyName, ManagedBackupShortTermRetentionPolicy parameters, CancellationToken cancellationToken = default) @@ -368,7 +368,7 @@ internal HttpMessage CreateListByRestorableDroppedDatabaseRequest(string resourc uri.AppendPath("/restorableDroppedDatabases/", false); uri.AppendPath(restorableDroppedDatabaseId, true); uri.AppendPath("/backupShortTermRetentionPolicies", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateOperation.cs index 14450695c2c50..0ae9d7ef04ea1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateOperation.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateOperation.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Sql { - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. public partial class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateOperation : Operation, IOperationSource { private readonly ArmOperationHelpers _operation; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs index 881114793ea2c..14ee48c5ff0f1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs @@ -44,7 +44,7 @@ internal ManagedServerSecurityAlertPoliciesOperations(ClientDiagnostics clientDi /// The name of the managed instance. /// The name of the security alert policy. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ManagedServerSecurityAlertPoliciesOperations.Get"); scope.Start(); @@ -64,7 +64,7 @@ public virtual async Task> GetAsync(s /// The name of the managed instance. /// The name of the security alert policy. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ManagedServerSecurityAlertPoliciesOperations.Get"); scope.Start(); @@ -184,7 +184,7 @@ Page NextPageFunc(string nextLink, int? pageSi /// The managed server security alert policy. /// The cancellation token to use. /// , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -220,7 +220,7 @@ public virtual async Task The managed server security alert policy. /// The cancellation token to use. /// , , or is null. - public virtual ManagedServerSecurityAlertPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + public virtual ManagedServerSecurityAlertPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPoliciesRestOperations.cs index dca322956c868..db91c6b1e38ce 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedServerSecurityAlertPoliciesRestOperations.cs @@ -43,7 +43,7 @@ public ManagedServerSecurityAlertPoliciesRestOperations(ClientDiagnostics client _pipeline = pipeline; } - internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(managedInstanceName, true); uri.AppendPath("/securityAlertPolicies/", false); uri.AppendPath(securityAlertPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -70,7 +70,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn /// The name of the security alert policy. /// The cancellation token to use. /// or is null. - public async Task> GetAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -103,7 +103,7 @@ public async Task> GetAsync(string re /// The name of the security alert policy. /// The cancellation token to use. /// or is null. - public Response Get(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -130,7 +130,7 @@ public Response Get(string resourceGroupName, } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters) + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -145,7 +145,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(managedInstanceName, true); uri.AppendPath("/securityAlertPolicies/", false); uri.AppendPath(securityAlertPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -162,7 +162,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin /// The managed server security alert policy. /// The cancellation token to use. /// , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -196,7 +196,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string /// The managed server security alert policy. /// The cancellation token to use. /// , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName, ManagedServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -237,7 +237,7 @@ internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/securityAlertPolicies", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Advisor.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Advisor.Serialization.cs new file mode 100644 index 0000000000000..fe43ecc941b0f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Advisor.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class Advisor : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(AutoExecuteStatus)) + { + writer.WritePropertyName("autoExecuteStatus"); + writer.WriteStringValue(AutoExecuteStatus.Value.ToSerialString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static Advisor DeserializeAdvisor(JsonElement element) + { + Optional kind = default; + Optional location = default; + Optional id = default; + Optional name = default; + Optional type = default; + Optional advisorStatus = default; + Optional autoExecuteStatus = default; + Optional autoExecuteStatusInheritedFrom = default; + Optional recommendationsStatus = default; + Optional lastChecked = default; + Optional> recommendedActions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind")) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("advisorStatus")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + advisorStatus = property0.Value.GetString().ToAdvisorStatus(); + continue; + } + if (property0.NameEquals("autoExecuteStatus")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + autoExecuteStatus = property0.Value.GetString().ToAutoExecuteStatus(); + continue; + } + if (property0.NameEquals("autoExecuteStatusInheritedFrom")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + autoExecuteStatusInheritedFrom = property0.Value.GetString().ToAutoExecuteStatusInheritedFrom(); + continue; + } + if (property0.NameEquals("recommendationsStatus")) + { + recommendationsStatus = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastChecked")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + lastChecked = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("recommendedActions")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RecommendedAction.DeserializeRecommendedAction(item)); + } + recommendedActions = array; + continue; + } + } + continue; + } + } + return new Advisor(id.Value, name.Value, type.Value, kind.Value, location.Value, Optional.ToNullable(advisorStatus), Optional.ToNullable(autoExecuteStatus), Optional.ToNullable(autoExecuteStatusInheritedFrom), recommendationsStatus.Value, Optional.ToNullable(lastChecked), Optional.ToList(recommendedActions)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Advisor.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Advisor.cs new file mode 100644 index 0000000000000..63316e66aaa61 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Advisor.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Database, Server or Elastic Pool Advisor. + public partial class Advisor : ProxyResource + { + /// Initializes a new instance of Advisor. + public Advisor() + { + RecommendedActions = new ChangeTrackingList(); + } + + /// Initializes a new instance of Advisor. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource kind. + /// Resource location. + /// Gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + /// Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + /// 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). + /// 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. + /// Gets the time when the current resource was analyzed for recommendations by this advisor. + /// Gets the recommended actions for this advisor. + internal Advisor(string id, string name, string type, string kind, string location, AdvisorStatus? advisorStatus, AutoExecuteStatus? autoExecuteStatus, AutoExecuteStatusInheritedFrom? autoExecuteStatusInheritedFrom, string recommendationsStatus, DateTimeOffset? lastChecked, IReadOnlyList recommendedActions) : base(id, name, type) + { + Kind = kind; + Location = location; + AdvisorStatus = advisorStatus; + AutoExecuteStatus = autoExecuteStatus; + AutoExecuteStatusInheritedFrom = autoExecuteStatusInheritedFrom; + RecommendationsStatus = recommendationsStatus; + LastChecked = lastChecked; + RecommendedActions = recommendedActions; + } + + /// Resource kind. + public string Kind { get; } + /// Resource location. + public string Location { get; } + /// Gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + public AdvisorStatus? AdvisorStatus { get; } + /// Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + public AutoExecuteStatus? AutoExecuteStatus { get; set; } + /// 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 AutoExecuteStatusInheritedFrom? AutoExecuteStatusInheritedFrom { get; } + /// Gets that status of recommendations for this advisor and reason for not having any recommendations. Possible values include, but are not limited to, 'Ok' (Recommendations available),LowActivity (not enough workload to analyze), 'DbSeemsTuned' (Database is doing well), etc. + public string RecommendationsStatus { get; } + /// Gets the time when the current resource was analyzed for recommendations by this advisor. + public DateTimeOffset? LastChecked { get; } + /// Gets the recommended actions for this advisor. + public IReadOnlyList RecommendedActions { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AdvisorStatus.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AdvisorStatus.Serialization.cs new file mode 100644 index 0000000000000..7cd87e7783daf --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AdvisorStatus.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class AdvisorStatusExtensions + { + public static string ToSerialString(this AdvisorStatus value) => value switch + { + AdvisorStatus.GA => "GA", + AdvisorStatus.PublicPreview => "PublicPreview", + AdvisorStatus.LimitedPublicPreview => "LimitedPublicPreview", + AdvisorStatus.PrivatePreview => "PrivatePreview", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AdvisorStatus value.") + }; + + public static AdvisorStatus ToAdvisorStatus(this string value) + { + if (string.Equals(value, "GA", StringComparison.InvariantCultureIgnoreCase)) return AdvisorStatus.GA; + if (string.Equals(value, "PublicPreview", StringComparison.InvariantCultureIgnoreCase)) return AdvisorStatus.PublicPreview; + if (string.Equals(value, "LimitedPublicPreview", StringComparison.InvariantCultureIgnoreCase)) return AdvisorStatus.LimitedPublicPreview; + if (string.Equals(value, "PrivatePreview", StringComparison.InvariantCultureIgnoreCase)) return AdvisorStatus.PrivatePreview; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AdvisorStatus value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AdvisorStatus.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AdvisorStatus.cs new file mode 100644 index 0000000000000..7322f1241d2f0 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AdvisorStatus.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + public enum AdvisorStatus + { + /// GA. + GA, + /// PublicPreview. + PublicPreview, + /// LimitedPublicPreview. + LimitedPublicPreview, + /// PrivatePreview. + PrivatePreview + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AggregationFunctionType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AggregationFunctionType.cs new file mode 100644 index 0000000000000..80718584f1c8b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AggregationFunctionType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The AggregationFunctionType. + public readonly partial struct AggregationFunctionType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public AggregationFunctionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AvgValue = "avg"; + private const string MinValue = "min"; + private const string MaxValue = "max"; + private const string StdevValue = "stdev"; + private const string SumValue = "sum"; + + /// avg. + public static AggregationFunctionType Avg { get; } = new AggregationFunctionType(AvgValue); + /// min. + public static AggregationFunctionType Min { get; } = new AggregationFunctionType(MinValue); + /// max. + public static AggregationFunctionType Max { get; } = new AggregationFunctionType(MaxValue); + /// stdev. + public static AggregationFunctionType Stdev { get; } = new AggregationFunctionType(StdevValue); + /// sum. + public static AggregationFunctionType Sum { get; } = new AggregationFunctionType(SumValue); + /// Determines if two values are the same. + public static bool operator ==(AggregationFunctionType left, AggregationFunctionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AggregationFunctionType left, AggregationFunctionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AggregationFunctionType(string value) => new AggregationFunctionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AggregationFunctionType other && Equals(other); + /// + public bool Equals(AggregationFunctionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthenticationType.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthenticationType.Serialization.cs deleted file mode 100644 index c60b12783bae9..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthenticationType.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - internal static partial class AuthenticationTypeExtensions - { - public static string ToSerialString(this AuthenticationType value) => value switch - { - AuthenticationType.SQL => "SQL", - AuthenticationType.ADPassword => "ADPassword", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AuthenticationType value.") - }; - - public static AuthenticationType ToAuthenticationType(this string value) - { - if (string.Equals(value, "SQL", StringComparison.InvariantCultureIgnoreCase)) return AuthenticationType.SQL; - if (string.Equals(value, "ADPassword", StringComparison.InvariantCultureIgnoreCase)) return AuthenticationType.ADPassword; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AuthenticationType value."); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthenticationType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthenticationType.cs deleted file mode 100644 index f5e8d31ae8e7e..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthenticationType.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Sql.Models -{ - /// The authentication type. - public enum AuthenticationType - { - /// SQL. - SQL, - /// ADPassword. - ADPassword - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatus.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatus.Serialization.cs new file mode 100644 index 0000000000000..a1072f1c78087 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatus.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class AutoExecuteStatusExtensions + { + public static string ToSerialString(this AutoExecuteStatus value) => value switch + { + AutoExecuteStatus.Enabled => "Enabled", + AutoExecuteStatus.Disabled => "Disabled", + AutoExecuteStatus.Default => "Default", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AutoExecuteStatus value.") + }; + + public static AutoExecuteStatus ToAutoExecuteStatus(this string value) + { + if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return AutoExecuteStatus.Enabled; + if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return AutoExecuteStatus.Disabled; + if (string.Equals(value, "Default", StringComparison.InvariantCultureIgnoreCase)) return AutoExecuteStatus.Default; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AutoExecuteStatus value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatus.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatus.cs new file mode 100644 index 0000000000000..32b33ecca49e4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatus.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// 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 + { + /// Enabled. + Enabled, + /// Disabled. + Disabled, + /// Default. + Default + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.Serialization.cs new file mode 100644 index 0000000000000..2d13ae27f773a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class AutoExecuteStatusInheritedFromExtensions + { + public static string ToSerialString(this AutoExecuteStatusInheritedFrom value) => value switch + { + AutoExecuteStatusInheritedFrom.Default => "Default", + AutoExecuteStatusInheritedFrom.Subscription => "Subscription", + AutoExecuteStatusInheritedFrom.Server => "Server", + AutoExecuteStatusInheritedFrom.ElasticPool => "ElasticPool", + AutoExecuteStatusInheritedFrom.Database => "Database", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AutoExecuteStatusInheritedFrom value.") + }; + + public static AutoExecuteStatusInheritedFrom ToAutoExecuteStatusInheritedFrom(this string value) + { + if (string.Equals(value, "Default", StringComparison.InvariantCultureIgnoreCase)) return AutoExecuteStatusInheritedFrom.Default; + if (string.Equals(value, "Subscription", StringComparison.InvariantCultureIgnoreCase)) return AutoExecuteStatusInheritedFrom.Subscription; + if (string.Equals(value, "Server", StringComparison.InvariantCultureIgnoreCase)) return AutoExecuteStatusInheritedFrom.Server; + if (string.Equals(value, "ElasticPool", StringComparison.InvariantCultureIgnoreCase)) return AutoExecuteStatusInheritedFrom.ElasticPool; + if (string.Equals(value, "Database", StringComparison.InvariantCultureIgnoreCase)) return AutoExecuteStatusInheritedFrom.Database; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AutoExecuteStatusInheritedFrom value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs new file mode 100644 index 0000000000000..5fa86f0d07620 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// 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 + { + /// Default. + Default, + /// Subscription. + Subscription, + /// Server. + Server, + /// ElasticPool. + ElasticPool, + /// Database. + Database + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs new file mode 100644 index 0000000000000..4f0e0494d8dc4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupStorageRedundancy.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The storage account type used to store backups for this database. + public readonly partial struct BackupStorageRedundancy : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public BackupStorageRedundancy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GeoValue = "Geo"; + private const string LocalValue = "Local"; + private const string ZoneValue = "Zone"; + private const string GeoZoneValue = "GeoZone"; + + /// Geo. + public static BackupStorageRedundancy Geo { get; } = new BackupStorageRedundancy(GeoValue); + /// Local. + public static BackupStorageRedundancy Local { get; } = new BackupStorageRedundancy(LocalValue); + /// Zone. + public static BackupStorageRedundancy Zone { get; } = new BackupStorageRedundancy(ZoneValue); + /// GeoZone. + public static BackupStorageRedundancy GeoZone { get; } = new BackupStorageRedundancy(GeoZoneValue); + /// Determines if two values are the same. + public static bool operator ==(BackupStorageRedundancy left, BackupStorageRedundancy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BackupStorageRedundancy left, BackupStorageRedundancy right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator BackupStorageRedundancy(string value) => new BackupStorageRedundancy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BackupStorageRedundancy other && Equals(other); + /// + public bool Equals(BackupStorageRedundancy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BlobAuditingPolicyState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BlobAuditingPolicyState.cs index c73565c187eb2..8437cf1a6ae39 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BlobAuditingPolicyState.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BlobAuditingPolicyState.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. public enum BlobAuditingPolicyState { /// Enabled. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ColumnDataType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ColumnDataType.cs new file mode 100644 index 0000000000000..38901e091c493 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ColumnDataType.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The column data type. + public readonly partial struct ColumnDataType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ColumnDataType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ImageValue = "image"; + private const string TextValue = "text"; + private const string UniqueidentifierValue = "uniqueidentifier"; + private const string DateValue = "date"; + private const string TimeValue = "time"; + private const string Datetime2Value = "datetime2"; + private const string DatetimeoffsetValue = "datetimeoffset"; + private const string TinyintValue = "tinyint"; + private const string SmallintValue = "smallint"; + private const string IntValue = "int"; + private const string SmalldatetimeValue = "smalldatetime"; + private const string RealValue = "real"; + private const string MoneyValue = "money"; + private const string DatetimeValue = "datetime"; + private const string FloatValue = "float"; + private const string SqlVariantValue = "sql_variant"; + private const string NtextValue = "ntext"; + private const string BitValue = "bit"; + private const string DecimalValue = "decimal"; + private const string NumericValue = "numeric"; + private const string SmallmoneyValue = "smallmoney"; + private const string BigintValue = "bigint"; + private const string HierarchyidValue = "hierarchyid"; + private const string GeometryValue = "geometry"; + private const string GeographyValue = "geography"; + private const string VarbinaryValue = "varbinary"; + private const string VarcharValue = "varchar"; + private const string BinaryValue = "binary"; + private const string CharValue = "char"; + private const string TimestampValue = "timestamp"; + private const string NvarcharValue = "nvarchar"; + private const string NcharValue = "nchar"; + private const string XmlValue = "xml"; + private const string SysnameValue = "sysname"; + + /// image. + public static ColumnDataType Image { get; } = new ColumnDataType(ImageValue); + /// text. + public static ColumnDataType Text { get; } = new ColumnDataType(TextValue); + /// uniqueidentifier. + public static ColumnDataType Uniqueidentifier { get; } = new ColumnDataType(UniqueidentifierValue); + /// date. + public static ColumnDataType Date { get; } = new ColumnDataType(DateValue); + /// time. + public static ColumnDataType Time { get; } = new ColumnDataType(TimeValue); + /// datetime2. + public static ColumnDataType Datetime2 { get; } = new ColumnDataType(Datetime2Value); + /// datetimeoffset. + public static ColumnDataType Datetimeoffset { get; } = new ColumnDataType(DatetimeoffsetValue); + /// tinyint. + public static ColumnDataType Tinyint { get; } = new ColumnDataType(TinyintValue); + /// smallint. + public static ColumnDataType Smallint { get; } = new ColumnDataType(SmallintValue); + /// int. + public static ColumnDataType Int { get; } = new ColumnDataType(IntValue); + /// smalldatetime. + public static ColumnDataType Smalldatetime { get; } = new ColumnDataType(SmalldatetimeValue); + /// real. + public static ColumnDataType Real { get; } = new ColumnDataType(RealValue); + /// money. + public static ColumnDataType Money { get; } = new ColumnDataType(MoneyValue); + /// datetime. + public static ColumnDataType Datetime { get; } = new ColumnDataType(DatetimeValue); + /// float. + public static ColumnDataType Float { get; } = new ColumnDataType(FloatValue); + /// sql_variant. + public static ColumnDataType SqlVariant { get; } = new ColumnDataType(SqlVariantValue); + /// ntext. + public static ColumnDataType Ntext { get; } = new ColumnDataType(NtextValue); + /// bit. + public static ColumnDataType Bit { get; } = new ColumnDataType(BitValue); + /// decimal. + public static ColumnDataType Decimal { get; } = new ColumnDataType(DecimalValue); + /// numeric. + public static ColumnDataType Numeric { get; } = new ColumnDataType(NumericValue); + /// smallmoney. + public static ColumnDataType Smallmoney { get; } = new ColumnDataType(SmallmoneyValue); + /// bigint. + public static ColumnDataType Bigint { get; } = new ColumnDataType(BigintValue); + /// hierarchyid. + public static ColumnDataType Hierarchyid { get; } = new ColumnDataType(HierarchyidValue); + /// geometry. + public static ColumnDataType Geometry { get; } = new ColumnDataType(GeometryValue); + /// geography. + public static ColumnDataType Geography { get; } = new ColumnDataType(GeographyValue); + /// varbinary. + public static ColumnDataType Varbinary { get; } = new ColumnDataType(VarbinaryValue); + /// varchar. + public static ColumnDataType Varchar { get; } = new ColumnDataType(VarcharValue); + /// binary. + public static ColumnDataType Binary { get; } = new ColumnDataType(BinaryValue); + /// char. + public static ColumnDataType Char { get; } = new ColumnDataType(CharValue); + /// timestamp. + public static ColumnDataType Timestamp { get; } = new ColumnDataType(TimestampValue); + /// nvarchar. + public static ColumnDataType Nvarchar { get; } = new ColumnDataType(NvarcharValue); + /// nchar. + public static ColumnDataType Nchar { get; } = new ColumnDataType(NcharValue); + /// xml. + public static ColumnDataType Xml { get; } = new ColumnDataType(XmlValue); + /// sysname. + public static ColumnDataType Sysname { get; } = new ColumnDataType(SysnameValue); + /// Determines if two values are the same. + public static bool operator ==(ColumnDataType left, ColumnDataType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ColumnDataType left, ColumnDataType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ColumnDataType(string value) => new ColumnDataType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ColumnDataType other && Equals(other); + /// + public bool Equals(ColumnDataType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.Serialization.cs new file mode 100644 index 0000000000000..92bf467234fc6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class CopyLongTermRetentionBackupParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(TargetSubscriptionId)) + { + writer.WritePropertyName("targetSubscriptionId"); + writer.WriteStringValue(TargetSubscriptionId); + } + if (Optional.IsDefined(TargetResourceGroup)) + { + writer.WritePropertyName("targetResourceGroup"); + writer.WriteStringValue(TargetResourceGroup); + } + if (Optional.IsDefined(TargetServerResourceId)) + { + writer.WritePropertyName("targetServerResourceId"); + writer.WriteStringValue(TargetServerResourceId); + } + if (Optional.IsDefined(TargetServerFullyQualifiedDomainName)) + { + writer.WritePropertyName("targetServerFullyQualifiedDomainName"); + writer.WriteStringValue(TargetServerFullyQualifiedDomainName); + } + if (Optional.IsDefined(TargetDatabaseName)) + { + writer.WritePropertyName("targetDatabaseName"); + writer.WriteStringValue(TargetDatabaseName); + } + if (Optional.IsDefined(TargetBackupStorageRedundancy)) + { + writer.WritePropertyName("targetBackupStorageRedundancy"); + writer.WriteStringValue(TargetBackupStorageRedundancy.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.cs new file mode 100644 index 0000000000000..50eba4c66bc6a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CopyLongTermRetentionBackupParameters.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains the information necessary to perform long term retention backup copy operation. + public partial class CopyLongTermRetentionBackupParameters + { + /// Initializes a new instance of CopyLongTermRetentionBackupParameters. + public CopyLongTermRetentionBackupParameters() + { + } + + /// The subscription that owns the target server. + public string TargetSubscriptionId { get; set; } + /// The resource group that owns the target server. + public string TargetResourceGroup { get; set; } + /// The resource Id of the target server that owns the database. + public string TargetServerResourceId { get; set; } + /// The fully qualified domain name of the target server. + public string TargetServerFullyQualifiedDomainName { get; set; } + /// The name of the database owns the copied backup. + public string TargetDatabaseName { get; set; } + /// The storage redundancy type of the copied backup. + public BackupStorageRedundancy? TargetBackupStorageRedundancy { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CreatedByType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..c4463dcba6406 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The type of identity that created the resource. + public readonly partial struct CreatedByType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public CreatedByType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "User"; + private const string ApplicationValue = "Application"; + private const string ManagedIdentityValue = "ManagedIdentity"; + private const string KeyValue = "Key"; + + /// User. + public static CreatedByType User { get; } = new CreatedByType(UserValue); + /// Application. + public static CreatedByType Application { get; } = new CreatedByType(ApplicationValue); + /// ManagedIdentity. + public static CreatedByType ManagedIdentity { get; } = new CreatedByType(ManagedIdentityValue); + /// Key. + public static CreatedByType Key { get; } = new CreatedByType(KeyValue); + /// Determines if two values are the same. + public static bool operator ==(CreatedByType left, CreatedByType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CreatedByType left, CreatedByType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CreatedByType(string value) => new CreatedByType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CreatedByType other && Equals(other); + /// + public bool Equals(CreatedByType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivities.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivities.Serialization.cs new file mode 100644 index 0000000000000..3befe03dd75e4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivities.Serialization.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DataWarehouseUserActivities : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DataWarehouseUserActivities DeserializeDataWarehouseUserActivities(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional activeQueriesCount = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("activeQueriesCount")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + activeQueriesCount = property0.Value.GetInt32(); + continue; + } + } + continue; + } + } + return new DataWarehouseUserActivities(id.Value, name.Value, type.Value, Optional.ToNullable(activeQueriesCount)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivities.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivities.cs new file mode 100644 index 0000000000000..14eea332cbef3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivities.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// User activities of a data warehouse. + public partial class DataWarehouseUserActivities : ProxyResource + { + /// Initializes a new instance of DataWarehouseUserActivities. + public DataWarehouseUserActivities() + { + } + + /// Initializes a new instance of DataWarehouseUserActivities. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Count of running and suspended queries. + internal DataWarehouseUserActivities(string id, string name, string type, int? activeQueriesCount) : base(id, name, type) + { + ActiveQueriesCount = activeQueriesCount; + } + + /// Count of running and suspended queries. + public int? ActiveQueriesCount { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivitiesListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivitiesListResult.Serialization.cs new file mode 100644 index 0000000000000..d932d05d756b8 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivitiesListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class DataWarehouseUserActivitiesListResult + { + internal static DataWarehouseUserActivitiesListResult DeserializeDataWarehouseUserActivitiesListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataWarehouseUserActivities.DeserializeDataWarehouseUserActivities(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataWarehouseUserActivitiesListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivitiesListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivitiesListResult.cs new file mode 100644 index 0000000000000..964ca3209db6a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivitiesListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// User activities of a data warehouse. + internal partial class DataWarehouseUserActivitiesListResult + { + /// Initializes a new instance of DataWarehouseUserActivitiesListResult. + internal DataWarehouseUserActivitiesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataWarehouseUserActivitiesListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal DataWarehouseUserActivitiesListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivityName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivityName.cs new file mode 100644 index 0000000000000..62d1fb6573032 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DataWarehouseUserActivityName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The DataWarehouseUserActivityName. + public readonly partial struct DataWarehouseUserActivityName : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public DataWarehouseUserActivityName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CurrentValue = "current"; + + /// current. + public static DataWarehouseUserActivityName Current { get; } = new DataWarehouseUserActivityName(CurrentValue); + /// Determines if two values are the same. + public static bool operator ==(DataWarehouseUserActivityName left, DataWarehouseUserActivityName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataWarehouseUserActivityName left, DataWarehouseUserActivityName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataWarehouseUserActivityName(string value) => new DataWarehouseUserActivityName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataWarehouseUserActivityName other && Equals(other); + /// + public bool Equals(DataWarehouseUserActivityName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Database.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Database.Serialization.cs index 8da2eb50e6009..fcef562d644c9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Database.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Database.Serialization.cs @@ -22,6 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } writer.WritePropertyName("location"); writer.WriteStringValue(Location); if (Optional.IsCollectionDefined(Tags)) @@ -117,21 +122,51 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("readScale"); writer.WriteStringValue(ReadScale.Value.ToString()); } - if (Optional.IsDefined(ReadReplicaCount)) + if (Optional.IsDefined(HighAvailabilityReplicaCount)) + { + writer.WritePropertyName("highAvailabilityReplicaCount"); + writer.WriteNumberValue(HighAvailabilityReplicaCount.Value); + } + if (Optional.IsDefined(SecondaryType)) { - writer.WritePropertyName("readReplicaCount"); - writer.WriteNumberValue(ReadReplicaCount.Value); + writer.WritePropertyName("secondaryType"); + writer.WriteStringValue(SecondaryType.Value.ToString()); } if (Optional.IsDefined(AutoPauseDelay)) { writer.WritePropertyName("autoPauseDelay"); writer.WriteNumberValue(AutoPauseDelay.Value); } + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) + { + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); + } if (Optional.IsDefined(MinCapacity)) { writer.WritePropertyName("minCapacity"); writer.WriteNumberValue(MinCapacity.Value); } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"); + writer.WriteStringValue(MaintenanceConfigurationId); + } + if (Optional.IsDefined(IsLedgerOn)) + { + writer.WritePropertyName("isLedgerOn"); + writer.WriteBooleanValue(IsLedgerOn.Value); + } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"); + writer.WriteStringValue(FederatedClientId.Value); + } + if (Optional.IsDefined(PrimaryDelegatedIdentityClientId)) + { + writer.WritePropertyName("primaryDelegatedIdentityClientId"); + writer.WriteStringValue(PrimaryDelegatedIdentityClientId.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -141,6 +176,7 @@ internal static Database DeserializeDatabase(JsonElement element) Optional sku = default; Optional kind = default; Optional managedBy = default; + Optional identity = default; string location = default; Optional> tags = default; Optional id = default; @@ -171,12 +207,20 @@ internal static Database DeserializeDatabase(JsonElement element) Optional maxLogSizeBytes = default; Optional earliestRestoreDate = default; Optional readScale = default; - Optional readReplicaCount = default; + Optional highAvailabilityReplicaCount = default; + Optional secondaryType = default; Optional currentSku = default; Optional autoPauseDelay = default; + Optional currentBackupStorageRedundancy = default; + Optional requestedBackupStorageRedundancy = default; Optional minCapacity = default; Optional pausedDate = default; Optional resumedDate = default; + Optional maintenanceConfigurationId = default; + Optional isLedgerOn = default; + Optional isInfraEncryptionEnabled = default; + Optional federatedClientId = default; + Optional primaryDelegatedIdentityClientId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) @@ -199,6 +243,16 @@ internal static Database DeserializeDatabase(JsonElement element) managedBy = property.Value.GetString(); continue; } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = DatabaseIdentity.DeserializeDatabaseIdentity(property.Value); + continue; + } if (property.NameEquals("location")) { location = property.Value.GetString(); @@ -438,14 +492,24 @@ internal static Database DeserializeDatabase(JsonElement element) readScale = new DatabaseReadScale(property0.Value.GetString()); continue; } - if (property0.NameEquals("readReplicaCount")) + if (property0.NameEquals("highAvailabilityReplicaCount")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + highAvailabilityReplicaCount = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("secondaryType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - readReplicaCount = property0.Value.GetInt32(); + secondaryType = new SecondaryType(property0.Value.GetString()); continue; } if (property0.NameEquals("currentSku")) @@ -468,6 +532,26 @@ internal static Database DeserializeDatabase(JsonElement element) autoPauseDelay = property0.Value.GetInt32(); continue; } + if (property0.NameEquals("currentBackupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + currentBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("requestedBackupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + requestedBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } if (property0.NameEquals("minCapacity")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -498,11 +582,56 @@ internal static Database DeserializeDatabase(JsonElement element) resumedDate = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("maintenanceConfigurationId")) + { + maintenanceConfigurationId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isLedgerOn")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isLedgerOn = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("isInfraEncryptionEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isInfraEncryptionEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("federatedClientId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + federatedClientId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("primaryDelegatedIdentityClientId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + primaryDelegatedIdentityClientId = property0.Value.GetGuid(); + continue; + } } continue; } } - return new Database(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), sku.Value, kind.Value, managedBy.Value, Optional.ToNullable(createMode), collation.Value, Optional.ToNullable(maxSizeBytes), Optional.ToNullable(sampleName), elasticPoolId.Value, sourceDatabaseId.Value, Optional.ToNullable(status), Optional.ToNullable(databaseId), Optional.ToNullable(creationDate), currentServiceObjectiveName.Value, requestedServiceObjectiveName.Value, defaultSecondaryLocation.Value, failoverGroupId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(sourceDatabaseDeletionDate), recoveryServicesRecoveryPointId.Value, longTermRetentionBackupResourceId.Value, recoverableDatabaseId.Value, restorableDroppedDatabaseId.Value, Optional.ToNullable(catalogCollation), Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType), Optional.ToNullable(maxLogSizeBytes), Optional.ToNullable(earliestRestoreDate), Optional.ToNullable(readScale), Optional.ToNullable(readReplicaCount), currentSku.Value, Optional.ToNullable(autoPauseDelay), Optional.ToNullable(minCapacity), Optional.ToNullable(pausedDate), Optional.ToNullable(resumedDate)); + return new Database(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), sku.Value, kind.Value, managedBy.Value, identity.Value, Optional.ToNullable(createMode), collation.Value, Optional.ToNullable(maxSizeBytes), Optional.ToNullable(sampleName), elasticPoolId.Value, sourceDatabaseId.Value, Optional.ToNullable(status), Optional.ToNullable(databaseId), Optional.ToNullable(creationDate), currentServiceObjectiveName.Value, requestedServiceObjectiveName.Value, defaultSecondaryLocation.Value, failoverGroupId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(sourceDatabaseDeletionDate), recoveryServicesRecoveryPointId.Value, longTermRetentionBackupResourceId.Value, recoverableDatabaseId.Value, restorableDroppedDatabaseId.Value, Optional.ToNullable(catalogCollation), Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType), Optional.ToNullable(maxLogSizeBytes), Optional.ToNullable(earliestRestoreDate), Optional.ToNullable(readScale), Optional.ToNullable(highAvailabilityReplicaCount), Optional.ToNullable(secondaryType), currentSku.Value, Optional.ToNullable(autoPauseDelay), Optional.ToNullable(currentBackupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy), Optional.ToNullable(minCapacity), Optional.ToNullable(pausedDate), Optional.ToNullable(resumedDate), maintenanceConfigurationId.Value, Optional.ToNullable(isLedgerOn), Optional.ToNullable(isInfraEncryptionEnabled), Optional.ToNullable(federatedClientId), Optional.ToNullable(primaryDelegatedIdentityClientId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Database.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Database.cs index 638a618e4291c..f287232c10972 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Database.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Database.cs @@ -57,6 +57,7 @@ public Database(string location) : base(location) /// /// Kind of database. This is metadata used for the Azure portal experience. /// Resource that manages the database. + /// The Azure Active Directory identity of the database. /// /// Specifies the mode of database creation. /// @@ -115,18 +116,27 @@ public Database(string location) : base(location) /// 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. /// The max log size for this database. /// This records the earliest start date and time that restore is available for this database (ISO8601 format). - /// If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. - /// The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases. + /// 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. + /// The number of secondary replicas associated with the database that are used to provide high availability. + /// The secondary type of the database if it is a secondary. Valid values are Geo and Named. /// The name and tier of the SKU. /// Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. + /// The storage account type used to store backups for this database. + /// The storage account type to be used to store backups for this database. /// Minimal capacity that database will always have allocated, if not paused. - /// The date when database was paused by user configuration or action (ISO8601 format). Null if the database is ready. + /// The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. /// The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. - internal Database(string id, string name, string type, string location, IDictionary tags, Sku sku, string kind, string managedBy, CreateMode? createMode, string collation, long? maxSizeBytes, SampleName? sampleName, string elasticPoolId, string sourceDatabaseId, DatabaseStatus? status, Guid? databaseId, DateTimeOffset? creationDate, string currentServiceObjectiveName, string requestedServiceObjectiveName, string defaultSecondaryLocation, string failoverGroupId, DateTimeOffset? restorePointInTime, DateTimeOffset? sourceDatabaseDeletionDate, string recoveryServicesRecoveryPointId, string longTermRetentionBackupResourceId, string recoverableDatabaseId, string restorableDroppedDatabaseId, CatalogCollationType? catalogCollation, bool? zoneRedundant, DatabaseLicenseType? licenseType, long? maxLogSizeBytes, DateTimeOffset? earliestRestoreDate, DatabaseReadScale? readScale, int? readReplicaCount, Sku currentSku, int? autoPauseDelay, double? minCapacity, DateTimeOffset? pausedDate, DateTimeOffset? resumedDate) : base(id, name, type, location, tags) + /// Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. + /// 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. + /// Infra encryption is enabled for this database. + /// The Client id used for cross tenant per database CMK scenario. + /// The Primary Delegated Identity Client id used for per database CMK - for internal use only. + internal Database(string id, string name, string type, string location, IDictionary tags, Sku sku, string kind, string managedBy, DatabaseIdentity identity, CreateMode? createMode, string collation, long? maxSizeBytes, SampleName? sampleName, string elasticPoolId, string sourceDatabaseId, DatabaseStatus? status, Guid? databaseId, DateTimeOffset? creationDate, string currentServiceObjectiveName, string requestedServiceObjectiveName, string defaultSecondaryLocation, string failoverGroupId, DateTimeOffset? restorePointInTime, DateTimeOffset? sourceDatabaseDeletionDate, string recoveryServicesRecoveryPointId, string longTermRetentionBackupResourceId, string recoverableDatabaseId, string restorableDroppedDatabaseId, CatalogCollationType? catalogCollation, bool? zoneRedundant, DatabaseLicenseType? licenseType, long? maxLogSizeBytes, DateTimeOffset? earliestRestoreDate, DatabaseReadScale? readScale, int? highAvailabilityReplicaCount, SecondaryType? secondaryType, Sku currentSku, int? autoPauseDelay, BackupStorageRedundancy? currentBackupStorageRedundancy, BackupStorageRedundancy? requestedBackupStorageRedundancy, double? minCapacity, DateTimeOffset? pausedDate, DateTimeOffset? resumedDate, string maintenanceConfigurationId, bool? isLedgerOn, bool? isInfraEncryptionEnabled, Guid? federatedClientId, Guid? primaryDelegatedIdentityClientId) : base(id, name, type, location, tags) { Sku = sku; Kind = kind; ManagedBy = managedBy; + Identity = identity; CreateMode = createMode; Collation = collation; MaxSizeBytes = maxSizeBytes; @@ -152,12 +162,20 @@ internal Database(string id, string name, string type, string location, IDiction MaxLogSizeBytes = maxLogSizeBytes; EarliestRestoreDate = earliestRestoreDate; ReadScale = readScale; - ReadReplicaCount = readReplicaCount; + HighAvailabilityReplicaCount = highAvailabilityReplicaCount; + SecondaryType = secondaryType; CurrentSku = currentSku; AutoPauseDelay = autoPauseDelay; + CurrentBackupStorageRedundancy = currentBackupStorageRedundancy; + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; MinCapacity = minCapacity; PausedDate = pausedDate; ResumedDate = resumedDate; + MaintenanceConfigurationId = maintenanceConfigurationId; + IsLedgerOn = isLedgerOn; + IsInfraEncryptionEnabled = isInfraEncryptionEnabled; + FederatedClientId = federatedClientId; + PrimaryDelegatedIdentityClientId = primaryDelegatedIdentityClientId; } /// @@ -190,6 +208,8 @@ internal Database(string id, string name, string type, string location, IDiction public string Kind { get; } /// Resource that manages the database. public string ManagedBy { get; } + /// The Azure Active Directory identity of the database. + public DatabaseIdentity Identity { get; set; } /// /// Specifies the mode of database creation. /// @@ -272,19 +292,35 @@ internal Database(string id, string name, string type, string location, IDiction public long? MaxLogSizeBytes { get; } /// This records the earliest start date and time that restore is available for this database (ISO8601 format). public DateTimeOffset? EarliestRestoreDate { get; } - /// If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. + /// 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. public DatabaseReadScale? ReadScale { get; set; } - /// The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases. - public int? ReadReplicaCount { get; set; } + /// The number of secondary replicas associated with the database that are used to provide high availability. + public int? HighAvailabilityReplicaCount { get; set; } + /// The secondary type of the database if it is a secondary. Valid values are Geo and Named. + public SecondaryType? SecondaryType { get; set; } /// The name and tier of the SKU. public Sku CurrentSku { get; } /// Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. public int? AutoPauseDelay { get; set; } + /// The storage account type used to store backups for this database. + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + /// The storage account type to be used to store backups for this database. + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Minimal capacity that database will always have allocated, if not paused. public double? MinCapacity { get; set; } - /// The date when database was paused by user configuration or action (ISO8601 format). Null if the database is ready. + /// The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. public DateTimeOffset? PausedDate { get; } /// The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. public DateTimeOffset? ResumedDate { get; } + /// Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. + public string MaintenanceConfigurationId { get; set; } + /// 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. + public bool? IsLedgerOn { get; set; } + /// Infra encryption is enabled for this database. + public bool? IsInfraEncryptionEnabled { get; } + /// The Client id used for cross tenant per database CMK scenario. + public Guid? FederatedClientId { get; set; } + /// The Primary Delegated Identity Client id used for per database CMK - for internal use only. + public Guid? PrimaryDelegatedIdentityClientId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.Serialization.cs index 10db97355165d..b615807990fe1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.Serialization.cs @@ -19,21 +19,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("properties"); writer.WriteStartObject(); - if (Optional.IsDefined(State)) - { - writer.WritePropertyName("state"); - writer.WriteStringValue(State.Value.ToSerialString()); - } - if (Optional.IsDefined(StorageEndpoint)) - { - writer.WritePropertyName("storageEndpoint"); - writer.WriteStringValue(StorageEndpoint); - } - if (Optional.IsDefined(StorageAccountAccessKey)) - { - writer.WritePropertyName("storageAccountAccessKey"); - writer.WriteStringValue(StorageAccountAccessKey); - } if (Optional.IsDefined(RetentionDays)) { writer.WritePropertyName("retentionDays"); @@ -49,11 +34,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (Optional.IsDefined(StorageAccountSubscriptionId)) - { - writer.WritePropertyName("storageAccountSubscriptionId"); - writer.WriteStringValue(StorageAccountSubscriptionId.Value); - } if (Optional.IsDefined(IsStorageSecondaryKeyInUse)) { writer.WritePropertyName("isStorageSecondaryKeyInUse"); @@ -69,6 +49,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queueDelayMs"); writer.WriteNumberValue(QueueDelayMs.Value); } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToSerialString()); + } + if (Optional.IsDefined(StorageEndpoint)) + { + writer.WritePropertyName("storageEndpoint"); + writer.WriteStringValue(StorageEndpoint); + } + if (Optional.IsDefined(StorageAccountAccessKey)) + { + writer.WritePropertyName("storageAccountAccessKey"); + writer.WriteStringValue(StorageAccountAccessKey); + } + if (Optional.IsDefined(StorageAccountSubscriptionId)) + { + writer.WritePropertyName("storageAccountSubscriptionId"); + writer.WriteStringValue(StorageAccountSubscriptionId.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -79,15 +79,15 @@ internal static DatabaseBlobAuditingPolicy DeserializeDatabaseBlobAuditingPolicy Optional id = default; Optional name = default; Optional type = default; - Optional state = default; - Optional storageEndpoint = default; - Optional storageAccountAccessKey = default; Optional retentionDays = default; Optional> auditActionsAndGroups = default; - Optional storageAccountSubscriptionId = default; Optional isStorageSecondaryKeyInUse = default; Optional isAzureMonitorTargetEnabled = default; Optional queueDelayMs = default; + Optional state = default; + Optional storageEndpoint = default; + Optional storageAccountAccessKey = default; + Optional storageAccountSubscriptionId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind")) @@ -119,26 +119,6 @@ internal static DatabaseBlobAuditingPolicy DeserializeDatabaseBlobAuditingPolicy } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("state")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - state = property0.Value.GetString().ToBlobAuditingPolicyState(); - continue; - } - if (property0.NameEquals("storageEndpoint")) - { - storageEndpoint = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("storageAccountAccessKey")) - { - storageAccountAccessKey = property0.Value.GetString(); - continue; - } if (property0.NameEquals("retentionDays")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -164,51 +144,71 @@ internal static DatabaseBlobAuditingPolicy DeserializeDatabaseBlobAuditingPolicy auditActionsAndGroups = array; continue; } - if (property0.NameEquals("storageAccountSubscriptionId")) + if (property0.NameEquals("isStorageSecondaryKeyInUse")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - storageAccountSubscriptionId = property0.Value.GetGuid(); + isStorageSecondaryKeyInUse = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("isStorageSecondaryKeyInUse")) + if (property0.NameEquals("isAzureMonitorTargetEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - isStorageSecondaryKeyInUse = property0.Value.GetBoolean(); + isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("isAzureMonitorTargetEnabled")) + if (property0.NameEquals("queueDelayMs")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); + queueDelayMs = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("queueDelayMs")) + if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - queueDelayMs = property0.Value.GetInt32(); + state = property0.Value.GetString().ToBlobAuditingPolicyState(); + continue; + } + if (property0.NameEquals("storageEndpoint")) + { + storageEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountAccessKey")) + { + storageAccountAccessKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountSubscriptionId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + storageAccountSubscriptionId = property0.Value.GetGuid(); continue; } } continue; } } - return new DatabaseBlobAuditingPolicy(id.Value, name.Value, type.Value, kind.Value, Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(storageAccountSubscriptionId), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs)); + return new DatabaseBlobAuditingPolicy(id.Value, name.Value, type.Value, kind.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs index fc86863883ddd..58d7fab130257 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs @@ -25,21 +25,6 @@ public DatabaseBlobAuditingPolicy() /// Resource name. /// Resource type. /// Resource kind. - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - /// 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). - /// /// Specifies the number of days to keep in the audit logs in the storage account. /// /// Specifies the Actions-Groups and Actions to audit. @@ -156,12 +141,11 @@ public DatabaseBlobAuditingPolicy() /// /// 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). /// - /// Specifies the blob storage subscription Id. /// Specifies whether storageAccountAccessKey value is the storage's secondary key. /// /// 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. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// /// @@ -188,27 +172,9 @@ public DatabaseBlobAuditingPolicy() /// /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// - internal DatabaseBlobAuditingPolicy(string id, string name, string type, string kind, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, IList auditActionsAndGroups, Guid? storageAccountSubscriptionId, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs) : base(id, name, type) - { - Kind = kind; - State = state; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; - RetentionDays = retentionDays; - AuditActionsAndGroups = auditActionsAndGroups; - StorageAccountSubscriptionId = storageAccountSubscriptionId; - IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; - IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; - QueueDelayMs = queueDelayMs; - } - - /// Resource kind. - public string Kind { get; } - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - public BlobAuditingPolicyState? State { get; set; } - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - public string StorageEndpoint { get; set; } - /// + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + /// /// 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. @@ -220,8 +186,24 @@ internal DatabaseBlobAuditingPolicy(string id, string name, string type, string /// 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). - /// - public string StorageAccountAccessKey { get; set; } + /// + /// Specifies the blob storage subscription Id. + internal DatabaseBlobAuditingPolicy(string id, string name, string type, string kind, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, type) + { + Kind = kind; + RetentionDays = retentionDays; + AuditActionsAndGroups = auditActionsAndGroups; + IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + QueueDelayMs = queueDelayMs; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; + } + + /// Resource kind. + public string Kind { get; } /// Specifies the number of days to keep in the audit logs in the storage account. public int? RetentionDays { get; set; } /// @@ -340,14 +322,12 @@ internal DatabaseBlobAuditingPolicy(string id, string name, string type, string /// 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). /// public IList AuditActionsAndGroups { get; } - /// Specifies the blob storage subscription Id. - public Guid? StorageAccountSubscriptionId { get; set; } /// Specifies whether storageAccountAccessKey value is the storage's secondary key. public bool? IsStorageSecondaryKeyInUse { get; set; } /// /// Specifies whether audit events are sent to Azure Monitor. /// - /// In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// /// @@ -376,5 +356,25 @@ internal DatabaseBlobAuditingPolicy(string id, string name, string type, string /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// public int? QueueDelayMs { get; set; } + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + public BlobAuditingPolicyState? State { get; set; } + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + public string StorageEndpoint { get; set; } + /// + /// 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). + /// + public string StorageAccountAccessKey { get; set; } + /// Specifies the blob storage subscription Id. + public Guid? StorageAccountSubscriptionId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumn.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumn.Serialization.cs new file mode 100644 index 0000000000000..d6951562f7bf4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumn.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DatabaseColumn : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(ColumnType)) + { + writer.WritePropertyName("columnType"); + writer.WriteStringValue(ColumnType.Value.ToString()); + } + if (Optional.IsDefined(TemporalType)) + { + writer.WritePropertyName("temporalType"); + writer.WriteStringValue(TemporalType.Value.ToString()); + } + if (Optional.IsDefined(MemoryOptimized)) + { + writer.WritePropertyName("memoryOptimized"); + writer.WriteBooleanValue(MemoryOptimized.Value); + } + if (Optional.IsDefined(IsComputed)) + { + writer.WritePropertyName("isComputed"); + writer.WriteBooleanValue(IsComputed.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DatabaseColumn DeserializeDatabaseColumn(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional columnType = default; + Optional temporalType = default; + Optional memoryOptimized = default; + Optional isComputed = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("columnType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + columnType = new ColumnDataType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("temporalType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + temporalType = new TableTemporalType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("memoryOptimized")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + memoryOptimized = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("isComputed")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isComputed = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + } + return new DatabaseColumn(id.Value, name.Value, type.Value, Optional.ToNullable(columnType), Optional.ToNullable(temporalType), Optional.ToNullable(memoryOptimized), Optional.ToNullable(isComputed)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumn.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumn.cs new file mode 100644 index 0000000000000..a1de1a093c9b2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumn.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A database column resource. + public partial class DatabaseColumn : ProxyResource + { + /// Initializes a new instance of DatabaseColumn. + public DatabaseColumn() + { + } + + /// Initializes a new instance of DatabaseColumn. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The column data type. + /// The table temporal type. + /// Whether or not the column belongs to a memory optimized table. + /// Whether or not the column is computed. + internal DatabaseColumn(string id, string name, string type, ColumnDataType? columnType, TableTemporalType? temporalType, bool? memoryOptimized, bool? isComputed) : base(id, name, type) + { + ColumnType = columnType; + TemporalType = temporalType; + MemoryOptimized = memoryOptimized; + IsComputed = isComputed; + } + + /// The column data type. + public ColumnDataType? ColumnType { get; set; } + /// The table temporal type. + public TableTemporalType? TemporalType { get; set; } + /// Whether or not the column belongs to a memory optimized table. + public bool? MemoryOptimized { get; set; } + /// Whether or not the column is computed. + public bool? IsComputed { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumnListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumnListResult.Serialization.cs new file mode 100644 index 0000000000000..7cfc9b443bda0 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumnListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class DatabaseColumnListResult + { + internal static DatabaseColumnListResult DeserializeDatabaseColumnListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseColumn.DeserializeDatabaseColumn(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DatabaseColumnListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumnListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumnListResult.cs new file mode 100644 index 0000000000000..9f8fde5c09c3c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseColumnListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of database columns. + internal partial class DatabaseColumnListResult + { + /// Initializes a new instance of DatabaseColumnListResult. + internal DatabaseColumnListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseColumnListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal DatabaseColumnListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseEdition.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseEdition.cs deleted file mode 100644 index 31b725946f03f..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseEdition.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// - /// The edition for the database being created. - /// - /// - /// - /// 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> - /// - /// ```` - /// - /// . - /// - public readonly partial struct DatabaseEdition : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public DatabaseEdition(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string WebValue = "Web"; - private const string BusinessValue = "Business"; - private const string BasicValue = "Basic"; - private const string StandardValue = "Standard"; - private const string PremiumValue = "Premium"; - private const string PremiumRSValue = "PremiumRS"; - private const string FreeValue = "Free"; - private const string StretchValue = "Stretch"; - private const string DataWarehouseValue = "DataWarehouse"; - private const string SystemValue = "System"; - private const string System2Value = "System2"; - private const string GeneralPurposeValue = "GeneralPurpose"; - private const string BusinessCriticalValue = "BusinessCritical"; - private const string HyperscaleValue = "Hyperscale"; - - /// Web. - public static DatabaseEdition Web { get; } = new DatabaseEdition(WebValue); - /// Business. - public static DatabaseEdition Business { get; } = new DatabaseEdition(BusinessValue); - /// Basic. - public static DatabaseEdition Basic { get; } = new DatabaseEdition(BasicValue); - /// Standard. - public static DatabaseEdition Standard { get; } = new DatabaseEdition(StandardValue); - /// Premium. - public static DatabaseEdition Premium { get; } = new DatabaseEdition(PremiumValue); - /// PremiumRS. - public static DatabaseEdition PremiumRS { get; } = new DatabaseEdition(PremiumRSValue); - /// Free. - public static DatabaseEdition Free { get; } = new DatabaseEdition(FreeValue); - /// Stretch. - public static DatabaseEdition Stretch { get; } = new DatabaseEdition(StretchValue); - /// DataWarehouse. - public static DatabaseEdition DataWarehouse { get; } = new DatabaseEdition(DataWarehouseValue); - /// System. - public static DatabaseEdition System { get; } = new DatabaseEdition(SystemValue); - /// System2. - public static DatabaseEdition System2 { get; } = new DatabaseEdition(System2Value); - /// GeneralPurpose. - public static DatabaseEdition GeneralPurpose { get; } = new DatabaseEdition(GeneralPurposeValue); - /// BusinessCritical. - public static DatabaseEdition BusinessCritical { get; } = new DatabaseEdition(BusinessCriticalValue); - /// Hyperscale. - public static DatabaseEdition Hyperscale { get; } = new DatabaseEdition(HyperscaleValue); - /// Determines if two values are the same. - public static bool operator ==(DatabaseEdition left, DatabaseEdition right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DatabaseEdition left, DatabaseEdition right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator DatabaseEdition(string value) => new DatabaseEdition(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DatabaseEdition other && Equals(other); - /// - public bool Equals(DatabaseEdition other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseExtensions.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseExtensions.Serialization.cs new file mode 100644 index 0000000000000..5ff40ca353691 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseExtensions.Serialization.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DatabaseExtensions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(OperationMode)) + { + writer.WritePropertyName("operationMode"); + writer.WriteStringValue(OperationMode.Value.ToString()); + } + if (Optional.IsDefined(StorageKeyType)) + { + writer.WritePropertyName("storageKeyType"); + writer.WriteStringValue(StorageKeyType.Value.ToString()); + } + if (Optional.IsDefined(StorageKey)) + { + writer.WritePropertyName("storageKey"); + writer.WriteStringValue(StorageKey); + } + if (Optional.IsDefined(StorageUri)) + { + writer.WritePropertyName("storageUri"); + writer.WriteStringValue(StorageUri); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DatabaseExtensions DeserializeDatabaseExtensions(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional operationMode = default; + Optional storageKeyType = default; + Optional storageKey = default; + Optional storageUri = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("operationMode")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + operationMode = new OperationMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("storageKeyType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + storageKeyType = new StorageKeyType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("storageKey")) + { + storageKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageUri")) + { + storageUri = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new DatabaseExtensions(id.Value, name.Value, type.Value, Optional.ToNullable(operationMode), Optional.ToNullable(storageKeyType), storageKey.Value, storageUri.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseExtensions.cs new file mode 100644 index 0000000000000..b13aeb7ae15b4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseExtensions.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// An export managed database operation result resource. + public partial class DatabaseExtensions : ProxyResource + { + /// Initializes a new instance of DatabaseExtensions. + public DatabaseExtensions() + { + } + + /// Initializes a new instance of DatabaseExtensions. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Operation Mode. + /// Storage key type. + /// Storage key. + /// Storage Uri. + internal DatabaseExtensions(string id, string name, string type, OperationMode? operationMode, StorageKeyType? storageKeyType, string storageKey, string storageUri) : base(id, name, type) + { + OperationMode = operationMode; + StorageKeyType = storageKeyType; + StorageKey = storageKey; + StorageUri = storageUri; + } + + /// Operation Mode. + public OperationMode? OperationMode { get; set; } + /// Storage key type. + public StorageKeyType? StorageKeyType { get; set; } + /// Storage key. + public string StorageKey { get; set; } + /// Storage Uri. + public string StorageUri { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs new file mode 100644 index 0000000000000..26ae93118f44b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.Serialization.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DatabaseIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToString()); + } + if (Optional.IsCollectionDefined(UserAssignedIdentities)) + { + writer.WritePropertyName("userAssignedIdentities"); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(DelegatedResources)) + { + writer.WritePropertyName("delegatedResources"); + writer.WriteStartObject(); + foreach (var item in DelegatedResources) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static DatabaseIdentity DeserializeDatabaseIdentity(JsonElement element) + { + Optional type = default; + Optional tenantId = default; + Optional> userAssignedIdentities = default; + Optional> delegatedResources = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new DatabaseIdentityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tenantId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("userAssignedIdentities")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, DatabaseUserIdentity.DeserializeDatabaseUserIdentity(property0.Value)); + } + userAssignedIdentities = dictionary; + continue; + } + if (property.NameEquals("delegatedResources")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, Delegation.DeserializeDelegation(property0.Value)); + } + delegatedResources = dictionary; + continue; + } + } + return new DatabaseIdentity(Optional.ToNullable(type), Optional.ToNullable(tenantId), Optional.ToDictionary(userAssignedIdentities), Optional.ToDictionary(delegatedResources)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs new file mode 100644 index 0000000000000..6dfc25d49bf30 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentity.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Azure Active Directory identity configuration for a resource. + public partial class DatabaseIdentity + { + /// Initializes a new instance of DatabaseIdentity. + public DatabaseIdentity() + { + UserAssignedIdentities = new ChangeTrackingDictionary(); + DelegatedResources = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of DatabaseIdentity. + /// The identity type. + /// The Azure Active Directory tenant id. + /// The resource ids of the user assigned identities to use. + /// Resources delegated to the database - Internal Use Only. + internal DatabaseIdentity(DatabaseIdentityType? type, Guid? tenantId, IDictionary userAssignedIdentities, IDictionary delegatedResources) + { + Type = type; + TenantId = tenantId; + UserAssignedIdentities = userAssignedIdentities; + DelegatedResources = delegatedResources; + } + + /// The identity type. + public DatabaseIdentityType? Type { get; set; } + /// The Azure Active Directory tenant id. + public Guid? TenantId { get; } + /// The resource ids of the user assigned identities to use. + public IDictionary UserAssignedIdentities { get; } + /// Resources delegated to the database - Internal Use Only. + public IDictionary DelegatedResources { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentityType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentityType.cs new file mode 100644 index 0000000000000..057cab4986405 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseIdentityType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The identity type. + public readonly partial struct DatabaseIdentityType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public DatabaseIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string UserAssignedValue = "UserAssigned"; + + /// None. + public static DatabaseIdentityType None { get; } = new DatabaseIdentityType(NoneValue); + /// UserAssigned. + public static DatabaseIdentityType UserAssigned { get; } = new DatabaseIdentityType(UserAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseIdentityType left, DatabaseIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseIdentityType left, DatabaseIdentityType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DatabaseIdentityType(string value) => new DatabaseIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseIdentityType other && Equals(other); + /// + public bool Equals(DatabaseIdentityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseReadScale.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseReadScale.cs index 6cb2d315eaa3d..8041e83cf6b88 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseReadScale.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseReadScale.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. + /// 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. public readonly partial struct DatabaseReadScale : IEquatable { private readonly string _value; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchema.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchema.Serialization.cs new file mode 100644 index 0000000000000..fc2c417bd769b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchema.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DatabaseSchema : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static DatabaseSchema DeserializeDatabaseSchema(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new DatabaseSchema(id.Value, name.Value, type.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchema.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchema.cs new file mode 100644 index 0000000000000..08061653f8e4b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchema.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A database schema resource. + public partial class DatabaseSchema : ProxyResource + { + /// Initializes a new instance of DatabaseSchema. + public DatabaseSchema() + { + } + + /// Initializes a new instance of DatabaseSchema. + /// Resource ID. + /// Resource name. + /// Resource type. + internal DatabaseSchema(string id, string name, string type) : base(id, name, type) + { + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchemaListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchemaListResult.Serialization.cs new file mode 100644 index 0000000000000..3bb8d9d072c15 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchemaListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class DatabaseSchemaListResult + { + internal static DatabaseSchemaListResult DeserializeDatabaseSchemaListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseSchema.DeserializeDatabaseSchema(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DatabaseSchemaListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchemaListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchemaListResult.cs new file mode 100644 index 0000000000000..6424be7748bbb --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSchemaListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of database schemas. + internal partial class DatabaseSchemaListResult + { + /// Initializes a new instance of DatabaseSchemaListResult. + internal DatabaseSchemaListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseSchemaListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal DatabaseSchemaListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertListResult.Serialization.cs new file mode 100644 index 0000000000000..6d2abd7caecce --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class DatabaseSecurityAlertListResult + { + internal static DatabaseSecurityAlertListResult DeserializeDatabaseSecurityAlertListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseSecurityAlertPolicy.DeserializeDatabaseSecurityAlertPolicy(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DatabaseSecurityAlertListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertListResult.cs new file mode 100644 index 0000000000000..47d1652d01d2a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of the database's security alert policies. + internal partial class DatabaseSecurityAlertListResult + { + /// Initializes a new instance of DatabaseSecurityAlertListResult. + internal DatabaseSecurityAlertListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseSecurityAlertListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal DatabaseSecurityAlertListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.Serialization.cs index 2202c669bbca9..35e16a9b09f06 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.Serialization.cs @@ -5,6 +5,8 @@ #nullable disable +using System; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -15,11 +17,6 @@ public partial class DatabaseSecurityAlertPolicy : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Location)) - { - writer.WritePropertyName("location"); - writer.WriteStringValue(Location); - } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(State)) @@ -27,20 +24,30 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("state"); writer.WriteStringValue(State.Value.ToSerialString()); } - if (Optional.IsDefined(DisabledAlerts)) + if (Optional.IsCollectionDefined(DisabledAlerts)) { writer.WritePropertyName("disabledAlerts"); - writer.WriteStringValue(DisabledAlerts); + writer.WriteStartArray(); + foreach (var item in DisabledAlerts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); } - if (Optional.IsDefined(EmailAddresses)) + if (Optional.IsCollectionDefined(EmailAddresses)) { writer.WritePropertyName("emailAddresses"); - writer.WriteStringValue(EmailAddresses); + writer.WriteStartArray(); + foreach (var item in EmailAddresses) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); } if (Optional.IsDefined(EmailAccountAdmins)) { writer.WritePropertyName("emailAccountAdmins"); - writer.WriteStringValue(EmailAccountAdmins.Value.ToSerialString()); + writer.WriteBooleanValue(EmailAccountAdmins.Value); } if (Optional.IsDefined(StorageEndpoint)) { @@ -57,40 +64,34 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("retentionDays"); writer.WriteNumberValue(RetentionDays.Value); } - if (Optional.IsDefined(UseServerDefault)) - { - writer.WritePropertyName("useServerDefault"); - writer.WriteStringValue(UseServerDefault.Value.ToSerialString()); - } writer.WriteEndObject(); writer.WriteEndObject(); } internal static DatabaseSecurityAlertPolicy DeserializeDatabaseSecurityAlertPolicy(JsonElement element) { - Optional location = default; - Optional kind = default; + Optional systemData = default; Optional id = default; Optional name = default; Optional type = default; - Optional state = default; - Optional disabledAlerts = default; - Optional emailAddresses = default; - Optional emailAccountAdmins = default; + Optional state = default; + Optional> disabledAlerts = default; + Optional> emailAddresses = default; + Optional emailAccountAdmins = default; Optional storageEndpoint = default; Optional storageAccountAccessKey = default; Optional retentionDays = default; - Optional useServerDefault = default; + Optional creationTime = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("location")) + if (property.NameEquals("systemData")) { - location = property.Value.GetString(); - continue; - } - if (property.NameEquals("kind")) - { - kind = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = SystemData.DeserializeSystemData(property.Value); continue; } if (property.NameEquals("id")) @@ -124,17 +125,37 @@ internal static DatabaseSecurityAlertPolicy DeserializeDatabaseSecurityAlertPoli property0.ThrowNonNullablePropertyIsNull(); continue; } - state = property0.Value.GetString().ToSecurityAlertPolicyState(); + state = property0.Value.GetString().ToSecurityAlertsPolicyState(); continue; } if (property0.NameEquals("disabledAlerts")) { - disabledAlerts = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + disabledAlerts = array; continue; } if (property0.NameEquals("emailAddresses")) { - emailAddresses = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + emailAddresses = array; continue; } if (property0.NameEquals("emailAccountAdmins")) @@ -144,7 +165,7 @@ internal static DatabaseSecurityAlertPolicy DeserializeDatabaseSecurityAlertPoli property0.ThrowNonNullablePropertyIsNull(); continue; } - emailAccountAdmins = property0.Value.GetString().ToSecurityAlertPolicyEmailAccountAdmins(); + emailAccountAdmins = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("storageEndpoint")) @@ -167,21 +188,21 @@ internal static DatabaseSecurityAlertPolicy DeserializeDatabaseSecurityAlertPoli retentionDays = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("useServerDefault")) + if (property0.NameEquals("creationTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - useServerDefault = property0.Value.GetString().ToSecurityAlertPolicyUseServerDefault(); + creationTime = property0.Value.GetDateTimeOffset("O"); continue; } } continue; } } - return new DatabaseSecurityAlertPolicy(id.Value, name.Value, type.Value, location.Value, kind.Value, Optional.ToNullable(state), disabledAlerts.Value, emailAddresses.Value, Optional.ToNullable(emailAccountAdmins), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToNullable(useServerDefault)); + return new DatabaseSecurityAlertPolicy(id.Value, name.Value, type.Value, systemData.Value, Optional.ToNullable(state), Optional.ToList(disabledAlerts), Optional.ToList(emailAddresses), Optional.ToNullable(emailAccountAdmins), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToNullable(creationTime)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs index 54b8c42d0804c..6f3abcb06d4fc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs @@ -5,34 +5,38 @@ #nullable disable +using System; +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.Sql.Models { - /// Contains information about a database Threat Detection policy. + /// A database security alert policy. public partial class DatabaseSecurityAlertPolicy : ProxyResource { /// Initializes a new instance of DatabaseSecurityAlertPolicy. public DatabaseSecurityAlertPolicy() { + DisabledAlerts = new ChangeTrackingList(); + EmailAddresses = new ChangeTrackingList(); } /// Initializes a new instance of DatabaseSecurityAlertPolicy. /// Resource ID. /// Resource name. /// Resource type. - /// The geo-location where the resource lives. - /// Resource kind. - /// Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. - /// Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. - /// Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. + /// SystemData of SecurityAlertPolicyResource. + /// Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. + /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + /// Specifies an array of e-mail addresses to which the alert is sent. /// Specifies that the alert is sent to the account administrators. - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state is Enabled, storageEndpoint is required. - /// Specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + /// Specifies the identifier key of the Threat Detection audit storage account. /// Specifies the number of days to keep in the Threat Detection audit logs. - /// Specifies whether to use the default server policy. - internal DatabaseSecurityAlertPolicy(string id, string name, string type, string location, string kind, SecurityAlertPolicyState? state, string disabledAlerts, string emailAddresses, SecurityAlertPolicyEmailAccountAdmins? emailAccountAdmins, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, SecurityAlertPolicyUseServerDefault? useServerDefault) : base(id, name, type) + /// Specifies the UTC creation time of the policy. + internal DatabaseSecurityAlertPolicy(string id, string name, string type, SystemData systemData, SecurityAlertsPolicyState? state, IList disabledAlerts, IList emailAddresses, bool? emailAccountAdmins, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, DateTimeOffset? creationTime) : base(id, name, type) { - Location = location; - Kind = kind; + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -40,28 +44,26 @@ internal DatabaseSecurityAlertPolicy(string id, string name, string type, string StorageEndpoint = storageEndpoint; StorageAccountAccessKey = storageAccountAccessKey; RetentionDays = retentionDays; - UseServerDefault = useServerDefault; + CreationTime = creationTime; } - /// The geo-location where the resource lives. - public string Location { get; set; } - /// Resource kind. - public string Kind { get; } - /// Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. - public SecurityAlertPolicyState? State { get; set; } - /// Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. - public string DisabledAlerts { get; set; } - /// Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. - public string EmailAddresses { get; set; } + /// SystemData of SecurityAlertPolicyResource. + public SystemData SystemData { get; } + /// Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. + public SecurityAlertsPolicyState? State { get; set; } + /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + public IList DisabledAlerts { get; } + /// Specifies an array of e-mail addresses to which the alert is sent. + public IList EmailAddresses { get; } /// Specifies that the alert is sent to the account administrators. - public SecurityAlertPolicyEmailAccountAdmins? EmailAccountAdmins { get; set; } - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state is Enabled, storageEndpoint is required. + public bool? EmailAccountAdmins { get; set; } + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. public string StorageEndpoint { get; set; } - /// Specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. + /// Specifies the identifier key of the Threat Detection audit storage account. public string StorageAccountAccessKey { get; set; } /// Specifies the number of days to keep in the Threat Detection audit logs. public int? RetentionDays { get; set; } - /// Specifies whether to use the default server policy. - public SecurityAlertPolicyUseServerDefault? UseServerDefault { get; set; } + /// Specifies the UTC creation time of the policy. + public DateTimeOffset? CreationTime { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseStatus.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseStatus.cs index 9c2ff1af6224b..caeea4022118d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseStatus.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseStatus.cs @@ -43,6 +43,9 @@ public DatabaseStatus(string value) private const string OfflineChangingDwPerformanceTiersValue = "OfflineChangingDwPerformanceTiers"; private const string OnlineChangingDwPerformanceTiersValue = "OnlineChangingDwPerformanceTiers"; private const string DisabledValue = "Disabled"; + private const string StoppingValue = "Stopping"; + private const string StoppedValue = "Stopped"; + private const string StartingValue = "Starting"; /// Online. public static DatabaseStatus Online { get; } = new DatabaseStatus(OnlineValue); @@ -86,6 +89,12 @@ public DatabaseStatus(string value) public static DatabaseStatus OnlineChangingDwPerformanceTiers { get; } = new DatabaseStatus(OnlineChangingDwPerformanceTiersValue); /// Disabled. public static DatabaseStatus Disabled { get; } = new DatabaseStatus(DisabledValue); + /// Stopping. + public static DatabaseStatus Stopping { get; } = new DatabaseStatus(StoppingValue); + /// Stopped. + public static DatabaseStatus Stopped { get; } = new DatabaseStatus(StoppedValue); + /// Starting. + public static DatabaseStatus Starting { get; } = new DatabaseStatus(StartingValue); /// Determines if two values are the same. public static bool operator ==(DatabaseStatus left, DatabaseStatus right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivity.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTable.Serialization.cs similarity index 68% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivity.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTable.Serialization.cs index 906225fdcbf2e..52f0a4db1b2c4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivity.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTable.Serialization.cs @@ -10,32 +10,36 @@ namespace Azure.ResourceManager.Sql.Models { - public partial class TransparentDataEncryptionActivity : IUtf8JsonSerializable + public partial class DatabaseTable : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"); writer.WriteStartObject(); + if (Optional.IsDefined(TemporalType)) + { + writer.WritePropertyName("temporalType"); + writer.WriteStringValue(TemporalType.Value.ToString()); + } + if (Optional.IsDefined(MemoryOptimized)) + { + writer.WritePropertyName("memoryOptimized"); + writer.WriteBooleanValue(MemoryOptimized.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } - internal static TransparentDataEncryptionActivity DeserializeTransparentDataEncryptionActivity(JsonElement element) + internal static DatabaseTable DeserializeDatabaseTable(JsonElement element) { - Optional location = default; Optional id = default; Optional name = default; Optional type = default; - Optional status = default; - Optional percentComplete = default; + Optional temporalType = default; + Optional memoryOptimized = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("location")) - { - location = property.Value.GetString(); - continue; - } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -60,31 +64,31 @@ internal static TransparentDataEncryptionActivity DeserializeTransparentDataEncr } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("status")) + if (property0.NameEquals("temporalType")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - status = new TransparentDataEncryptionActivityStatus(property0.Value.GetString()); + temporalType = new TableTemporalType(property0.Value.GetString()); continue; } - if (property0.NameEquals("percentComplete")) + if (property0.NameEquals("memoryOptimized")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - percentComplete = property0.Value.GetSingle(); + memoryOptimized = property0.Value.GetBoolean(); continue; } } continue; } } - return new TransparentDataEncryptionActivity(id.Value, name.Value, type.Value, location.Value, Optional.ToNullable(status), Optional.ToNullable(percentComplete)); + return new DatabaseTable(id.Value, name.Value, type.Value, Optional.ToNullable(temporalType), Optional.ToNullable(memoryOptimized)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTable.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTable.cs new file mode 100644 index 0000000000000..497cbd646cc66 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTable.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A database table resource. + public partial class DatabaseTable : ProxyResource + { + /// Initializes a new instance of DatabaseTable. + public DatabaseTable() + { + } + + /// Initializes a new instance of DatabaseTable. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The table temporal type. + /// Whether or not the table is memory optimized. + internal DatabaseTable(string id, string name, string type, TableTemporalType? temporalType, bool? memoryOptimized) : base(id, name, type) + { + TemporalType = temporalType; + MemoryOptimized = memoryOptimized; + } + + /// The table temporal type. + public TableTemporalType? TemporalType { get; set; } + /// Whether or not the table is memory optimized. + public bool? MemoryOptimized { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTableListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTableListResult.Serialization.cs new file mode 100644 index 0000000000000..5257554281e3b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTableListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class DatabaseTableListResult + { + internal static DatabaseTableListResult DeserializeDatabaseTableListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseTable.DeserializeDatabaseTable(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DatabaseTableListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTableListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTableListResult.cs new file mode 100644 index 0000000000000..eb901113e6f6e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseTableListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of database tables. + internal partial class DatabaseTableListResult + { + /// Initializes a new instance of DatabaseTableListResult. + internal DatabaseTableListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatabaseTableListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal DatabaseTableListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.Serialization.cs index a676dbaf1328d..df305d1e650fb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.Serialization.cs @@ -20,6 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"); @@ -113,21 +118,51 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("readScale"); writer.WriteStringValue(ReadScale.Value.ToString()); } - if (Optional.IsDefined(ReadReplicaCount)) + if (Optional.IsDefined(HighAvailabilityReplicaCount)) + { + writer.WritePropertyName("highAvailabilityReplicaCount"); + writer.WriteNumberValue(HighAvailabilityReplicaCount.Value); + } + if (Optional.IsDefined(SecondaryType)) { - writer.WritePropertyName("readReplicaCount"); - writer.WriteNumberValue(ReadReplicaCount.Value); + writer.WritePropertyName("secondaryType"); + writer.WriteStringValue(SecondaryType.Value.ToString()); } if (Optional.IsDefined(AutoPauseDelay)) { writer.WritePropertyName("autoPauseDelay"); writer.WriteNumberValue(AutoPauseDelay.Value); } + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) + { + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); + } if (Optional.IsDefined(MinCapacity)) { writer.WritePropertyName("minCapacity"); writer.WriteNumberValue(MinCapacity.Value); } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"); + writer.WriteStringValue(MaintenanceConfigurationId); + } + if (Optional.IsDefined(IsLedgerOn)) + { + writer.WritePropertyName("isLedgerOn"); + writer.WriteBooleanValue(IsLedgerOn.Value); + } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"); + writer.WriteStringValue(FederatedClientId.Value); + } + if (Optional.IsDefined(PrimaryDelegatedIdentityClientId)) + { + writer.WritePropertyName("primaryDelegatedIdentityClientId"); + writer.WriteStringValue(PrimaryDelegatedIdentityClientId.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.cs index b6cb4452ab478..58e9315183e10 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUpdate.cs @@ -22,6 +22,8 @@ public DatabaseUpdate() /// The name and tier of the SKU. public Sku Sku { get; set; } + /// Database identity. + public DatabaseIdentity Identity { get; set; } /// Resource tags. public IDictionary Tags { get; } /// @@ -106,19 +108,35 @@ public DatabaseUpdate() public long? MaxLogSizeBytes { get; } /// This records the earliest start date and time that restore is available for this database (ISO8601 format). public DateTimeOffset? EarliestRestoreDate { get; } - /// If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. + /// 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. public DatabaseReadScale? ReadScale { get; set; } - /// The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases. - public int? ReadReplicaCount { get; set; } + /// The number of secondary replicas associated with the database that are used to provide high availability. + public int? HighAvailabilityReplicaCount { get; set; } + /// The secondary type of the database if it is a secondary. Valid values are Geo and Named. + public SecondaryType? SecondaryType { get; set; } /// The name and tier of the SKU. public Sku CurrentSku { get; } /// Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. public int? AutoPauseDelay { get; set; } + /// The storage account type used to store backups for this database. + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + /// The storage account type to be used to store backups for this database. + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } /// Minimal capacity that database will always have allocated, if not paused. public double? MinCapacity { get; set; } - /// The date when database was paused by user configuration or action (ISO8601 format). Null if the database is ready. + /// The date when database was paused by user configuration or action(ISO8601 format). Null if the database is ready. public DateTimeOffset? PausedDate { get; } /// The date when database was resumed by user action or database login (ISO8601 format). Null if the database is paused. public DateTimeOffset? ResumedDate { get; } + /// Maintenance configuration id assigned to the database. This configuration defines the period when the maintenance updates will occur. + public string MaintenanceConfigurationId { get; set; } + /// 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. + public bool? IsLedgerOn { get; set; } + /// Infra encryption is enabled for this database. + public bool? IsInfraEncryptionEnabled { get; } + /// The Client id used for cross tenant per database CMK scenario. + public Guid? FederatedClientId { get; set; } + /// The Primary Delegated Identity Client id used for per database CMK - for internal use only. + public Guid? PrimaryDelegatedIdentityClientId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsage.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsage.Serialization.cs index cfb342e0c41ce..16b4083bf4c36 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsage.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsage.Serialization.cs @@ -5,77 +5,92 @@ #nullable disable -using System; using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.Sql.Models { - public partial class DatabaseUsage + public partial class DatabaseUsage : IUtf8JsonSerializable { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + internal static DatabaseUsage DeserializeDatabaseUsage(JsonElement element) { + Optional id = default; Optional name = default; - Optional resourceName = default; + Optional type = default; Optional displayName = default; Optional currentValue = default; Optional limit = default; Optional unit = default; - Optional nextResetTime = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("resourceName")) + if (property.NameEquals("id")) { - resourceName = property.Value.GetString(); + id = property.Value.GetString(); continue; } - if (property.NameEquals("displayName")) + if (property.NameEquals("name")) { - displayName = property.Value.GetString(); + name = property.Value.GetString(); continue; } - if (property.NameEquals("currentValue")) + if (property.NameEquals("type")) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - currentValue = property.Value.GetDouble(); + type = property.Value.GetString(); continue; } - if (property.NameEquals("limit")) + if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } - limit = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("unit")) - { - unit = property.Value.GetString(); - continue; - } - if (property.NameEquals("nextResetTime")) - { - if (property.Value.ValueKind == JsonValueKind.Null) + foreach (var property0 in property.Value.EnumerateObject()) { - property.ThrowNonNullablePropertyIsNull(); - continue; + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("currentValue")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + currentValue = property0.Value.GetDouble(); + continue; + } + if (property0.NameEquals("limit")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + limit = property0.Value.GetDouble(); + continue; + } + if (property0.NameEquals("unit")) + { + unit = property0.Value.GetString(); + continue; + } } - nextResetTime = property.Value.GetDateTimeOffset("O"); continue; } } - return new DatabaseUsage(name.Value, resourceName.Value, displayName.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), unit.Value, Optional.ToNullable(nextResetTime)); + return new DatabaseUsage(id.Value, name.Value, type.Value, displayName.Value, Optional.ToNullable(currentValue), Optional.ToNullable(limit), unit.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsage.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsage.cs index a6c99bf28885c..6ed888179c9c3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsage.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsage.cs @@ -5,50 +5,39 @@ #nullable disable -using System; - namespace Azure.ResourceManager.Sql.Models { - /// The database usages. - public partial class DatabaseUsage + /// Usage metric of a database. + public partial class DatabaseUsage : ProxyResource { /// Initializes a new instance of DatabaseUsage. - internal DatabaseUsage() + public DatabaseUsage() { } /// Initializes a new instance of DatabaseUsage. - /// The name of the usage metric. - /// The name of the resource. - /// The usage metric display name. - /// The current value of the usage metric. - /// The current limit of the usage metric. - /// The units of the usage metric. - /// The next reset time for the usage metric (ISO8601 format). - internal DatabaseUsage(string name, string resourceName, string displayName, double? currentValue, double? limit, string unit, DateTimeOffset? nextResetTime) + /// Resource ID. + /// Resource name. + /// Resource type. + /// User-readable name of the metric. + /// Current value of the metric. + /// Boundary value of the metric. + /// Unit of the metric. + internal DatabaseUsage(string id, string name, string type, string displayName, double? currentValue, double? limit, string unit) : base(id, name, type) { - Name = name; - ResourceName = resourceName; DisplayName = displayName; CurrentValue = currentValue; Limit = limit; Unit = unit; - NextResetTime = nextResetTime; } - /// The name of the usage metric. - public string Name { get; } - /// The name of the resource. - public string ResourceName { get; } - /// The usage metric display name. + /// User-readable name of the metric. public string DisplayName { get; } - /// The current value of the usage metric. + /// Current value of the metric. public double? CurrentValue { get; } - /// The current limit of the usage metric. + /// Boundary value of the metric. public double? Limit { get; } - /// The units of the usage metric. + /// Unit of the metric. public string Unit { get; } - /// The next reset time for the usage metric (ISO8601 format). - public DateTimeOffset? NextResetTime { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsageListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsageListResult.Serialization.cs index 5e43ec1868715..874fb7a826ffa 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsageListResult.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsageListResult.Serialization.cs @@ -15,11 +15,17 @@ internal partial class DatabaseUsageListResult { internal static DatabaseUsageListResult DeserializeDatabaseUsageListResult(JsonElement element) { - IReadOnlyList value = default; + Optional> value = default; + Optional nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -28,8 +34,13 @@ internal static DatabaseUsageListResult DeserializeDatabaseUsageListResult(JsonE value = array; continue; } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } } - return new DatabaseUsageListResult(value); + return new DatabaseUsageListResult(Optional.ToList(value), nextLink.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsageListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsageListResult.cs index 8f7bba093a04d..093dd7f553b97 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsageListResult.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUsageListResult.cs @@ -5,36 +5,32 @@ #nullable disable -using System; using System.Collections.Generic; -using System.Linq; +using Azure.Core; namespace Azure.ResourceManager.Sql.Models { - /// The response to a list database metrics request. + /// A list of database usage metrics. internal partial class DatabaseUsageListResult { /// Initializes a new instance of DatabaseUsageListResult. - /// The list of database usages for the database. - /// is null. - internal DatabaseUsageListResult(IEnumerable value) + internal DatabaseUsageListResult() { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - - Value = value.ToList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of DatabaseUsageListResult. - /// The list of database usages for the database. - internal DatabaseUsageListResult(IReadOnlyList value) + /// Array of results. + /// Link to retrieve next page of results. + internal DatabaseUsageListResult(IReadOnlyList value, string nextLink) { Value = value; + NextLink = nextLink; } - /// The list of database usages for the database. + /// Array of results. public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUserIdentity.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUserIdentity.Serialization.cs new file mode 100644 index 0000000000000..8f88e9b1c7c91 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUserIdentity.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DatabaseUserIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static DatabaseUserIdentity DeserializeDatabaseUserIdentity(JsonElement element) + { + Optional principalId = default; + Optional clientId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + principalId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("clientId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clientId = property.Value.GetGuid(); + continue; + } + } + return new DatabaseUserIdentity(Optional.ToNullable(principalId), Optional.ToNullable(clientId)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUserIdentity.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUserIdentity.cs new file mode 100644 index 0000000000000..9ac06e3b970f4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseUserIdentity.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Azure Active Directory identity configuration for a resource. + public partial class DatabaseUserIdentity + { + /// Initializes a new instance of DatabaseUserIdentity. + public DatabaseUserIdentity() + { + } + + /// Initializes a new instance of DatabaseUserIdentity. + /// The Azure Active Directory principal id. + /// The Azure Active Directory client id. + internal DatabaseUserIdentity(Guid? principalId, Guid? clientId) + { + PrincipalId = principalId; + ClientId = clientId; + } + + /// The Azure Active Directory principal id. + public Guid? PrincipalId { get; } + /// The Azure Active Directory client id. + public Guid? ClientId { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs index 032eaf61fab2d..f4f0219c21722 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs @@ -20,7 +20,7 @@ public DatabaseVulnerabilityAssessment() /// Resource name. /// Resource type. /// 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. - /// A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + /// 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. /// Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. /// The recurring scans settings. internal DatabaseVulnerabilityAssessment(string id, string name, string type, string storageContainerPath, string storageContainerSasKey, string storageAccountAccessKey, VulnerabilityAssessmentRecurringScansProperties recurringScans) : base(id, name, type) @@ -33,7 +33,7 @@ internal DatabaseVulnerabilityAssessment(string id, string name, string type, st /// 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. public string StorageContainerPath { get; set; } - /// A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + /// 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. public string StorageContainerSasKey { get; set; } /// Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. public string StorageAccountAccessKey { get; set; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DayOfWeek.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DayOfWeek.cs new file mode 100644 index 0000000000000..2c2a62e3f344e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DayOfWeek.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Day of maintenance window. + public readonly partial struct DayOfWeek : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public DayOfWeek(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SundayValue = "Sunday"; + private const string MondayValue = "Monday"; + private const string TuesdayValue = "Tuesday"; + private const string WednesdayValue = "Wednesday"; + private const string ThursdayValue = "Thursday"; + private const string FridayValue = "Friday"; + private const string SaturdayValue = "Saturday"; + + /// Sunday. + public static DayOfWeek Sunday { get; } = new DayOfWeek(SundayValue); + /// Monday. + public static DayOfWeek Monday { get; } = new DayOfWeek(MondayValue); + /// Tuesday. + public static DayOfWeek Tuesday { get; } = new DayOfWeek(TuesdayValue); + /// Wednesday. + public static DayOfWeek Wednesday { get; } = new DayOfWeek(WednesdayValue); + /// Thursday. + public static DayOfWeek Thursday { get; } = new DayOfWeek(ThursdayValue); + /// Friday. + public static DayOfWeek Friday { get; } = new DayOfWeek(FridayValue); + /// Saturday. + public static DayOfWeek Saturday { get; } = new DayOfWeek(SaturdayValue); + /// Determines if two values are the same. + public static bool operator ==(DayOfWeek left, DayOfWeek right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DayOfWeek left, DayOfWeek right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DayOfWeek(string value) => new DayOfWeek(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DayOfWeek other && Equals(other); + /// + public bool Equals(DayOfWeek other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.Serialization.cs new file mode 100644 index 0000000000000..fbf22ed21450d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class Delegation : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"); + writer.WriteStringValue(ResourceId); + } + writer.WriteEndObject(); + } + + internal static Delegation DeserializeDelegation(JsonElement element) + { + Optional resourceId = default; + Optional tenantId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId")) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tenantId = property.Value.GetGuid(); + continue; + } + } + return new Delegation(resourceId.Value, Optional.ToNullable(tenantId)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.cs new file mode 100644 index 0000000000000..f70659e503036 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Delegation.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Delegated Resource Properties - Internal Use Only. + public partial class Delegation + { + /// Initializes a new instance of Delegation. + public Delegation() + { + } + + /// Initializes a new instance of Delegation. + /// The resource id of the source resource - Internal Use Only. + /// AAD tenant guid of the source resource identity - Internal Use Only. + internal Delegation(string resourceId, Guid? tenantId) + { + ResourceId = resourceId; + TenantId = tenantId; + } + + /// The resource id of the source resource - Internal Use Only. + public string ResourceId { get; set; } + /// AAD tenant guid of the source resource identity - Internal Use Only. + public Guid? TenantId { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServer.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServer.Serialization.cs new file mode 100644 index 0000000000000..76733f0613428 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServer.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class DeletedServer : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DeletedServer DeserializeDeletedServer(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional version = default; + Optional deletionTime = default; + Optional originalId = default; + Optional fullyQualifiedDomainName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("version")) + { + version = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("deletionTime")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + deletionTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("originalId")) + { + originalId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("fullyQualifiedDomainName")) + { + fullyQualifiedDomainName = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new DeletedServer(id.Value, name.Value, type.Value, version.Value, Optional.ToNullable(deletionTime), originalId.Value, fullyQualifiedDomainName.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServer.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServer.cs new file mode 100644 index 0000000000000..8693865603987 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServer.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A deleted server. + public partial class DeletedServer : ProxyResource + { + /// Initializes a new instance of DeletedServer. + public DeletedServer() + { + } + + /// Initializes a new instance of DeletedServer. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The version of the deleted server. + /// The deletion time of the deleted server. + /// The original ID of the server before deletion. + /// The fully qualified domain name of the server. + internal DeletedServer(string id, string name, string type, string version, DateTimeOffset? deletionTime, string originalId, string fullyQualifiedDomainName) : base(id, name, type) + { + Version = version; + DeletionTime = deletionTime; + OriginalId = originalId; + FullyQualifiedDomainName = fullyQualifiedDomainName; + } + + /// The version of the deleted server. + public string Version { get; } + /// The deletion time of the deleted server. + public DateTimeOffset? DeletionTime { get; } + /// The original ID of the server before deletion. + public string OriginalId { get; } + /// The fully qualified domain name of the server. + public string FullyQualifiedDomainName { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServerListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServerListResult.Serialization.cs new file mode 100644 index 0000000000000..4d9107bfc7b35 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServerListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class DeletedServerListResult + { + internal static DeletedServerListResult DeserializeDeletedServerListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeletedServer.DeserializeDeletedServer(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DeletedServerListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServerListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServerListResult.cs new file mode 100644 index 0000000000000..e71d7e47f3f0d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DeletedServerListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of deleted servers. + internal partial class DeletedServerListResult + { + /// Initializes a new instance of DeletedServerListResult. + internal DeletedServerListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DeletedServerListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal DeletedServerListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DnsRefreshConfigurationPropertiesStatus.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DnsRefreshConfigurationPropertiesStatus.cs new file mode 100644 index 0000000000000..17d3a468d6a98 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DnsRefreshConfigurationPropertiesStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The status of the DNS refresh operation. + public readonly partial struct DnsRefreshConfigurationPropertiesStatus : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public DnsRefreshConfigurationPropertiesStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + + /// Succeeded. + public static DnsRefreshConfigurationPropertiesStatus Succeeded { get; } = new DnsRefreshConfigurationPropertiesStatus(SucceededValue); + /// Failed. + public static DnsRefreshConfigurationPropertiesStatus Failed { get; } = new DnsRefreshConfigurationPropertiesStatus(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(DnsRefreshConfigurationPropertiesStatus left, DnsRefreshConfigurationPropertiesStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsRefreshConfigurationPropertiesStatus left, DnsRefreshConfigurationPropertiesStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DnsRefreshConfigurationPropertiesStatus(string value) => new DnsRefreshConfigurationPropertiesStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DnsRefreshConfigurationPropertiesStatus other && Equals(other); + /// + public bool Equals(DnsRefreshConfigurationPropertiesStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPool.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPool.Serialization.cs index 1fd624654e18b..f376f3937dc6d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPool.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPool.Serialization.cs @@ -57,6 +57,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("licenseType"); writer.WriteStringValue(LicenseType.Value.ToString()); } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"); + writer.WriteStringValue(MaintenanceConfigurationId); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -76,6 +81,7 @@ internal static ElasticPool DeserializeElasticPool(JsonElement element) Optional perDatabaseSettings = default; Optional zoneRedundant = default; Optional licenseType = default; + Optional maintenanceConfigurationId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) @@ -197,11 +203,16 @@ internal static ElasticPool DeserializeElasticPool(JsonElement element) licenseType = new ElasticPoolLicenseType(property0.Value.GetString()); continue; } + if (property0.NameEquals("maintenanceConfigurationId")) + { + maintenanceConfigurationId = property0.Value.GetString(); + continue; + } } continue; } } - return new ElasticPool(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), sku.Value, kind.Value, Optional.ToNullable(state), Optional.ToNullable(creationDate), Optional.ToNullable(maxSizeBytes), perDatabaseSettings.Value, Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType)); + return new ElasticPool(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), sku.Value, kind.Value, Optional.ToNullable(state), Optional.ToNullable(creationDate), Optional.ToNullable(maxSizeBytes), perDatabaseSettings.Value, Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType), maintenanceConfigurationId.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPool.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPool.cs index 8403eca016462..a951d13eded96 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPool.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPool.cs @@ -54,7 +54,8 @@ public ElasticPool(string location) : base(location) /// The per database settings for the elastic pool. /// Whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. /// The license type to apply for this elastic pool. - internal ElasticPool(string id, string name, string type, string location, IDictionary tags, Sku sku, string kind, ElasticPoolState? state, DateTimeOffset? creationDate, long? maxSizeBytes, ElasticPoolPerDatabaseSettings perDatabaseSettings, bool? zoneRedundant, ElasticPoolLicenseType? licenseType) : base(id, name, type, location, tags) + /// Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. + internal ElasticPool(string id, string name, string type, string location, IDictionary tags, Sku sku, string kind, ElasticPoolState? state, DateTimeOffset? creationDate, long? maxSizeBytes, ElasticPoolPerDatabaseSettings perDatabaseSettings, bool? zoneRedundant, ElasticPoolLicenseType? licenseType, string maintenanceConfigurationId) : base(id, name, type, location, tags) { Sku = sku; Kind = kind; @@ -64,6 +65,7 @@ internal ElasticPool(string id, string name, string type, string location, IDict PerDatabaseSettings = perDatabaseSettings; ZoneRedundant = zoneRedundant; LicenseType = licenseType; + MaintenanceConfigurationId = maintenanceConfigurationId; } /// @@ -98,5 +100,7 @@ internal ElasticPool(string id, string name, string type, string location, IDict public bool? ZoneRedundant { get; set; } /// The license type to apply for this elastic pool. public ElasticPoolLicenseType? LicenseType { get; set; } + /// Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. + public string MaintenanceConfigurationId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolEdition.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolEdition.cs deleted file mode 100644 index dc471fa17f0bf..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolEdition.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. - public readonly partial struct ElasticPoolEdition : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ElasticPoolEdition(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string BasicValue = "Basic"; - private const string StandardValue = "Standard"; - private const string PremiumValue = "Premium"; - private const string GeneralPurposeValue = "GeneralPurpose"; - private const string BusinessCriticalValue = "BusinessCritical"; - - /// Basic. - public static ElasticPoolEdition Basic { get; } = new ElasticPoolEdition(BasicValue); - /// Standard. - public static ElasticPoolEdition Standard { get; } = new ElasticPoolEdition(StandardValue); - /// Premium. - public static ElasticPoolEdition Premium { get; } = new ElasticPoolEdition(PremiumValue); - /// GeneralPurpose. - public static ElasticPoolEdition GeneralPurpose { get; } = new ElasticPoolEdition(GeneralPurposeValue); - /// BusinessCritical. - public static ElasticPoolEdition BusinessCritical { get; } = new ElasticPoolEdition(BusinessCriticalValue); - /// Determines if two values are the same. - public static bool operator ==(ElasticPoolEdition left, ElasticPoolEdition right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ElasticPoolEdition left, ElasticPoolEdition right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ElasticPoolEdition(string value) => new ElasticPoolEdition(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ElasticPoolEdition other && Equals(other); - /// - public bool Equals(ElasticPoolEdition other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPerformanceLevelCapability.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPerformanceLevelCapability.Serialization.cs index 88022dd0d9b61..28a89198144a4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPerformanceLevelCapability.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPerformanceLevelCapability.Serialization.cs @@ -24,6 +24,7 @@ internal static ElasticPoolPerformanceLevelCapability DeserializeElasticPoolPerf Optional> supportedPerDatabaseMaxSizes = default; Optional> supportedPerDatabaseMaxPerformanceLevels = default; Optional zoneRedundant = default; + Optional> supportedMaintenanceConfigurations = default; Optional status = default; Optional reason = default; foreach (var property in element.EnumerateObject()) @@ -138,6 +139,21 @@ internal static ElasticPoolPerformanceLevelCapability DeserializeElasticPoolPerf zoneRedundant = property.Value.GetBoolean(); continue; } + if (property.NameEquals("supportedMaintenanceConfigurations")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MaintenanceConfigurationCapability.DeserializeMaintenanceConfigurationCapability(item)); + } + supportedMaintenanceConfigurations = array; + continue; + } if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -154,7 +170,7 @@ internal static ElasticPoolPerformanceLevelCapability DeserializeElasticPoolPerf continue; } } - return new ElasticPoolPerformanceLevelCapability(performanceLevel.Value, sku.Value, Optional.ToList(supportedLicenseTypes), Optional.ToNullable(maxDatabaseCount), includedMaxSize.Value, Optional.ToList(supportedMaxSizes), Optional.ToList(supportedPerDatabaseMaxSizes), Optional.ToList(supportedPerDatabaseMaxPerformanceLevels), Optional.ToNullable(zoneRedundant), Optional.ToNullable(status), reason.Value); + return new ElasticPoolPerformanceLevelCapability(performanceLevel.Value, sku.Value, Optional.ToList(supportedLicenseTypes), Optional.ToNullable(maxDatabaseCount), includedMaxSize.Value, Optional.ToList(supportedMaxSizes), Optional.ToList(supportedPerDatabaseMaxSizes), Optional.ToList(supportedPerDatabaseMaxPerformanceLevels), Optional.ToNullable(zoneRedundant), Optional.ToList(supportedMaintenanceConfigurations), Optional.ToNullable(status), reason.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPerformanceLevelCapability.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPerformanceLevelCapability.cs index 8c7803dd8be57..4588393aa484e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPerformanceLevelCapability.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolPerformanceLevelCapability.cs @@ -20,6 +20,7 @@ internal ElasticPoolPerformanceLevelCapability() SupportedMaxSizes = new ChangeTrackingList(); SupportedPerDatabaseMaxSizes = new ChangeTrackingList(); SupportedPerDatabaseMaxPerformanceLevels = new ChangeTrackingList(); + SupportedMaintenanceConfigurations = new ChangeTrackingList(); } /// Initializes a new instance of ElasticPoolPerformanceLevelCapability. @@ -32,9 +33,10 @@ internal ElasticPoolPerformanceLevelCapability() /// The list of supported per database max sizes. /// The list of supported per database max performance levels. /// Whether or not zone redundancy is supported for the performance level. + /// List of supported maintenance configurations. /// The status of the capability. /// The reason for the capability not being available. - internal ElasticPoolPerformanceLevelCapability(PerformanceLevelCapability performanceLevel, Sku sku, IReadOnlyList supportedLicenseTypes, int? maxDatabaseCount, MaxSizeCapability includedMaxSize, IReadOnlyList supportedMaxSizes, IReadOnlyList supportedPerDatabaseMaxSizes, IReadOnlyList supportedPerDatabaseMaxPerformanceLevels, bool? zoneRedundant, CapabilityStatus? status, string reason) + internal ElasticPoolPerformanceLevelCapability(PerformanceLevelCapability performanceLevel, Sku sku, IReadOnlyList supportedLicenseTypes, int? maxDatabaseCount, MaxSizeCapability includedMaxSize, IReadOnlyList supportedMaxSizes, IReadOnlyList supportedPerDatabaseMaxSizes, IReadOnlyList supportedPerDatabaseMaxPerformanceLevels, bool? zoneRedundant, IReadOnlyList supportedMaintenanceConfigurations, CapabilityStatus? status, string reason) { PerformanceLevel = performanceLevel; Sku = sku; @@ -45,6 +47,7 @@ internal ElasticPoolPerformanceLevelCapability(PerformanceLevelCapability perfor SupportedPerDatabaseMaxSizes = supportedPerDatabaseMaxSizes; SupportedPerDatabaseMaxPerformanceLevels = supportedPerDatabaseMaxPerformanceLevels; ZoneRedundant = zoneRedundant; + SupportedMaintenanceConfigurations = supportedMaintenanceConfigurations; Status = status; Reason = reason; } @@ -67,6 +70,8 @@ internal ElasticPoolPerformanceLevelCapability(PerformanceLevelCapability perfor public IReadOnlyList SupportedPerDatabaseMaxPerformanceLevels { get; } /// Whether or not zone redundancy is supported for the performance level. public bool? ZoneRedundant { get; } + /// List of supported maintenance configurations. + public IReadOnlyList SupportedMaintenanceConfigurations { get; } /// The status of the capability. public CapabilityStatus? Status { get; } /// The reason for the capability not being available. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.Serialization.cs index a8f429442111f..f20d8fd217905 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.Serialization.cs @@ -53,6 +53,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("licenseType"); writer.WriteStringValue(LicenseType.Value.ToString()); } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"); + writer.WriteStringValue(MaintenanceConfigurationId); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.cs index 7033c54a8fd01..4809ffd2e0a7a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ElasticPoolUpdate.cs @@ -31,5 +31,7 @@ public ElasticPoolUpdate() public bool? ZoneRedundant { get; set; } /// The license type to apply for this elastic pool. public ElasticPoolLicenseType? LicenseType { get; set; } + /// Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. + public string MaintenanceConfigurationId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EncryptionProtector.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EncryptionProtector.Serialization.cs index a02849922a165..a467930f9a7a4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EncryptionProtector.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EncryptionProtector.Serialization.cs @@ -27,6 +27,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("serverKeyType"); writer.WriteStringValue(ServerKeyType.Value.ToString()); } + if (Optional.IsDefined(AutoRotationEnabled)) + { + writer.WritePropertyName("autoRotationEnabled"); + writer.WriteBooleanValue(AutoRotationEnabled.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -43,6 +48,7 @@ internal static EncryptionProtector DeserializeEncryptionProtector(JsonElement e Optional serverKeyType = default; Optional uri = default; Optional thumbprint = default; + Optional autoRotationEnabled = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind")) @@ -109,11 +115,21 @@ internal static EncryptionProtector DeserializeEncryptionProtector(JsonElement e thumbprint = property0.Value.GetString(); continue; } + if (property0.NameEquals("autoRotationEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + autoRotationEnabled = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new EncryptionProtector(id.Value, name.Value, type.Value, kind.Value, location.Value, subregion.Value, serverKeyName.Value, Optional.ToNullable(serverKeyType), uri.Value, thumbprint.Value); + return new EncryptionProtector(id.Value, name.Value, type.Value, kind.Value, location.Value, subregion.Value, serverKeyName.Value, Optional.ToNullable(serverKeyType), uri.Value, thumbprint.Value, Optional.ToNullable(autoRotationEnabled)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EncryptionProtector.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EncryptionProtector.cs index 30f1fde5540ca..0189516b6b79c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EncryptionProtector.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/EncryptionProtector.cs @@ -26,7 +26,8 @@ public EncryptionProtector() /// The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. /// The URI of the server key. /// Thumbprint of the server key. - internal EncryptionProtector(string id, string name, string type, string kind, string location, string subregion, string serverKeyName, ServerKeyType? serverKeyType, string uri, string thumbprint) : base(id, name, type) + /// Key auto rotation opt-in flag. Either true or false. + internal EncryptionProtector(string id, string name, string type, string kind, string location, string subregion, string serverKeyName, ServerKeyType? serverKeyType, string uri, string thumbprint, bool? autoRotationEnabled) : base(id, name, type) { Kind = kind; Location = location; @@ -35,6 +36,7 @@ internal EncryptionProtector(string id, string name, string type, string kind, s ServerKeyType = serverKeyType; Uri = uri; Thumbprint = thumbprint; + AutoRotationEnabled = autoRotationEnabled; } /// Kind of encryption protector. This is metadata used for the Azure portal experience. @@ -51,5 +53,7 @@ internal EncryptionProtector(string id, string name, string type, string kind, s public string Uri { get; } /// Thumbprint of the server key. public string Thumbprint { get; } + /// Key auto rotation opt-in flag. Either true or false. + public bool? AutoRotationEnabled { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Enum65.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Enum60.cs similarity index 59% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Enum65.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Enum60.cs index 2f32439011004..555180c919b6a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Enum65.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Enum60.cs @@ -10,14 +10,14 @@ namespace Azure.ResourceManager.Sql.Models { - /// The Enum65. - public readonly partial struct Enum65 : IEquatable + /// The Enum60. + public readonly partial struct Enum60 : IEquatable { private readonly string _value; - /// Determines if two values are the same. + /// Determines if two values are the same. /// is null. - public Enum65(string value) + public Enum60(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -28,25 +28,25 @@ public Enum65(string value) private const string SuccessValue = "Success"; /// All. - public static Enum65 All { get; } = new Enum65(AllValue); + public static Enum60 All { get; } = new Enum60(AllValue); /// Error. - public static Enum65 Error { get; } = new Enum65(ErrorValue); + public static Enum60 Error { get; } = new Enum60(ErrorValue); /// Warning. - public static Enum65 Warning { get; } = new Enum65(WarningValue); + public static Enum60 Warning { get; } = new Enum60(WarningValue); /// Success. - public static Enum65 Success { get; } = new Enum65(SuccessValue); - /// Determines if two values are the same. - public static bool operator ==(Enum65 left, Enum65 right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(Enum65 left, Enum65 right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator Enum65(string value) => new Enum65(value); + public static Enum60 Success { get; } = new Enum60(SuccessValue); + /// Determines if two values are the same. + public static bool operator ==(Enum60 left, Enum60 right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Enum60 left, Enum60 right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator Enum60(string value) => new Enum60(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is Enum65 other && Equals(other); + public override bool Equals(object obj) => obj is Enum60 other && Equals(other); /// - public bool Equals(Enum65 other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(Enum60 other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportDatabaseDefinition.Serialization.cs similarity index 72% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionProperties.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportDatabaseDefinition.Serialization.cs index 0efdd5c78e6af..a296415cefc2c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionProperties.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportDatabaseDefinition.Serialization.cs @@ -10,15 +10,13 @@ namespace Azure.ResourceManager.Sql.Models { - public partial class ImportExtensionProperties : IUtf8JsonSerializable + public partial class ExportDatabaseDefinition : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("operationMode"); - writer.WriteStringValue(OperationMode); writer.WritePropertyName("storageKeyType"); - writer.WriteStringValue(StorageKeyType.ToSerialString()); + writer.WriteStringValue(StorageKeyType.ToString()); writer.WritePropertyName("storageKey"); writer.WriteStringValue(StorageKey); writer.WritePropertyName("storageUri"); @@ -30,7 +28,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AuthenticationType)) { writer.WritePropertyName("authenticationType"); - writer.WriteStringValue(AuthenticationType.Value.ToSerialString()); + writer.WriteStringValue(AuthenticationType); + } + if (Optional.IsDefined(NetworkIsolation)) + { + writer.WritePropertyName("networkIsolation"); + writer.WriteObjectValue(NetworkIsolation); } writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportRequest.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportDatabaseDefinition.cs similarity index 52% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportRequest.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportDatabaseDefinition.cs index c260eb3dc4d64..820e6b2608387 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportRequest.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportDatabaseDefinition.cs @@ -9,17 +9,17 @@ namespace Azure.ResourceManager.Sql.Models { - /// Export database parameters. - public partial class ExportRequest + /// Contains the information necessary to perform export database operation. + public partial class ExportDatabaseDefinition { - /// Initializes a new instance of ExportRequest. - /// The type of the storage key to use. - /// The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". - /// The storage uri to use. - /// The name of the SQL administrator. - /// The password of the SQL administrator. + /// Initializes a new instance of ExportDatabaseDefinition. + /// Storage key type. + /// Storage key. + /// Storage Uri. + /// Administrator login name. + /// Administrator login password. /// , , , or is null. - public ExportRequest(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword) + public ExportDatabaseDefinition(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword) { if (storageKey == null) { @@ -45,17 +45,19 @@ public ExportRequest(StorageKeyType storageKeyType, string storageKey, string st AdministratorLoginPassword = administratorLoginPassword; } - /// The type of the storage key to use. + /// Storage key type. public StorageKeyType StorageKeyType { get; } - /// The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + /// Storage key. public string StorageKey { get; } - /// The storage uri to use. + /// Storage Uri. public string StorageUri { get; } - /// The name of the SQL administrator. + /// Administrator login name. public string AdministratorLogin { get; } - /// The password of the SQL administrator. + /// Administrator login password. public string AdministratorLoginPassword { get; } - /// The authentication type. - public AuthenticationType? AuthenticationType { get; set; } + /// Authentication type. + public string AuthenticationType { get; set; } + /// Optional resource information to enable network isolation for request. + public NetworkIsolationSettings NetworkIsolation { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.Serialization.cs index cb645c4ce5684..dee698f944d35 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.Serialization.cs @@ -24,21 +24,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("predicateExpression"); writer.WriteStringValue(PredicateExpression); } - if (Optional.IsDefined(State)) - { - writer.WritePropertyName("state"); - writer.WriteStringValue(State.Value.ToSerialString()); - } - if (Optional.IsDefined(StorageEndpoint)) - { - writer.WritePropertyName("storageEndpoint"); - writer.WriteStringValue(StorageEndpoint); - } - if (Optional.IsDefined(StorageAccountAccessKey)) - { - writer.WritePropertyName("storageAccountAccessKey"); - writer.WriteStringValue(StorageAccountAccessKey); - } if (Optional.IsDefined(RetentionDays)) { writer.WritePropertyName("retentionDays"); @@ -54,11 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (Optional.IsDefined(StorageAccountSubscriptionId)) - { - writer.WritePropertyName("storageAccountSubscriptionId"); - writer.WriteStringValue(StorageAccountSubscriptionId.Value); - } if (Optional.IsDefined(IsStorageSecondaryKeyInUse)) { writer.WritePropertyName("isStorageSecondaryKeyInUse"); @@ -74,6 +54,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queueDelayMs"); writer.WriteNumberValue(QueueDelayMs.Value); } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToSerialString()); + } + if (Optional.IsDefined(StorageEndpoint)) + { + writer.WritePropertyName("storageEndpoint"); + writer.WriteStringValue(StorageEndpoint); + } + if (Optional.IsDefined(StorageAccountAccessKey)) + { + writer.WritePropertyName("storageAccountAccessKey"); + writer.WriteStringValue(StorageAccountAccessKey); + } + if (Optional.IsDefined(StorageAccountSubscriptionId)) + { + writer.WritePropertyName("storageAccountSubscriptionId"); + writer.WriteStringValue(StorageAccountSubscriptionId.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -84,15 +84,15 @@ internal static ExtendedDatabaseBlobAuditingPolicy DeserializeExtendedDatabaseBl Optional name = default; Optional type = default; Optional predicateExpression = default; - Optional state = default; - Optional storageEndpoint = default; - Optional storageAccountAccessKey = default; Optional retentionDays = default; Optional> auditActionsAndGroups = default; - Optional storageAccountSubscriptionId = default; Optional isStorageSecondaryKeyInUse = default; Optional isAzureMonitorTargetEnabled = default; Optional queueDelayMs = default; + Optional state = default; + Optional storageEndpoint = default; + Optional storageAccountAccessKey = default; + Optional storageAccountSubscriptionId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -124,26 +124,6 @@ internal static ExtendedDatabaseBlobAuditingPolicy DeserializeExtendedDatabaseBl predicateExpression = property0.Value.GetString(); continue; } - if (property0.NameEquals("state")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - state = property0.Value.GetString().ToBlobAuditingPolicyState(); - continue; - } - if (property0.NameEquals("storageEndpoint")) - { - storageEndpoint = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("storageAccountAccessKey")) - { - storageAccountAccessKey = property0.Value.GetString(); - continue; - } if (property0.NameEquals("retentionDays")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -169,51 +149,71 @@ internal static ExtendedDatabaseBlobAuditingPolicy DeserializeExtendedDatabaseBl auditActionsAndGroups = array; continue; } - if (property0.NameEquals("storageAccountSubscriptionId")) + if (property0.NameEquals("isStorageSecondaryKeyInUse")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - storageAccountSubscriptionId = property0.Value.GetGuid(); + isStorageSecondaryKeyInUse = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("isStorageSecondaryKeyInUse")) + if (property0.NameEquals("isAzureMonitorTargetEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - isStorageSecondaryKeyInUse = property0.Value.GetBoolean(); + isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("isAzureMonitorTargetEnabled")) + if (property0.NameEquals("queueDelayMs")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); + queueDelayMs = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("queueDelayMs")) + if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - queueDelayMs = property0.Value.GetInt32(); + state = property0.Value.GetString().ToBlobAuditingPolicyState(); + continue; + } + if (property0.NameEquals("storageEndpoint")) + { + storageEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountAccessKey")) + { + storageAccountAccessKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountSubscriptionId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + storageAccountSubscriptionId = property0.Value.GetGuid(); continue; } } continue; } } - return new ExtendedDatabaseBlobAuditingPolicy(id.Value, name.Value, type.Value, predicateExpression.Value, Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(storageAccountSubscriptionId), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs)); + return new ExtendedDatabaseBlobAuditingPolicy(id.Value, name.Value, type.Value, predicateExpression.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs index b58362b6cf0dd..dfdd8adb5a0cd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs @@ -25,21 +25,6 @@ public ExtendedDatabaseBlobAuditingPolicy() /// Resource name. /// Resource type. /// Specifies condition of where clause when creating an audit. - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - /// 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). - /// /// Specifies the number of days to keep in the audit logs in the storage account. /// /// Specifies the Actions-Groups and Actions to audit. @@ -156,12 +141,11 @@ public ExtendedDatabaseBlobAuditingPolicy() /// /// 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). /// - /// Specifies the blob storage subscription Id. /// Specifies whether storageAccountAccessKey value is the storage's secondary key. /// /// 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. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// /// @@ -188,27 +172,9 @@ public ExtendedDatabaseBlobAuditingPolicy() /// /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// - internal ExtendedDatabaseBlobAuditingPolicy(string id, string name, string type, string predicateExpression, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, IList auditActionsAndGroups, Guid? storageAccountSubscriptionId, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs) : base(id, name, type) - { - PredicateExpression = predicateExpression; - State = state; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; - RetentionDays = retentionDays; - AuditActionsAndGroups = auditActionsAndGroups; - StorageAccountSubscriptionId = storageAccountSubscriptionId; - IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; - IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; - QueueDelayMs = queueDelayMs; - } - - /// Specifies condition of where clause when creating an audit. - public string PredicateExpression { get; set; } - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - public BlobAuditingPolicyState? State { get; set; } - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - public string StorageEndpoint { get; set; } - /// + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + /// /// 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. @@ -220,8 +186,24 @@ internal ExtendedDatabaseBlobAuditingPolicy(string id, string name, string type, /// 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). - /// - public string StorageAccountAccessKey { get; set; } + /// + /// Specifies the blob storage subscription Id. + internal ExtendedDatabaseBlobAuditingPolicy(string id, string name, string type, string predicateExpression, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, type) + { + PredicateExpression = predicateExpression; + RetentionDays = retentionDays; + AuditActionsAndGroups = auditActionsAndGroups; + IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + QueueDelayMs = queueDelayMs; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; + } + + /// Specifies condition of where clause when creating an audit. + public string PredicateExpression { get; set; } /// Specifies the number of days to keep in the audit logs in the storage account. public int? RetentionDays { get; set; } /// @@ -340,14 +322,12 @@ internal ExtendedDatabaseBlobAuditingPolicy(string id, string name, string type, /// 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). /// public IList AuditActionsAndGroups { get; } - /// Specifies the blob storage subscription Id. - public Guid? StorageAccountSubscriptionId { get; set; } /// Specifies whether storageAccountAccessKey value is the storage's secondary key. public bool? IsStorageSecondaryKeyInUse { get; set; } /// /// Specifies whether audit events are sent to Azure Monitor. /// - /// In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// /// @@ -376,5 +356,25 @@ internal ExtendedDatabaseBlobAuditingPolicy(string id, string name, string type, /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// public int? QueueDelayMs { get; set; } + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + public BlobAuditingPolicyState? State { get; set; } + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + public string StorageEndpoint { get; set; } + /// + /// 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). + /// + public string StorageAccountAccessKey { get; set; } + /// Specifies the blob storage subscription Id. + public Guid? StorageAccountSubscriptionId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.Serialization.cs index 37aae6488ef1e..c081844114456 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.Serialization.cs @@ -19,26 +19,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("properties"); writer.WriteStartObject(); + if (Optional.IsDefined(IsDevopsAuditEnabled)) + { + writer.WritePropertyName("isDevopsAuditEnabled"); + writer.WriteBooleanValue(IsDevopsAuditEnabled.Value); + } if (Optional.IsDefined(PredicateExpression)) { writer.WritePropertyName("predicateExpression"); writer.WriteStringValue(PredicateExpression); } - if (Optional.IsDefined(State)) - { - writer.WritePropertyName("state"); - writer.WriteStringValue(State.Value.ToSerialString()); - } - if (Optional.IsDefined(StorageEndpoint)) - { - writer.WritePropertyName("storageEndpoint"); - writer.WriteStringValue(StorageEndpoint); - } - if (Optional.IsDefined(StorageAccountAccessKey)) - { - writer.WritePropertyName("storageAccountAccessKey"); - writer.WriteStringValue(StorageAccountAccessKey); - } if (Optional.IsDefined(RetentionDays)) { writer.WritePropertyName("retentionDays"); @@ -54,11 +44,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (Optional.IsDefined(StorageAccountSubscriptionId)) - { - writer.WritePropertyName("storageAccountSubscriptionId"); - writer.WriteStringValue(StorageAccountSubscriptionId.Value); - } if (Optional.IsDefined(IsStorageSecondaryKeyInUse)) { writer.WritePropertyName("isStorageSecondaryKeyInUse"); @@ -74,6 +59,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queueDelayMs"); writer.WriteNumberValue(QueueDelayMs.Value); } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToSerialString()); + } + if (Optional.IsDefined(StorageEndpoint)) + { + writer.WritePropertyName("storageEndpoint"); + writer.WriteStringValue(StorageEndpoint); + } + if (Optional.IsDefined(StorageAccountAccessKey)) + { + writer.WritePropertyName("storageAccountAccessKey"); + writer.WriteStringValue(StorageAccountAccessKey); + } + if (Optional.IsDefined(StorageAccountSubscriptionId)) + { + writer.WritePropertyName("storageAccountSubscriptionId"); + writer.WriteStringValue(StorageAccountSubscriptionId.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -83,16 +88,17 @@ internal static ExtendedServerBlobAuditingPolicy DeserializeExtendedServerBlobAu Optional id = default; Optional name = default; Optional type = default; + Optional isDevopsAuditEnabled = default; Optional predicateExpression = default; - Optional state = default; - Optional storageEndpoint = default; - Optional storageAccountAccessKey = default; Optional retentionDays = default; Optional> auditActionsAndGroups = default; - Optional storageAccountSubscriptionId = default; Optional isStorageSecondaryKeyInUse = default; Optional isAzureMonitorTargetEnabled = default; Optional queueDelayMs = default; + Optional state = default; + Optional storageEndpoint = default; + Optional storageAccountAccessKey = default; + Optional storageAccountSubscriptionId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -119,29 +125,19 @@ internal static ExtendedServerBlobAuditingPolicy DeserializeExtendedServerBlobAu } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("predicateExpression")) - { - predicateExpression = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("state")) + if (property0.NameEquals("isDevopsAuditEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - state = property0.Value.GetString().ToBlobAuditingPolicyState(); + isDevopsAuditEnabled = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("storageEndpoint")) - { - storageEndpoint = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("storageAccountAccessKey")) + if (property0.NameEquals("predicateExpression")) { - storageAccountAccessKey = property0.Value.GetString(); + predicateExpression = property0.Value.GetString(); continue; } if (property0.NameEquals("retentionDays")) @@ -169,51 +165,71 @@ internal static ExtendedServerBlobAuditingPolicy DeserializeExtendedServerBlobAu auditActionsAndGroups = array; continue; } - if (property0.NameEquals("storageAccountSubscriptionId")) + if (property0.NameEquals("isStorageSecondaryKeyInUse")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - storageAccountSubscriptionId = property0.Value.GetGuid(); + isStorageSecondaryKeyInUse = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("isStorageSecondaryKeyInUse")) + if (property0.NameEquals("isAzureMonitorTargetEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - isStorageSecondaryKeyInUse = property0.Value.GetBoolean(); + isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("isAzureMonitorTargetEnabled")) + if (property0.NameEquals("queueDelayMs")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); + queueDelayMs = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("queueDelayMs")) + if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - queueDelayMs = property0.Value.GetInt32(); + state = property0.Value.GetString().ToBlobAuditingPolicyState(); + continue; + } + if (property0.NameEquals("storageEndpoint")) + { + storageEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountAccessKey")) + { + storageAccountAccessKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountSubscriptionId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + storageAccountSubscriptionId = property0.Value.GetGuid(); continue; } } continue; } } - return new ExtendedServerBlobAuditingPolicy(id.Value, name.Value, type.Value, predicateExpression.Value, Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(storageAccountSubscriptionId), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs)); + return new ExtendedServerBlobAuditingPolicy(id.Value, name.Value, type.Value, Optional.ToNullable(isDevopsAuditEnabled), predicateExpression.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs index 7c17e8bd21f0a..740f48be59a71 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs @@ -24,22 +24,30 @@ public ExtendedServerBlobAuditingPolicy() /// Resource ID. /// Resource name. /// Resource type. - /// Specifies condition of where clause when creating an audit. - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - /// Specifies the identifier key of the auditing storage account. + /// + /// Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. /// - /// If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true /// - /// 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. + /// When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs category on the master database should also be created. /// - /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + /// + /// + /// 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) + /// + /// . /// + /// Specifies condition of where clause when creating an audit. /// Specifies the number of days to keep in the audit logs in the storage account. /// /// Specifies the Actions-Groups and Actions to audit. @@ -156,12 +164,11 @@ public ExtendedServerBlobAuditingPolicy() /// /// 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). /// - /// Specifies the blob storage subscription Id. /// Specifies whether storageAccountAccessKey value is the storage's secondary key. /// /// 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. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// /// @@ -188,40 +195,63 @@ public ExtendedServerBlobAuditingPolicy() /// /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// - internal ExtendedServerBlobAuditingPolicy(string id, string name, string type, string predicateExpression, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, IList auditActionsAndGroups, Guid? storageAccountSubscriptionId, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs) : base(id, name, type) + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + /// 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). + /// + /// Specifies the blob storage subscription Id. + internal ExtendedServerBlobAuditingPolicy(string id, string name, string type, bool? isDevopsAuditEnabled, string predicateExpression, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, type) { + IsDevopsAuditEnabled = isDevopsAuditEnabled; PredicateExpression = predicateExpression; - State = state; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; RetentionDays = retentionDays; AuditActionsAndGroups = auditActionsAndGroups; - StorageAccountSubscriptionId = storageAccountSubscriptionId; IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; } - /// Specifies condition of where clause when creating an audit. - public string PredicateExpression { get; set; } - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - public BlobAuditingPolicyState? State { get; set; } - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - public string StorageEndpoint { get; set; } /// - /// Specifies the identifier key of the auditing storage account. + /// Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. /// - /// If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true /// - /// 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. + /// When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs category on the master database should also be created. /// - /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + /// + /// + /// 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) + /// + /// . /// - public string StorageAccountAccessKey { get; set; } + public bool? IsDevopsAuditEnabled { get; set; } + /// Specifies condition of where clause when creating an audit. + public string PredicateExpression { get; set; } /// Specifies the number of days to keep in the audit logs in the storage account. public int? RetentionDays { get; set; } /// @@ -340,14 +370,12 @@ internal ExtendedServerBlobAuditingPolicy(string id, string name, string type, s /// 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). /// public IList AuditActionsAndGroups { get; } - /// Specifies the blob storage subscription Id. - public Guid? StorageAccountSubscriptionId { get; set; } /// Specifies whether storageAccountAccessKey value is the storage's secondary key. public bool? IsStorageSecondaryKeyInUse { get; set; } /// /// Specifies whether audit events are sent to Azure Monitor. /// - /// In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// /// @@ -376,5 +404,25 @@ internal ExtendedServerBlobAuditingPolicy(string id, string name, string type, s /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// public int? QueueDelayMs { get; set; } + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + public BlobAuditingPolicyState? State { get; set; } + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + public string StorageEndpoint { get; set; } + /// + /// 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). + /// + public string StorageAccountAccessKey { get; set; } + /// Specifies the blob storage subscription Id. + public Guid? StorageAccountSubscriptionId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtensionName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtensionName.cs deleted file mode 100644 index 6e7327bd42b23..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExtensionName.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The ExtensionName. - public readonly partial struct ExtensionName : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ExtensionName(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ImportValue = "import"; - - /// import. - public static ExtensionName Import { get; } = new ExtensionName(ImportValue); - /// Determines if two values are the same. - public static bool operator ==(ExtensionName left, ExtensionName right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ExtensionName left, ExtensionName right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ExtensionName(string value) => new ExtensionName(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ExtensionName other && Equals(other); - /// - public bool Equals(ExtensionName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRule.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRule.Serialization.cs index cd95c8f48ee41..10d15d3eb6549 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRule.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRule.Serialization.cs @@ -15,6 +15,11 @@ public partial class FirewallRule : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(StartIpAddress)) @@ -33,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static FirewallRule DeserializeFirewallRule(JsonElement element) { - Optional kind = default; - Optional location = default; Optional id = default; Optional name = default; Optional type = default; @@ -42,16 +45,6 @@ internal static FirewallRule DeserializeFirewallRule(JsonElement element) Optional endIpAddress = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kind")) - { - kind = property.Value.GetString(); - continue; - } - if (property.NameEquals("location")) - { - location = property.Value.GetString(); - continue; - } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -90,7 +83,7 @@ internal static FirewallRule DeserializeFirewallRule(JsonElement element) continue; } } - return new FirewallRule(id.Value, name.Value, type.Value, kind.Value, location.Value, startIpAddress.Value, endIpAddress.Value); + return new FirewallRule(id.Value, name.Value, type.Value, startIpAddress.Value, endIpAddress.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRule.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRule.cs index 843f8cd411eed..7686505fdde7d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRule.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRule.cs @@ -7,8 +7,8 @@ namespace Azure.ResourceManager.Sql.Models { - /// Represents a server firewall rule. - public partial class FirewallRule : ProxyResource + /// A server firewall rule. + public partial class FirewallRule : ProxyResourceWithWritableName { /// Initializes a new instance of FirewallRule. public FirewallRule() @@ -19,25 +19,17 @@ public FirewallRule() /// Resource ID. /// Resource name. /// Resource type. - /// Kind of server that contains this firewall rule. - /// Location of the server that contains this firewall rule. - /// The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. - /// The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. - internal FirewallRule(string id, string name, string type, string kind, string location, string startIpAddress, string endIpAddress) : base(id, name, type) + /// The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' for all Azure-internal IP addresses. + /// 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. + internal FirewallRule(string id, string name, string type, string startIpAddress, string endIpAddress) : base(id, name, type) { - Kind = kind; - Location = location; StartIpAddress = startIpAddress; EndIpAddress = endIpAddress; } - /// Kind of server that contains this firewall rule. - public string Kind { get; } - /// Location of the server that contains this firewall rule. - public string Location { get; } - /// The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + /// The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' for all Azure-internal IP addresses. public string StartIpAddress { get; set; } - /// The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + /// 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. public string EndIpAddress { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleList.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleList.Serialization.cs new file mode 100644 index 0000000000000..5b0e9aeb09b1e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleList.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class FirewallRuleList : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleList.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleList.cs new file mode 100644 index 0000000000000..501edc4d8d614 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleList.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of server firewall rules. + public partial class FirewallRuleList + { + /// Initializes a new instance of FirewallRuleList. + public FirewallRuleList() + { + Values = new ChangeTrackingList(); + } + + public IList Values { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleListResult.Serialization.cs index 8a3a9e9cc83a9..623178f87302c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleListResult.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleListResult.Serialization.cs @@ -16,6 +16,7 @@ internal partial class FirewallRuleListResult internal static FirewallRuleListResult DeserializeFirewallRuleListResult(JsonElement element) { Optional> value = default; + Optional nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) @@ -33,8 +34,13 @@ internal static FirewallRuleListResult DeserializeFirewallRuleListResult(JsonEle value = array; continue; } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } } - return new FirewallRuleListResult(Optional.ToList(value)); + return new FirewallRuleListResult(Optional.ToList(value), nextLink.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleListResult.cs index f95918d86f70f..384a466ca40bd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleListResult.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FirewallRuleListResult.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// Represents the response to a List Firewall Rules request. + /// The response to a list firewall rules request. internal partial class FirewallRuleListResult { /// Initializes a new instance of FirewallRuleListResult. @@ -20,13 +20,17 @@ internal FirewallRuleListResult() } /// Initializes a new instance of FirewallRuleListResult. - /// The list of server firewall rules. - internal FirewallRuleListResult(IReadOnlyList value) + /// Array of results. + /// Link to retrieve next page of results. + internal FirewallRuleListResult(IReadOnlyList value, string nextLink) { Value = value; + NextLink = nextLink; } - /// The list of server firewall rules. + /// Array of results. public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IdentityType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IdentityType.cs index 5fefa2bbc82b7..da0b395ec5cbe 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IdentityType.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IdentityType.cs @@ -22,10 +22,19 @@ public IdentityType(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } + private const string NoneValue = "None"; private const string SystemAssignedValue = "SystemAssigned"; + private const string UserAssignedValue = "UserAssigned"; + private const string SystemAssignedUserAssignedValue = "SystemAssigned,UserAssigned"; + /// None. + public static IdentityType None { get; } = new IdentityType(NoneValue); /// SystemAssigned. public static IdentityType SystemAssigned { get; } = new IdentityType(SystemAssignedValue); + /// UserAssigned. + public static IdentityType UserAssigned { get; } = new IdentityType(UserAssignedValue); + /// SystemAssigned,UserAssigned. + public static IdentityType SystemAssignedUserAssigned { get; } = new IdentityType(SystemAssignedUserAssignedValue); /// Determines if two values are the same. public static bool operator ==(IdentityType left, IdentityType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImplementationMethod.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImplementationMethod.Serialization.cs new file mode 100644 index 0000000000000..1b4902f7298a7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImplementationMethod.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class ImplementationMethodExtensions + { + public static string ToSerialString(this ImplementationMethod value) => value switch + { + ImplementationMethod.TSql => "TSql", + ImplementationMethod.AzurePowerShell => "AzurePowerShell", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ImplementationMethod value.") + }; + + public static ImplementationMethod ToImplementationMethod(this string value) + { + if (string.Equals(value, "TSql", StringComparison.InvariantCultureIgnoreCase)) return ImplementationMethod.TSql; + if (string.Equals(value, "AzurePowerShell", StringComparison.InvariantCultureIgnoreCase)) return ImplementationMethod.AzurePowerShell; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ImplementationMethod value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImplementationMethod.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImplementationMethod.cs new file mode 100644 index 0000000000000..a9f45a95da48b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImplementationMethod.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Gets the method in which this recommended action can be manually implemented. e.g., TSql, AzurePowerShell. + public enum ImplementationMethod + { + /// TSql. + TSql, + /// AzurePowerShell. + AzurePowerShell + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportRequest.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExistingDatabaseDefinition.Serialization.cs similarity index 72% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportRequest.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExistingDatabaseDefinition.Serialization.cs index 3200803bb24db..e0912d7953f48 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ExportRequest.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExistingDatabaseDefinition.Serialization.cs @@ -10,13 +10,13 @@ namespace Azure.ResourceManager.Sql.Models { - public partial class ExportRequest : IUtf8JsonSerializable + public partial class ImportExistingDatabaseDefinition : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("storageKeyType"); - writer.WriteStringValue(StorageKeyType.ToSerialString()); + writer.WriteStringValue(StorageKeyType.ToString()); writer.WritePropertyName("storageKey"); writer.WriteStringValue(StorageKey); writer.WritePropertyName("storageUri"); @@ -28,7 +28,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AuthenticationType)) { writer.WritePropertyName("authenticationType"); - writer.WriteStringValue(AuthenticationType.Value.ToSerialString()); + writer.WriteStringValue(AuthenticationType); + } + if (Optional.IsDefined(NetworkIsolation)) + { + writer.WritePropertyName("networkIsolation"); + writer.WriteObjectValue(NetworkIsolation); } writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExistingDatabaseDefinition.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExistingDatabaseDefinition.cs new file mode 100644 index 0000000000000..6d5cf866aa9bf --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExistingDatabaseDefinition.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains the information necessary to perform import operation for existing database. + public partial class ImportExistingDatabaseDefinition + { + /// Initializes a new instance of ImportExistingDatabaseDefinition. + /// Storage key type. + /// Storage key. + /// Storage Uri. + /// Administrator login name. + /// Administrator login password. + /// , , , or is null. + public ImportExistingDatabaseDefinition(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword) + { + if (storageKey == null) + { + throw new ArgumentNullException(nameof(storageKey)); + } + if (storageUri == null) + { + throw new ArgumentNullException(nameof(storageUri)); + } + if (administratorLogin == null) + { + throw new ArgumentNullException(nameof(administratorLogin)); + } + if (administratorLoginPassword == null) + { + throw new ArgumentNullException(nameof(administratorLoginPassword)); + } + + StorageKeyType = storageKeyType; + StorageKey = storageKey; + StorageUri = storageUri; + AdministratorLogin = administratorLogin; + AdministratorLoginPassword = administratorLoginPassword; + } + + /// Storage key type. + public StorageKeyType StorageKeyType { get; } + /// Storage key. + public string StorageKey { get; } + /// Storage Uri. + public string StorageUri { get; } + /// Administrator login name. + public string AdministratorLogin { get; } + /// Administrator login password. + public string AdministratorLoginPassword { get; } + /// Authentication type. + public string AuthenticationType { get; set; } + /// Optional resource information to enable network isolation for request. + public NetworkIsolationSettings NetworkIsolation { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationListResult.Serialization.cs new file mode 100644 index 0000000000000..33e9a9f21569b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ImportExportExtensionsOperationListResult + { + internal static ImportExportExtensionsOperationListResult DeserializeImportExportExtensionsOperationListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ImportExportExtensionsOperationResult.DeserializeImportExportExtensionsOperationResult(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ImportExportExtensionsOperationListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationListResult.cs new file mode 100644 index 0000000000000..8bf6d312076c4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Import export operation extensions list. + internal partial class ImportExportExtensionsOperationListResult + { + /// Initializes a new instance of ImportExportExtensionsOperationListResult. + internal ImportExportExtensionsOperationListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ImportExportExtensionsOperationListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ImportExportExtensionsOperationListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportResponse.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.Serialization.cs similarity index 80% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportResponse.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.Serialization.cs index 0b92c8f5f4ab7..eea12bb4cfbea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportResponse.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.Serialization.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Sql.Models { - public partial class ImportExportResponse : IUtf8JsonSerializable + public partial class ImportExportExtensionsOperationResult : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -22,19 +22,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ImportExportResponse DeserializeImportExportResponse(JsonElement element) + internal static ImportExportExtensionsOperationResult DeserializeImportExportExtensionsOperationResult(JsonElement element) { Optional id = default; Optional name = default; Optional type = default; - Optional requestType = default; Optional requestId = default; + Optional requestType = default; + Optional lastModifiedTime = default; Optional serverName = default; Optional databaseName = default; Optional status = default; - Optional lastModifiedTime = default; - Optional queuedTime = default; - Optional blobUri = default; Optional errorMessage = default; foreach (var property in element.EnumerateObject()) { @@ -62,11 +60,6 @@ internal static ImportExportResponse DeserializeImportExportResponse(JsonElement } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("requestType")) - { - requestType = property0.Value.GetString(); - continue; - } if (property0.NameEquals("requestId")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -77,34 +70,29 @@ internal static ImportExportResponse DeserializeImportExportResponse(JsonElement requestId = property0.Value.GetGuid(); continue; } - if (property0.NameEquals("serverName")) - { - serverName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("databaseName")) + if (property0.NameEquals("requestType")) { - databaseName = property0.Value.GetString(); + requestType = property0.Value.GetString(); continue; } - if (property0.NameEquals("status")) + if (property0.NameEquals("lastModifiedTime")) { - status = property0.Value.GetString(); + lastModifiedTime = property0.Value.GetString(); continue; } - if (property0.NameEquals("lastModifiedTime")) + if (property0.NameEquals("serverName")) { - lastModifiedTime = property0.Value.GetString(); + serverName = property0.Value.GetString(); continue; } - if (property0.NameEquals("queuedTime")) + if (property0.NameEquals("databaseName")) { - queuedTime = property0.Value.GetString(); + databaseName = property0.Value.GetString(); continue; } - if (property0.NameEquals("blobUri")) + if (property0.NameEquals("status")) { - blobUri = property0.Value.GetString(); + status = property0.Value.GetString(); continue; } if (property0.NameEquals("errorMessage")) @@ -116,7 +104,7 @@ internal static ImportExportResponse DeserializeImportExportResponse(JsonElement continue; } } - return new ImportExportResponse(id.Value, name.Value, type.Value, requestType.Value, Optional.ToNullable(requestId), serverName.Value, databaseName.Value, status.Value, lastModifiedTime.Value, queuedTime.Value, blobUri.Value, errorMessage.Value); + return new ImportExportExtensionsOperationResult(id.Value, name.Value, type.Value, Optional.ToNullable(requestId), requestType.Value, lastModifiedTime.Value, serverName.Value, databaseName.Value, status.Value, errorMessage.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs new file mode 100644 index 0000000000000..111b5064fc129 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// An Extension operation result resource. + public partial class ImportExportExtensionsOperationResult : ProxyResource + { + /// Initializes a new instance of ImportExportExtensionsOperationResult. + public ImportExportExtensionsOperationResult() + { + } + + /// Initializes a new instance of ImportExportExtensionsOperationResult. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Request Id. + /// Request type. + /// Last modified time. + /// Server name. + /// Database name. + /// Operation status. + /// Error message. + internal ImportExportExtensionsOperationResult(string id, string name, string type, Guid? requestId, string requestType, string lastModifiedTime, string serverName, string databaseName, string status, string errorMessage) : base(id, name, type) + { + RequestId = requestId; + RequestType = requestType; + LastModifiedTime = lastModifiedTime; + ServerName = serverName; + DatabaseName = databaseName; + Status = status; + ErrorMessage = errorMessage; + } + + /// Request Id. + public Guid? RequestId { get; } + /// Request type. + public string RequestType { get; } + /// Last modified time. + public string LastModifiedTime { get; } + /// Server name. + public string ServerName { get; } + /// Database name. + public string DatabaseName { get; } + /// Operation status. + public string Status { get; } + /// Error message. + public string ErrorMessage { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportOperationResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportOperationResult.Serialization.cs new file mode 100644 index 0000000000000..f5586b7c22448 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportOperationResult.Serialization.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ImportExportOperationResult : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ImportExportOperationResult DeserializeImportExportOperationResult(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional requestId = default; + Optional requestType = default; + Optional queuedTime = default; + Optional lastModifiedTime = default; + Optional blobUri = default; + Optional serverName = default; + Optional databaseName = default; + Optional status = default; + Optional errorMessage = default; + Optional> privateEndpointConnections = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("requestId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + requestId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("requestType")) + { + requestType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("queuedTime")) + { + queuedTime = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastModifiedTime")) + { + lastModifiedTime = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("blobUri")) + { + blobUri = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("serverName")) + { + serverName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("databaseName")) + { + databaseName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status")) + { + status = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("errorMessage")) + { + errorMessage = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("privateEndpointConnections")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(PrivateEndpointConnectionRequestStatus.DeserializePrivateEndpointConnectionRequestStatus(item)); + } + privateEndpointConnections = array; + continue; + } + } + continue; + } + } + return new ImportExportOperationResult(id.Value, name.Value, type.Value, Optional.ToNullable(requestId), requestType.Value, queuedTime.Value, lastModifiedTime.Value, blobUri.Value, serverName.Value, databaseName.Value, status.Value, errorMessage.Value, Optional.ToList(privateEndpointConnections)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportOperationResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportOperationResult.cs new file mode 100644 index 0000000000000..0725932b53ed9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportOperationResult.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// An ImportExport operation result resource. + public partial class ImportExportOperationResult : ProxyResource + { + /// Initializes a new instance of ImportExportOperationResult. + public ImportExportOperationResult() + { + PrivateEndpointConnections = new ChangeTrackingList(); + } + + /// Initializes a new instance of ImportExportOperationResult. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Request Id. + /// Request type. + /// Queued time. + /// Last modified time. + /// Blob Uri. + /// Server name. + /// Database name. + /// Operation status. + /// Error message. + /// Gets the status of private endpoints associated with this request. + internal ImportExportOperationResult(string id, string name, string type, Guid? requestId, string requestType, string queuedTime, string lastModifiedTime, string blobUri, string serverName, string databaseName, string status, string errorMessage, IReadOnlyList privateEndpointConnections) : base(id, name, type) + { + RequestId = requestId; + RequestType = requestType; + QueuedTime = queuedTime; + LastModifiedTime = lastModifiedTime; + BlobUri = blobUri; + ServerName = serverName; + DatabaseName = databaseName; + Status = status; + ErrorMessage = errorMessage; + PrivateEndpointConnections = privateEndpointConnections; + } + + /// Request Id. + public Guid? RequestId { get; } + /// Request type. + public string RequestType { get; } + /// Queued time. + public string QueuedTime { get; } + /// Last modified time. + public string LastModifiedTime { get; } + /// Blob Uri. + public string BlobUri { get; } + /// Server name. + public string ServerName { get; } + /// Database name. + public string DatabaseName { get; } + /// Operation status. + public string Status { get; } + /// Error message. + public string ErrorMessage { get; } + /// Gets the status of private endpoints associated with this request. + public IReadOnlyList PrivateEndpointConnections { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportResponse.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportResponse.cs deleted file mode 100644 index a774162d03b8e..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExportResponse.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Response for Import/Export Get operation. - public partial class ImportExportResponse : ProxyResource - { - /// Initializes a new instance of ImportExportResponse. - public ImportExportResponse() - { - } - - /// Initializes a new instance of ImportExportResponse. - /// Resource ID. - /// Resource name. - /// Resource type. - /// The request type of the operation. - /// The request type of the operation. - /// The name of the server. - /// The name of the database. - /// The status message returned from the server. - /// The operation status last modified time. - /// The operation queued time. - /// The blob uri. - /// The error message returned from the server. - internal ImportExportResponse(string id, string name, string type, string requestType, Guid? requestId, string serverName, string databaseName, string status, string lastModifiedTime, string queuedTime, string blobUri, string errorMessage) : base(id, name, type) - { - RequestType = requestType; - RequestId = requestId; - ServerName = serverName; - DatabaseName = databaseName; - Status = status; - LastModifiedTime = lastModifiedTime; - QueuedTime = queuedTime; - BlobUri = blobUri; - ErrorMessage = errorMessage; - } - - /// The request type of the operation. - public string RequestType { get; } - /// The request type of the operation. - public Guid? RequestId { get; } - /// The name of the server. - public string ServerName { get; } - /// The name of the database. - public string DatabaseName { get; } - /// The status message returned from the server. - public string Status { get; } - /// The operation status last modified time. - public string LastModifiedTime { get; } - /// The operation queued time. - public string QueuedTime { get; } - /// The blob uri. - public string BlobUri { get; } - /// The error message returned from the server. - public string ErrorMessage { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionProperties.cs deleted file mode 100644 index 286c6b79f758b..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionProperties.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents the properties for an import operation. - public partial class ImportExtensionProperties : ExportRequest - { - /// Initializes a new instance of ImportExtensionProperties. - /// The type of the storage key to use. - /// The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". - /// The storage uri to use. - /// The name of the SQL administrator. - /// The password of the SQL administrator. - /// , , , or is null. - public ImportExtensionProperties(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword) : base(storageKeyType, storageKey, storageUri, administratorLogin, administratorLoginPassword) - { - if (storageKey == null) - { - throw new ArgumentNullException(nameof(storageKey)); - } - if (storageUri == null) - { - throw new ArgumentNullException(nameof(storageUri)); - } - if (administratorLogin == null) - { - throw new ArgumentNullException(nameof(administratorLogin)); - } - if (administratorLoginPassword == null) - { - throw new ArgumentNullException(nameof(administratorLoginPassword)); - } - - OperationMode = "Import"; - } - - /// The type of import operation being performed. This is always Import. - public string OperationMode { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionRequest.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionRequest.Serialization.cs deleted file mode 100644 index fb8ab33199b8f..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionRequest.Serialization.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - public partial class ImportExtensionRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Type)) - { - writer.WritePropertyName("type"); - writer.WriteStringValue(Type); - } - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(StorageKeyType)) - { - writer.WritePropertyName("storageKeyType"); - writer.WriteStringValue(StorageKeyType.Value.ToSerialString()); - } - if (Optional.IsDefined(StorageKey)) - { - writer.WritePropertyName("storageKey"); - writer.WriteStringValue(StorageKey); - } - if (Optional.IsDefined(StorageUri)) - { - writer.WritePropertyName("storageUri"); - writer.WriteStringValue(StorageUri); - } - if (Optional.IsDefined(AdministratorLogin)) - { - writer.WritePropertyName("administratorLogin"); - writer.WriteStringValue(AdministratorLogin); - } - if (Optional.IsDefined(AdministratorLoginPassword)) - { - writer.WritePropertyName("administratorLoginPassword"); - writer.WriteStringValue(AdministratorLoginPassword); - } - if (Optional.IsDefined(AuthenticationType)) - { - writer.WritePropertyName("authenticationType"); - writer.WriteStringValue(AuthenticationType.Value.ToSerialString()); - } - if (Optional.IsDefined(OperationMode)) - { - writer.WritePropertyName("operationMode"); - writer.WriteStringValue(OperationMode); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionRequest.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionRequest.cs deleted file mode 100644 index f25d98e36f275..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportExtensionRequest.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Sql.Models -{ - /// Import database parameters. - public partial class ImportExtensionRequest - { - /// Initializes a new instance of ImportExtensionRequest. - public ImportExtensionRequest() - { - OperationMode = "Import"; - } - - /// The name of the extension. - public string Name { get; set; } - /// The type of the extension. - public string Type { get; set; } - /// The type of the storage key to use. - public StorageKeyType? StorageKeyType { get; set; } - /// The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". - public string StorageKey { get; set; } - /// The storage uri to use. - public string StorageUri { get; set; } - /// The name of the SQL administrator. - public string AdministratorLogin { get; set; } - /// The password of the SQL administrator. - public string AdministratorLoginPassword { get; set; } - /// The authentication type. - public AuthenticationType? AuthenticationType { get; set; } - /// The type of import operation being performed. This is always Import. - public string OperationMode { get; set; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportNewDatabaseDefinition.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportNewDatabaseDefinition.Serialization.cs new file mode 100644 index 0000000000000..ca43668c4b6e3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportNewDatabaseDefinition.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ImportNewDatabaseDefinition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DatabaseName)) + { + writer.WritePropertyName("databaseName"); + writer.WriteStringValue(DatabaseName); + } + if (Optional.IsDefined(Edition)) + { + writer.WritePropertyName("edition"); + writer.WriteStringValue(Edition); + } + if (Optional.IsDefined(ServiceObjectiveName)) + { + writer.WritePropertyName("serviceObjectiveName"); + writer.WriteStringValue(ServiceObjectiveName); + } + if (Optional.IsDefined(MaxSizeBytes)) + { + writer.WritePropertyName("maxSizeBytes"); + writer.WriteStringValue(MaxSizeBytes); + } + writer.WritePropertyName("storageKeyType"); + writer.WriteStringValue(StorageKeyType.ToString()); + writer.WritePropertyName("storageKey"); + writer.WriteStringValue(StorageKey); + writer.WritePropertyName("storageUri"); + writer.WriteStringValue(StorageUri); + writer.WritePropertyName("administratorLogin"); + writer.WriteStringValue(AdministratorLogin); + writer.WritePropertyName("administratorLoginPassword"); + writer.WriteStringValue(AdministratorLoginPassword); + if (Optional.IsDefined(AuthenticationType)) + { + writer.WritePropertyName("authenticationType"); + writer.WriteStringValue(AuthenticationType); + } + if (Optional.IsDefined(NetworkIsolation)) + { + writer.WritePropertyName("networkIsolation"); + writer.WriteObjectValue(NetworkIsolation); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportNewDatabaseDefinition.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportNewDatabaseDefinition.cs new file mode 100644 index 0000000000000..6d6edb0562f0f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportNewDatabaseDefinition.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains the information necessary to perform import operation for new database. + public partial class ImportNewDatabaseDefinition + { + /// Initializes a new instance of ImportNewDatabaseDefinition. + /// Storage key type. + /// Storage key. + /// Storage Uri. + /// Administrator login name. + /// Administrator login password. + /// , , , or is null. + public ImportNewDatabaseDefinition(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword) + { + if (storageKey == null) + { + throw new ArgumentNullException(nameof(storageKey)); + } + if (storageUri == null) + { + throw new ArgumentNullException(nameof(storageUri)); + } + if (administratorLogin == null) + { + throw new ArgumentNullException(nameof(administratorLogin)); + } + if (administratorLoginPassword == null) + { + throw new ArgumentNullException(nameof(administratorLoginPassword)); + } + + StorageKeyType = storageKeyType; + StorageKey = storageKey; + StorageUri = storageUri; + AdministratorLogin = administratorLogin; + AdministratorLoginPassword = administratorLoginPassword; + } + + /// Name of the import database. + public string DatabaseName { get; set; } + /// Edition of the import database. + public string Edition { get; set; } + /// Service level objective name of the import database. + public string ServiceObjectiveName { get; set; } + /// Max size in bytes for the import database. + public string MaxSizeBytes { get; set; } + /// Storage key type. + public StorageKeyType StorageKeyType { get; } + /// Storage key. + public string StorageKey { get; } + /// Storage Uri. + public string StorageUri { get; } + /// Administrator login name. + public string AdministratorLogin { get; } + /// Administrator login password. + public string AdministratorLoginPassword { get; } + /// Authentication type. + public string AuthenticationType { get; set; } + /// Optional resource information to enable network isolation for request. + public NetworkIsolationSettings NetworkIsolation { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportRequest.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportRequest.Serialization.cs deleted file mode 100644 index a2f2bb96ee5e8..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportRequest.Serialization.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - public partial class ImportRequest : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("databaseName"); - writer.WriteStringValue(DatabaseName); - writer.WritePropertyName("edition"); - writer.WriteStringValue(Edition.ToString()); - writer.WritePropertyName("serviceObjectiveName"); - writer.WriteStringValue(ServiceObjectiveName.ToString()); - writer.WritePropertyName("maxSizeBytes"); - writer.WriteStringValue(MaxSizeBytes); - writer.WritePropertyName("storageKeyType"); - writer.WriteStringValue(StorageKeyType.ToSerialString()); - writer.WritePropertyName("storageKey"); - writer.WriteStringValue(StorageKey); - writer.WritePropertyName("storageUri"); - writer.WriteStringValue(StorageUri); - writer.WritePropertyName("administratorLogin"); - writer.WriteStringValue(AdministratorLogin); - writer.WritePropertyName("administratorLoginPassword"); - writer.WriteStringValue(AdministratorLoginPassword); - if (Optional.IsDefined(AuthenticationType)) - { - writer.WritePropertyName("authenticationType"); - writer.WriteStringValue(AuthenticationType.Value.ToSerialString()); - } - writer.WriteEndObject(); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportRequest.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportRequest.cs deleted file mode 100644 index 01004c6858d62..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ImportRequest.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Import database parameters. - public partial class ImportRequest : ExportRequest - { - /// Initializes a new instance of ImportRequest. - /// The type of the storage key to use. - /// The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". - /// The storage uri to use. - /// The name of the SQL administrator. - /// The password of the SQL administrator. - /// The name of the database to import. - /// - /// The edition for the database being created. - /// - /// - /// - /// 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> - /// - /// ```` - /// - /// . - /// - /// The name of the service objective to assign to the database. - /// The maximum size for the newly imported database. - /// , , , , , or is null. - public ImportRequest(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword, string databaseName, DatabaseEdition edition, ServiceObjectiveName serviceObjectiveName, string maxSizeBytes) : base(storageKeyType, storageKey, storageUri, administratorLogin, administratorLoginPassword) - { - if (storageKey == null) - { - throw new ArgumentNullException(nameof(storageKey)); - } - if (storageUri == null) - { - throw new ArgumentNullException(nameof(storageUri)); - } - if (administratorLogin == null) - { - throw new ArgumentNullException(nameof(administratorLogin)); - } - if (administratorLoginPassword == null) - { - throw new ArgumentNullException(nameof(administratorLoginPassword)); - } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - if (maxSizeBytes == null) - { - throw new ArgumentNullException(nameof(maxSizeBytes)); - } - - DatabaseName = databaseName; - Edition = edition; - ServiceObjectiveName = serviceObjectiveName; - MaxSizeBytes = maxSizeBytes; - } - - /// The name of the database to import. - public string DatabaseName { get; } - /// - /// The edition for the database being created. - /// - /// - /// - /// 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> - /// - /// ```` - /// - /// . - /// - public DatabaseEdition Edition { get; } - /// The name of the service objective to assign to the database. - public ServiceObjectiveName ServiceObjectiveName { get; } - /// The maximum size for the newly imported database. - public string MaxSizeBytes { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IsRetryable.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IsRetryable.Serialization.cs new file mode 100644 index 0000000000000..ddc9232fd6d84 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IsRetryable.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class IsRetryableExtensions + { + public static string ToSerialString(this IsRetryable value) => value switch + { + IsRetryable.Yes => "Yes", + IsRetryable.No => "No", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown IsRetryable value.") + }; + + public static IsRetryable ToIsRetryable(this string value) + { + if (string.Equals(value, "Yes", StringComparison.InvariantCultureIgnoreCase)) return IsRetryable.Yes; + if (string.Equals(value, "No", StringComparison.InvariantCultureIgnoreCase)) return IsRetryable.No; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown IsRetryable value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IsRetryable.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IsRetryable.cs new file mode 100644 index 0000000000000..fd1a3cfb45c53 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/IsRetryable.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Gets whether the error could be ignored and recommended action could be retried. Possible values are: Yes/No. + public enum IsRetryable + { + /// Yes. + Yes, + /// No. + No + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobSchedule.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobSchedule.cs index 6eff8701c3240..a17965468791c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobSchedule.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobSchedule.cs @@ -22,7 +22,7 @@ public JobSchedule() /// Schedule end time. /// Schedule interval type. /// Whether or not the schedule is enabled. - /// Value of the schedule's recurring interval, if the schedule type is recurring. ISO8601 duration format. + /// Value of the schedule's recurring interval, if the ScheduleType is recurring. ISO8601 duration format. internal JobSchedule(DateTimeOffset? startTime, DateTimeOffset? endTime, JobScheduleType? type, bool? enabled, string interval) { StartTime = startTime; @@ -40,7 +40,7 @@ internal JobSchedule(DateTimeOffset? startTime, DateTimeOffset? endTime, JobSche public JobScheduleType? Type { get; set; } /// Whether or not the schedule is enabled. public bool? Enabled { get; set; } - /// Value of the schedule's recurring interval, if the schedule type is recurring. ISO8601 duration format. + /// Value of the schedule's recurring interval, if the ScheduleType is recurring. ISO8601 duration format. public string Interval { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploads.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploads.Serialization.cs new file mode 100644 index 0000000000000..4734fbfa987e3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploads.Serialization.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class LedgerDigestUploads : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DigestStorageEndpoint)) + { + writer.WritePropertyName("digestStorageEndpoint"); + writer.WriteStringValue(DigestStorageEndpoint); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static LedgerDigestUploads DeserializeLedgerDigestUploads(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional digestStorageEndpoint = default; + Optional state = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("digestStorageEndpoint")) + { + digestStorageEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("state")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + state = property0.Value.GetString().ToLedgerDigestUploadsState(); + continue; + } + } + continue; + } + } + return new LedgerDigestUploads(id.Value, name.Value, type.Value, digestStorageEndpoint.Value, Optional.ToNullable(state)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploads.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploads.cs new file mode 100644 index 0000000000000..a525f9fdb5ad2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploads.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Azure SQL Database ledger digest upload settings. + public partial class LedgerDigestUploads : ProxyResource + { + /// Initializes a new instance of LedgerDigestUploads. + public LedgerDigestUploads() + { + } + + /// Initializes a new instance of LedgerDigestUploads. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure Confidential Ledger. + /// Specifies the state of ledger digest upload. + internal LedgerDigestUploads(string id, string name, string type, string digestStorageEndpoint, LedgerDigestUploadsState? state) : base(id, name, type) + { + DigestStorageEndpoint = digestStorageEndpoint; + State = state; + } + + /// The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure Confidential Ledger. + public string DigestStorageEndpoint { get; set; } + /// Specifies the state of ledger digest upload. + public LedgerDigestUploadsState? State { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsListResult.Serialization.cs new file mode 100644 index 0000000000000..4a61e330a1d16 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class LedgerDigestUploadsListResult + { + internal static LedgerDigestUploadsListResult DeserializeLedgerDigestUploadsListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LedgerDigestUploads.DeserializeLedgerDigestUploads(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new LedgerDigestUploadsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsListResult.cs new file mode 100644 index 0000000000000..75dd783e92071 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of ledger digest upload settings. + internal partial class LedgerDigestUploadsListResult + { + /// Initializes a new instance of LedgerDigestUploadsListResult. + internal LedgerDigestUploadsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of LedgerDigestUploadsListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal LedgerDigestUploadsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsName.cs new file mode 100644 index 0000000000000..86f92551750b2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The LedgerDigestUploadsName. + public readonly partial struct LedgerDigestUploadsName : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public LedgerDigestUploadsName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CurrentValue = "current"; + + /// current. + public static LedgerDigestUploadsName Current { get; } = new LedgerDigestUploadsName(CurrentValue); + /// Determines if two values are the same. + public static bool operator ==(LedgerDigestUploadsName left, LedgerDigestUploadsName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LedgerDigestUploadsName left, LedgerDigestUploadsName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LedgerDigestUploadsName(string value) => new LedgerDigestUploadsName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LedgerDigestUploadsName other && Equals(other); + /// + public bool Equals(LedgerDigestUploadsName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsState.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsState.Serialization.cs new file mode 100644 index 0000000000000..7fb42104b6e37 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsState.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class LedgerDigestUploadsStateExtensions + { + public static string ToSerialString(this LedgerDigestUploadsState value) => value switch + { + LedgerDigestUploadsState.Enabled => "Enabled", + LedgerDigestUploadsState.Disabled => "Disabled", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown LedgerDigestUploadsState value.") + }; + + public static LedgerDigestUploadsState ToLedgerDigestUploadsState(this string value) + { + if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return LedgerDigestUploadsState.Enabled; + if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return LedgerDigestUploadsState.Disabled; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown LedgerDigestUploadsState value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsState.cs similarity index 70% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsState.cs index bcf242638211f..c72a1652de88d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LedgerDigestUploadsState.cs @@ -7,8 +7,8 @@ namespace Azure.ResourceManager.Sql.Models { - /// Specifies whether to use the default server policy. - public enum SecurityAlertPolicyUseServerDefault + /// Specifies the state of ledger digest upload. + public enum LedgerDigestUploadsState { /// Enabled. Enabled, diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.Serialization.cs new file mode 100644 index 0000000000000..a814eb6e36879 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class LogicalDatabaseTransparentDataEncryption : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToSerialString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static LogicalDatabaseTransparentDataEncryption DeserializeLogicalDatabaseTransparentDataEncryption(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional state = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("state")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + state = property0.Value.GetString().ToTransparentDataEncryptionState(); + continue; + } + } + continue; + } + } + return new LogicalDatabaseTransparentDataEncryption(id.Value, name.Value, type.Value, Optional.ToNullable(state)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs new file mode 100644 index 0000000000000..e360ae4ad51e6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryption.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A logical database transparent data encryption state. + public partial class LogicalDatabaseTransparentDataEncryption : ProxyResource + { + /// Initializes a new instance of LogicalDatabaseTransparentDataEncryption. + public LogicalDatabaseTransparentDataEncryption() + { + } + + /// Initializes a new instance of LogicalDatabaseTransparentDataEncryption. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Specifies the state of the transparent data encryption. + internal LogicalDatabaseTransparentDataEncryption(string id, string name, string type, TransparentDataEncryptionState? state) : base(id, name, type) + { + State = state; + } + + /// Specifies the state of the transparent data encryption. + public TransparentDataEncryptionState? State { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryptionListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryptionListResult.Serialization.cs new file mode 100644 index 0000000000000..d882cec7f6cba --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryptionListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class LogicalDatabaseTransparentDataEncryptionListResult + { + internal static LogicalDatabaseTransparentDataEncryptionListResult DeserializeLogicalDatabaseTransparentDataEncryptionListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LogicalDatabaseTransparentDataEncryption.DeserializeLogicalDatabaseTransparentDataEncryption(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new LogicalDatabaseTransparentDataEncryptionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryptionListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryptionListResult.cs new file mode 100644 index 0000000000000..63fcb97aea81d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LogicalDatabaseTransparentDataEncryptionListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of transparent data encryptions. + internal partial class LogicalDatabaseTransparentDataEncryptionListResult + { + /// Initializes a new instance of LogicalDatabaseTransparentDataEncryptionListResult. + internal LogicalDatabaseTransparentDataEncryptionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of LogicalDatabaseTransparentDataEncryptionListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal LogicalDatabaseTransparentDataEncryptionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackup.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackup.Serialization.cs index ca0185a2462fa..a1e88dedcbfba 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackup.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackup.Serialization.cs @@ -18,6 +18,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("properties"); writer.WriteStartObject(); + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) + { + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -33,6 +38,8 @@ internal static LongTermRetentionBackup DeserializeLongTermRetentionBackup(JsonE Optional databaseDeletionTime = default; Optional backupTime = default; Optional backupExpirationTime = default; + Optional backupStorageRedundancy = default; + Optional requestedBackupStorageRedundancy = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -109,11 +116,31 @@ internal static LongTermRetentionBackup DeserializeLongTermRetentionBackup(JsonE backupExpirationTime = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("backupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + backupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("requestedBackupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + requestedBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } } continue; } } - return new LongTermRetentionBackup(id.Value, name.Value, type.Value, serverName.Value, Optional.ToNullable(serverCreateTime), databaseName.Value, Optional.ToNullable(databaseDeletionTime), Optional.ToNullable(backupTime), Optional.ToNullable(backupExpirationTime)); + return new LongTermRetentionBackup(id.Value, name.Value, type.Value, serverName.Value, Optional.ToNullable(serverCreateTime), databaseName.Value, Optional.ToNullable(databaseDeletionTime), Optional.ToNullable(backupTime), Optional.ToNullable(backupExpirationTime), Optional.ToNullable(backupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackup.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackup.cs index 46dad8a98d4f3..e74333c534735 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackup.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackup.cs @@ -27,7 +27,9 @@ public LongTermRetentionBackup() /// The delete time of the database. /// The time the backup was taken. /// The time the long term retention backup will expire. - internal LongTermRetentionBackup(string id, string name, string type, string serverName, DateTimeOffset? serverCreateTime, string databaseName, DateTimeOffset? databaseDeletionTime, DateTimeOffset? backupTime, DateTimeOffset? backupExpirationTime) : base(id, name, type) + /// The storage redundancy type of the backup. + /// The storage redundancy type of the backup. + internal LongTermRetentionBackup(string id, string name, string type, string serverName, DateTimeOffset? serverCreateTime, string databaseName, DateTimeOffset? databaseDeletionTime, DateTimeOffset? backupTime, DateTimeOffset? backupExpirationTime, BackupStorageRedundancy? backupStorageRedundancy, BackupStorageRedundancy? requestedBackupStorageRedundancy) : base(id, name, type) { ServerName = serverName; ServerCreateTime = serverCreateTime; @@ -35,6 +37,8 @@ internal LongTermRetentionBackup(string id, string name, string type, string ser DatabaseDeletionTime = databaseDeletionTime; BackupTime = backupTime; BackupExpirationTime = backupExpirationTime; + BackupStorageRedundancy = backupStorageRedundancy; + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; } /// The server name that the backup database belong to. @@ -49,5 +53,9 @@ internal LongTermRetentionBackup(string id, string name, string type, string ser public DateTimeOffset? BackupTime { get; } /// The time the long term retention backup will expire. public DateTimeOffset? BackupExpirationTime { get; } + /// The storage redundancy type of the backup. + public BackupStorageRedundancy? BackupStorageRedundancy { get; } + /// The storage redundancy type of the backup. + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.Serialization.cs new file mode 100644 index 0000000000000..d6ba8b7a230ea --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.Serialization.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class LongTermRetentionBackupOperationResult : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static LongTermRetentionBackupOperationResult DeserializeLongTermRetentionBackupOperationResult(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional requestId = default; + Optional operationType = default; + Optional fromBackupResourceId = default; + Optional toBackupResourceId = default; + Optional targetBackupStorageRedundancy = default; + Optional status = default; + Optional message = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("requestId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + requestId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("operationType")) + { + operationType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("fromBackupResourceId")) + { + fromBackupResourceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("toBackupResourceId")) + { + toBackupResourceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("targetBackupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + targetBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("status")) + { + status = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("message")) + { + message = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new LongTermRetentionBackupOperationResult(id.Value, name.Value, type.Value, Optional.ToNullable(requestId), operationType.Value, fromBackupResourceId.Value, toBackupResourceId.Value, Optional.ToNullable(targetBackupStorageRedundancy), status.Value, message.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.cs new file mode 100644 index 0000000000000..a865170745448 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionBackupOperationResult.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A LongTermRetentionBackup operation result resource. + public partial class LongTermRetentionBackupOperationResult : ProxyResource + { + /// Initializes a new instance of LongTermRetentionBackupOperationResult. + public LongTermRetentionBackupOperationResult() + { + } + + /// Initializes a new instance of LongTermRetentionBackupOperationResult. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Request Id. + /// Operation type. + /// Source backup resource id. + /// Target backup resource id. + /// The storage redundancy type of the copied backup. + /// Operation status. + /// Progress message. + internal LongTermRetentionBackupOperationResult(string id, string name, string type, Guid? requestId, string operationType, string fromBackupResourceId, string toBackupResourceId, BackupStorageRedundancy? targetBackupStorageRedundancy, string status, string message) : base(id, name, type) + { + RequestId = requestId; + OperationType = operationType; + FromBackupResourceId = fromBackupResourceId; + ToBackupResourceId = toBackupResourceId; + TargetBackupStorageRedundancy = targetBackupStorageRedundancy; + Status = status; + Message = message; + } + + /// Request Id. + public Guid? RequestId { get; } + /// Operation type. + public string OperationType { get; } + /// Source backup resource id. + public string FromBackupResourceId { get; } + /// Target backup resource id. + public string ToBackupResourceId { get; } + /// The storage redundancy type of the copied backup. + public BackupStorageRedundancy? TargetBackupStorageRedundancy { get; } + /// Operation status. + public string Status { get; } + /// Progress message. + public string Message { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionDatabaseState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionDatabaseState.cs deleted file mode 100644 index 5637988c04ece..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionDatabaseState.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The LongTermRetentionDatabaseState. - public readonly partial struct LongTermRetentionDatabaseState : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public LongTermRetentionDatabaseState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllValue = "All"; - private const string LiveValue = "Live"; - private const string DeletedValue = "Deleted"; - - /// All. - public static LongTermRetentionDatabaseState All { get; } = new LongTermRetentionDatabaseState(AllValue); - /// Live. - public static LongTermRetentionDatabaseState Live { get; } = new LongTermRetentionDatabaseState(LiveValue); - /// Deleted. - public static LongTermRetentionDatabaseState Deleted { get; } = new LongTermRetentionDatabaseState(DeletedValue); - /// Determines if two values are the same. - public static bool operator ==(LongTermRetentionDatabaseState left, LongTermRetentionDatabaseState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(LongTermRetentionDatabaseState left, LongTermRetentionDatabaseState right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator LongTermRetentionDatabaseState(string value) => new LongTermRetentionDatabaseState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is LongTermRetentionDatabaseState other && Equals(other); - /// - public bool Equals(LongTermRetentionDatabaseState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicy.Serialization.cs similarity index 91% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicy.Serialization.cs index 720cce72f5bbe..f84bbd5a0f5cd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicy.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - public partial class BackupLongTermRetentionPolicy : IUtf8JsonSerializable + public partial class LongTermRetentionPolicy : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -41,7 +41,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static BackupLongTermRetentionPolicy DeserializeBackupLongTermRetentionPolicy(JsonElement element) + internal static LongTermRetentionPolicy DeserializeLongTermRetentionPolicy(JsonElement element) { Optional id = default; Optional name = default; @@ -105,7 +105,7 @@ internal static BackupLongTermRetentionPolicy DeserializeBackupLongTermRetention continue; } } - return new BackupLongTermRetentionPolicy(id.Value, name.Value, type.Value, weeklyRetention.Value, monthlyRetention.Value, yearlyRetention.Value, Optional.ToNullable(weekOfYear)); + return new LongTermRetentionPolicy(id.Value, name.Value, type.Value, weeklyRetention.Value, monthlyRetention.Value, yearlyRetention.Value, Optional.ToNullable(weekOfYear)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicy.cs similarity index 77% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicy.cs index 59c501988eeef..7188c47732de2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/BackupLongTermRetentionPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicy.cs @@ -8,14 +8,14 @@ namespace Azure.ResourceManager.Sql.Models { /// A long term retention policy. - public partial class BackupLongTermRetentionPolicy : ProxyResource + public partial class LongTermRetentionPolicy : ProxyResource { - /// Initializes a new instance of BackupLongTermRetentionPolicy. - public BackupLongTermRetentionPolicy() + /// Initializes a new instance of LongTermRetentionPolicy. + public LongTermRetentionPolicy() { } - /// Initializes a new instance of BackupLongTermRetentionPolicy. + /// Initializes a new instance of LongTermRetentionPolicy. /// Resource ID. /// Resource name. /// Resource type. @@ -23,7 +23,7 @@ public BackupLongTermRetentionPolicy() /// The monthly retention policy for an LTR backup in an ISO 8601 format. /// The yearly retention policy for an LTR backup in an ISO 8601 format. /// The week of year to take the yearly backup in an ISO 8601 format. - internal BackupLongTermRetentionPolicy(string id, string name, string type, string weeklyRetention, string monthlyRetention, string yearlyRetention, int? weekOfYear) : base(id, name, type) + internal LongTermRetentionPolicy(string id, string name, string type, string weeklyRetention, string monthlyRetention, string yearlyRetention, int? weekOfYear) : base(id, name, type) { WeeklyRetention = weeklyRetention; MonthlyRetention = monthlyRetention; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyListResult.Serialization.cs new file mode 100644 index 0000000000000..af59e998998e3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class LongTermRetentionPolicyListResult + { + internal static LongTermRetentionPolicyListResult DeserializeLongTermRetentionPolicyListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LongTermRetentionPolicy.DeserializeLongTermRetentionPolicy(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new LongTermRetentionPolicyListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyListResult.cs new file mode 100644 index 0000000000000..6d92a9b50505c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LongTermRetentionPolicyListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of long term retention policies. + internal partial class LongTermRetentionPolicyListResult + { + /// Initializes a new instance of LongTermRetentionPolicyListResult. + internal LongTermRetentionPolicyListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of LongTermRetentionPolicyListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal LongTermRetentionPolicyListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceConfigurationCapability.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceConfigurationCapability.Serialization.cs new file mode 100644 index 0000000000000..503d1456357f3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceConfigurationCapability.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class MaintenanceConfigurationCapability + { + internal static MaintenanceConfigurationCapability DeserializeMaintenanceConfigurationCapability(JsonElement element) + { + Optional name = default; + Optional zoneRedundant = default; + Optional status = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("zoneRedundant")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + zoneRedundant = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = property.Value.GetString().ToCapabilityStatus(); + continue; + } + if (property.NameEquals("reason")) + { + reason = property.Value.GetString(); + continue; + } + } + return new MaintenanceConfigurationCapability(name.Value, Optional.ToNullable(zoneRedundant), Optional.ToNullable(status), reason.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceConfigurationCapability.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceConfigurationCapability.cs new file mode 100644 index 0000000000000..174a77d654694 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceConfigurationCapability.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The maintenance configuration capability. + public partial class MaintenanceConfigurationCapability + { + /// Initializes a new instance of MaintenanceConfigurationCapability. + internal MaintenanceConfigurationCapability() + { + } + + /// Initializes a new instance of MaintenanceConfigurationCapability. + /// Maintenance configuration name. + /// Whether or not zone redundancy is supported for the maintenance configuration. + /// The status of the capability. + /// The reason for the capability not being available. + internal MaintenanceConfigurationCapability(string name, bool? zoneRedundant, CapabilityStatus? status, string reason) + { + Name = name; + ZoneRedundant = zoneRedundant; + Status = status; + Reason = reason; + } + + /// Maintenance configuration name. + public string Name { get; } + /// Whether or not zone redundancy is supported for the maintenance configuration. + public bool? ZoneRedundant { get; } + /// The status of the capability. + public CapabilityStatus? Status { get; } + /// The reason for the capability not being available. + public string Reason { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowOptions.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowOptions.Serialization.cs new file mode 100644 index 0000000000000..3db38b108754f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowOptions.Serialization.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class MaintenanceWindowOptions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(IsEnabled)) + { + writer.WritePropertyName("isEnabled"); + writer.WriteBooleanValue(IsEnabled.Value); + } + if (Optional.IsCollectionDefined(MaintenanceWindowCycles)) + { + writer.WritePropertyName("maintenanceWindowCycles"); + writer.WriteStartArray(); + foreach (var item in MaintenanceWindowCycles) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(MinDurationInMinutes)) + { + writer.WritePropertyName("minDurationInMinutes"); + writer.WriteNumberValue(MinDurationInMinutes.Value); + } + if (Optional.IsDefined(DefaultDurationInMinutes)) + { + writer.WritePropertyName("defaultDurationInMinutes"); + writer.WriteNumberValue(DefaultDurationInMinutes.Value); + } + if (Optional.IsDefined(MinCycles)) + { + writer.WritePropertyName("minCycles"); + writer.WriteNumberValue(MinCycles.Value); + } + if (Optional.IsDefined(TimeGranularityInMinutes)) + { + writer.WritePropertyName("timeGranularityInMinutes"); + writer.WriteNumberValue(TimeGranularityInMinutes.Value); + } + if (Optional.IsDefined(AllowMultipleMaintenanceWindowsPerCycle)) + { + writer.WritePropertyName("allowMultipleMaintenanceWindowsPerCycle"); + writer.WriteBooleanValue(AllowMultipleMaintenanceWindowsPerCycle.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MaintenanceWindowOptions DeserializeMaintenanceWindowOptions(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional isEnabled = default; + Optional> maintenanceWindowCycles = default; + Optional minDurationInMinutes = default; + Optional defaultDurationInMinutes = default; + Optional minCycles = default; + Optional timeGranularityInMinutes = default; + Optional allowMultipleMaintenanceWindowsPerCycle = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("isEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("maintenanceWindowCycles")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MaintenanceWindowTimeRange.DeserializeMaintenanceWindowTimeRange(item)); + } + maintenanceWindowCycles = array; + continue; + } + if (property0.NameEquals("minDurationInMinutes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + minDurationInMinutes = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("defaultDurationInMinutes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + defaultDurationInMinutes = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("minCycles")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + minCycles = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("timeGranularityInMinutes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + timeGranularityInMinutes = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("allowMultipleMaintenanceWindowsPerCycle")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + allowMultipleMaintenanceWindowsPerCycle = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + } + return new MaintenanceWindowOptions(id.Value, name.Value, type.Value, Optional.ToNullable(isEnabled), Optional.ToList(maintenanceWindowCycles), Optional.ToNullable(minDurationInMinutes), Optional.ToNullable(defaultDurationInMinutes), Optional.ToNullable(minCycles), Optional.ToNullable(timeGranularityInMinutes), Optional.ToNullable(allowMultipleMaintenanceWindowsPerCycle)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowOptions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowOptions.cs new file mode 100644 index 0000000000000..6ce9e7e130686 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowOptions.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Maintenance window options. + public partial class MaintenanceWindowOptions : ProxyResource + { + /// Initializes a new instance of MaintenanceWindowOptions. + public MaintenanceWindowOptions() + { + MaintenanceWindowCycles = new ChangeTrackingList(); + } + + /// Initializes a new instance of MaintenanceWindowOptions. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Whether maintenance windows are enabled for the database. + /// Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, 24*60}. + /// Minimum duration of maintenance window. + /// Default duration for maintenance window. + /// Minimum number of maintenance windows cycles to be set on the database. + /// Time granularity in minutes for maintenance windows. + /// Whether we allow multiple maintenance windows per cycle. + internal MaintenanceWindowOptions(string id, string name, string type, bool? isEnabled, IList maintenanceWindowCycles, int? minDurationInMinutes, int? defaultDurationInMinutes, int? minCycles, int? timeGranularityInMinutes, bool? allowMultipleMaintenanceWindowsPerCycle) : base(id, name, type) + { + IsEnabled = isEnabled; + MaintenanceWindowCycles = maintenanceWindowCycles; + MinDurationInMinutes = minDurationInMinutes; + DefaultDurationInMinutes = defaultDurationInMinutes; + MinCycles = minCycles; + TimeGranularityInMinutes = timeGranularityInMinutes; + AllowMultipleMaintenanceWindowsPerCycle = allowMultipleMaintenanceWindowsPerCycle; + } + + /// Whether maintenance windows are enabled for the database. + public bool? IsEnabled { get; set; } + /// Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, 24*60}. + public IList MaintenanceWindowCycles { get; } + /// Minimum duration of maintenance window. + public int? MinDurationInMinutes { get; set; } + /// Default duration for maintenance window. + public int? DefaultDurationInMinutes { get; set; } + /// Minimum number of maintenance windows cycles to be set on the database. + public int? MinCycles { get; set; } + /// Time granularity in minutes for maintenance windows. + public int? TimeGranularityInMinutes { get; set; } + /// Whether we allow multiple maintenance windows per cycle. + public bool? AllowMultipleMaintenanceWindowsPerCycle { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowTimeRange.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowTimeRange.Serialization.cs new file mode 100644 index 0000000000000..c8680da76f48a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowTimeRange.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class MaintenanceWindowTimeRange : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DayOfWeek)) + { + writer.WritePropertyName("dayOfWeek"); + writer.WriteStringValue(DayOfWeek.Value.ToString()); + } + if (Optional.IsDefined(StartTime)) + { + writer.WritePropertyName("startTime"); + writer.WriteStringValue(StartTime); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"); + writer.WriteStringValue(Duration); + } + writer.WriteEndObject(); + } + + internal static MaintenanceWindowTimeRange DeserializeMaintenanceWindowTimeRange(JsonElement element) + { + Optional dayOfWeek = default; + Optional startTime = default; + Optional duration = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dayOfWeek")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + dayOfWeek = new DayOfWeek(property.Value.GetString()); + continue; + } + if (property.NameEquals("startTime")) + { + startTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("duration")) + { + duration = property.Value.GetString(); + continue; + } + } + return new MaintenanceWindowTimeRange(Optional.ToNullable(dayOfWeek), startTime.Value, duration.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs new file mode 100644 index 0000000000000..e48eeb65deaff --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Maintenance window time range. + public partial class MaintenanceWindowTimeRange + { + /// Initializes a new instance of MaintenanceWindowTimeRange. + public MaintenanceWindowTimeRange() + { + } + + /// Initializes a new instance of MaintenanceWindowTimeRange. + /// Day of maintenance window. + /// Start time minutes offset from 12am. + /// Duration of maintenance window in minutes. + internal MaintenanceWindowTimeRange(DayOfWeek? dayOfWeek, string startTime, string duration) + { + DayOfWeek = dayOfWeek; + StartTime = startTime; + Duration = duration; + } + + /// Day of maintenance window. + public DayOfWeek? DayOfWeek { get; set; } + /// Start time minutes offset from 12am. + public string StartTime { get; set; } + /// Duration of maintenance window in minutes. + public string Duration { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindows.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindows.Serialization.cs new file mode 100644 index 0000000000000..67f31f0b29892 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindows.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class MaintenanceWindows : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(TimeRanges)) + { + writer.WritePropertyName("timeRanges"); + writer.WriteStartArray(); + foreach (var item in TimeRanges) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static MaintenanceWindows DeserializeMaintenanceWindows(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional> timeRanges = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("timeRanges")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MaintenanceWindowTimeRange.DeserializeMaintenanceWindowTimeRange(item)); + } + timeRanges = array; + continue; + } + } + continue; + } + } + return new MaintenanceWindows(id.Value, name.Value, type.Value, Optional.ToList(timeRanges)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindows.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindows.cs new file mode 100644 index 0000000000000..4bd4c2a362b0f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MaintenanceWindows.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Maintenance windows. + public partial class MaintenanceWindows : ProxyResource + { + /// Initializes a new instance of MaintenanceWindows. + public MaintenanceWindows() + { + TimeRanges = new ChangeTrackingList(); + } + + /// Initializes a new instance of MaintenanceWindows. + /// Resource ID. + /// Resource name. + /// Resource type. + /// . + internal MaintenanceWindows(string id, string name, string type, IList timeRanges) : base(id, name, type) + { + TimeRanges = timeRanges; + } + + public IList TimeRanges { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs index 289793ae5e1c5..1c39985012919 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs @@ -26,7 +26,7 @@ public ManagedDatabaseSecurityAlertPolicy() /// Resource name. /// Resource type. /// Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. - /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. /// Specifies an array of e-mail addresses to which the alert is sent. /// Specifies that the alert is sent to the account administrators. /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. @@ -47,7 +47,7 @@ internal ManagedDatabaseSecurityAlertPolicy(string id, string name, string type, /// 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 SecurityAlertPolicyState? State { get; set; } - /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. public IList DisabledAlerts { get; } /// Specifies an array of e-mail addresses to which the alert is sent. public IList EmailAddresses { get; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstance.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstance.Serialization.cs index e4aad238a29f4..d77637af41d35 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstance.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstance.Serialization.cs @@ -127,6 +127,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"); writer.WriteStringValue(MinimalTlsVersion); } + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) + { + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); + } + if (Optional.IsDefined(ZoneRedundant)) + { + writer.WritePropertyName("zoneRedundant"); + writer.WriteBooleanValue(ZoneRedundant.Value); + } + if (Optional.IsDefined(PrimaryUserAssignedIdentityId)) + { + writer.WritePropertyName("primaryUserAssignedIdentityId"); + writer.WriteStringValue(PrimaryUserAssignedIdentityId); + } + if (Optional.IsDefined(KeyId)) + { + writer.WritePropertyName("keyId"); + writer.WriteStringValue(KeyId); + } + if (Optional.IsDefined(Administrators)) + { + writer.WritePropertyName("administrators"); + writer.WriteObjectValue(Administrators); + } + if (Optional.IsDefined(ServicePrincipal)) + { + writer.WritePropertyName("servicePrincipal"); + writer.WriteObjectValue(ServicePrincipal); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -160,7 +190,15 @@ internal static ManagedInstance DeserializeManagedInstance(JsonElement element) Optional timezoneId = default; Optional instancePoolId = default; Optional maintenanceConfigurationId = default; + Optional> privateEndpointConnections = default; Optional minimalTlsVersion = default; + Optional currentBackupStorageRedundancy = default; + Optional requestedBackupStorageRedundancy = default; + Optional zoneRedundant = default; + Optional primaryUserAssignedIdentityId = default; + Optional keyId = default; + Optional administrators = default; + Optional servicePrincipal = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity")) @@ -367,16 +405,91 @@ internal static ManagedInstance DeserializeManagedInstance(JsonElement element) maintenanceConfigurationId = property0.Value.GetString(); continue; } + if (property0.NameEquals("privateEndpointConnections")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ManagedInstancePecProperty.DeserializeManagedInstancePecProperty(item)); + } + privateEndpointConnections = array; + continue; + } if (property0.NameEquals("minimalTlsVersion")) { minimalTlsVersion = property0.Value.GetString(); continue; } + if (property0.NameEquals("currentBackupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + currentBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("requestedBackupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + requestedBackupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("zoneRedundant")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + zoneRedundant = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("primaryUserAssignedIdentityId")) + { + primaryUserAssignedIdentityId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("keyId")) + { + keyId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("administrators")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + administrators = ManagedInstanceExternalAdministrator.DeserializeManagedInstanceExternalAdministrator(property0.Value); + continue; + } + if (property0.NameEquals("servicePrincipal")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + servicePrincipal = ServicePrincipal.DeserializeServicePrincipal(property0.Value); + continue; + } } continue; } } - return new ManagedInstance(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), identity.Value, sku.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(managedInstanceCreateMode), fullyQualifiedDomainName.Value, administratorLogin.Value, administratorLoginPassword.Value, subnetId.Value, state.Value, Optional.ToNullable(licenseType), Optional.ToNullable(vCores), Optional.ToNullable(storageSizeInGB), collation.Value, dnsZone.Value, dnsZonePartner.Value, Optional.ToNullable(publicDataEndpointEnabled), sourceManagedInstanceId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(proxyOverride), timezoneId.Value, instancePoolId.Value, maintenanceConfigurationId.Value, minimalTlsVersion.Value); + return new ManagedInstance(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), identity.Value, sku.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(managedInstanceCreateMode), fullyQualifiedDomainName.Value, administratorLogin.Value, administratorLoginPassword.Value, subnetId.Value, state.Value, Optional.ToNullable(licenseType), Optional.ToNullable(vCores), Optional.ToNullable(storageSizeInGB), collation.Value, dnsZone.Value, dnsZonePartner.Value, Optional.ToNullable(publicDataEndpointEnabled), sourceManagedInstanceId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(proxyOverride), timezoneId.Value, instancePoolId.Value, maintenanceConfigurationId.Value, Optional.ToList(privateEndpointConnections), minimalTlsVersion.Value, Optional.ToNullable(currentBackupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy), Optional.ToNullable(zoneRedundant), primaryUserAssignedIdentityId.Value, keyId.Value, administrators.Value, servicePrincipal.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstance.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstance.cs index d7ab8bffe4a1b..d4ff4ed3f9629 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstance.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstance.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using Azure.Core; namespace Azure.ResourceManager.Sql.Models { @@ -22,6 +23,8 @@ public ManagedInstance(string location) : base(location) { throw new ArgumentNullException(nameof(location)); } + + PrivateEndpointConnections = new ChangeTrackingList(); } /// Initializes a new instance of ManagedInstance. @@ -74,8 +77,16 @@ public ManagedInstance(string location) : base(location) /// /// The Id of the instance pool this managed server belongs to. /// Specifies maintenance configuration id to apply to this managed instance. + /// List of private endpoint connections on a managed instance. /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. - internal ManagedInstance(string id, string name, string type, string location, IDictionary tags, ResourceIdentity identity, Sku sku, ManagedInstancePropertiesProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, string administratorLogin, string administratorLoginPassword, string subnetId, string state, ManagedInstanceLicenseType? licenseType, int? vCores, int? storageSizeInGB, string collation, string dnsZone, string dnsZonePartner, bool? publicDataEndpointEnabled, string sourceManagedInstanceId, DateTimeOffset? restorePointInTime, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, string instancePoolId, string maintenanceConfigurationId, string minimalTlsVersion) : base(id, name, type, location, tags) + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + /// 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). + /// Whether or not the multi-az is enabled. + /// The resource id of a user assigned identity to be used by default. + /// A CMK URI of the key to use for encryption. + /// The Azure Active Directory administrator of the server. + /// The managed instance's service principal. + internal ManagedInstance(string id, string name, string type, string location, IDictionary tags, ResourceIdentity identity, Sku sku, ManagedInstancePropertiesProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, string administratorLogin, string administratorLoginPassword, string subnetId, string state, ManagedInstanceLicenseType? licenseType, int? vCores, int? storageSizeInGB, string collation, string dnsZone, string dnsZonePartner, bool? publicDataEndpointEnabled, string sourceManagedInstanceId, DateTimeOffset? restorePointInTime, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, string instancePoolId, string maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, BackupStorageRedundancy? currentBackupStorageRedundancy, BackupStorageRedundancy? requestedBackupStorageRedundancy, bool? zoneRedundant, string primaryUserAssignedIdentityId, string keyId, ManagedInstanceExternalAdministrator administrators, ServicePrincipal servicePrincipal) : base(id, name, type, location, tags) { Identity = identity; Sku = sku; @@ -99,7 +110,15 @@ internal ManagedInstance(string id, string name, string type, string location, I TimezoneId = timezoneId; InstancePoolId = instancePoolId; MaintenanceConfigurationId = maintenanceConfigurationId; + PrivateEndpointConnections = privateEndpointConnections; MinimalTlsVersion = minimalTlsVersion; + CurrentBackupStorageRedundancy = currentBackupStorageRedundancy; + RequestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + ZoneRedundant = zoneRedundant; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; + ServicePrincipal = servicePrincipal; } /// The Azure Active Directory identity of the managed instance. @@ -167,7 +186,23 @@ internal ManagedInstance(string id, string name, string type, string location, I public string InstancePoolId { get; set; } /// Specifies maintenance configuration id to apply to this managed instance. public string MaintenanceConfigurationId { get; set; } + /// List of private endpoint connections on a managed instance. + public IReadOnlyList PrivateEndpointConnections { get; } /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. public string MinimalTlsVersion { get; set; } + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + /// 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). + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + /// Whether or not the multi-az is enabled. + public bool? ZoneRedundant { get; set; } + /// The resource id of a user assigned identity to be used by default. + public string PrimaryUserAssignedIdentityId { get; set; } + /// A CMK URI of the key to use for encryption. + public string KeyId { get; set; } + /// The Azure Active Directory administrator of the server. + public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// The managed instance's service principal. + public ServicePrincipal ServicePrincipal { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthListResult.Serialization.cs new file mode 100644 index 0000000000000..fab93925a2af9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ManagedInstanceAzureADOnlyAuthListResult + { + internal static ManagedInstanceAzureADOnlyAuthListResult DeserializeManagedInstanceAzureADOnlyAuthListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedInstanceAzureADOnlyAuthentication.DeserializeManagedInstanceAzureADOnlyAuthentication(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedInstanceAzureADOnlyAuthListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthListResult.cs new file mode 100644 index 0000000000000..c4e588e206745 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of active directory only authentications. + internal partial class ManagedInstanceAzureADOnlyAuthListResult + { + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthListResult. + internal ManagedInstanceAzureADOnlyAuthListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ManagedInstanceAzureADOnlyAuthListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthentication.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthentication.Serialization.cs new file mode 100644 index 0000000000000..a3a4c6f1f20e8 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthentication.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstanceAzureADOnlyAuthentication : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(AzureADOnlyAuthentication)) + { + writer.WritePropertyName("azureADOnlyAuthentication"); + writer.WriteBooleanValue(AzureADOnlyAuthentication.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ManagedInstanceAzureADOnlyAuthentication DeserializeManagedInstanceAzureADOnlyAuthentication(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional azureADOnlyAuthentication = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("azureADOnlyAuthentication")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + azureADOnlyAuthentication = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + } + return new ManagedInstanceAzureADOnlyAuthentication(id.Value, name.Value, type.Value, Optional.ToNullable(azureADOnlyAuthentication)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthentication.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthentication.cs new file mode 100644 index 0000000000000..9af829a79b804 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceAzureADOnlyAuthentication.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Azure Active Directory only authentication. + public partial class ManagedInstanceAzureADOnlyAuthentication : ProxyResource + { + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthentication. + public ManagedInstanceAzureADOnlyAuthentication() + { + } + + /// Initializes a new instance of ManagedInstanceAzureADOnlyAuthentication. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Azure Active Directory only Authentication enabled. + internal ManagedInstanceAzureADOnlyAuthentication(string id, string name, string type, bool? azureADOnlyAuthentication) : base(id, name, type) + { + AzureADOnlyAuthentication = azureADOnlyAuthentication; + } + + /// Azure Active Directory only Authentication enabled. + public bool? AzureADOnlyAuthentication { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEditionCapability.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEditionCapability.Serialization.cs index e1d3ef84afe15..e4fd11b80d5f9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEditionCapability.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEditionCapability.Serialization.cs @@ -17,6 +17,8 @@ internal static ManagedInstanceEditionCapability DeserializeManagedInstanceEditi { Optional name = default; Optional> supportedFamilies = default; + Optional> supportedStorageCapabilities = default; + Optional zoneRedundant = default; Optional status = default; Optional reason = default; foreach (var property in element.EnumerateObject()) @@ -41,6 +43,31 @@ internal static ManagedInstanceEditionCapability DeserializeManagedInstanceEditi supportedFamilies = array; continue; } + if (property.NameEquals("supportedStorageCapabilities")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageCapability.DeserializeStorageCapability(item)); + } + supportedStorageCapabilities = array; + continue; + } + if (property.NameEquals("zoneRedundant")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + zoneRedundant = property.Value.GetBoolean(); + continue; + } if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -57,7 +84,7 @@ internal static ManagedInstanceEditionCapability DeserializeManagedInstanceEditi continue; } } - return new ManagedInstanceEditionCapability(name.Value, Optional.ToList(supportedFamilies), Optional.ToNullable(status), reason.Value); + return new ManagedInstanceEditionCapability(name.Value, Optional.ToList(supportedFamilies), Optional.ToList(supportedStorageCapabilities), Optional.ToNullable(zoneRedundant), Optional.ToNullable(status), reason.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEditionCapability.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEditionCapability.cs index 59941fe29036b..f2cf63d97cb1c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEditionCapability.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEditionCapability.cs @@ -17,17 +17,22 @@ public partial class ManagedInstanceEditionCapability internal ManagedInstanceEditionCapability() { SupportedFamilies = new ChangeTrackingList(); + SupportedStorageCapabilities = new ChangeTrackingList(); } /// Initializes a new instance of ManagedInstanceEditionCapability. /// The managed server version name. /// The supported families. + /// The list of supported storage capabilities for this edition. + /// Whether or not zone redundancy is supported for the edition. /// The status of the capability. /// The reason for the capability not being available. - internal ManagedInstanceEditionCapability(string name, IReadOnlyList supportedFamilies, CapabilityStatus? status, string reason) + internal ManagedInstanceEditionCapability(string name, IReadOnlyList supportedFamilies, IReadOnlyList supportedStorageCapabilities, bool? zoneRedundant, CapabilityStatus? status, string reason) { Name = name; SupportedFamilies = supportedFamilies; + SupportedStorageCapabilities = supportedStorageCapabilities; + ZoneRedundant = zoneRedundant; Status = status; Reason = reason; } @@ -36,6 +41,10 @@ internal ManagedInstanceEditionCapability(string name, IReadOnlyList The supported families. public IReadOnlyList SupportedFamilies { get; } + /// The list of supported storage capabilities for this edition. + public IReadOnlyList SupportedStorageCapabilities { get; } + /// Whether or not zone redundancy is supported for the edition. + public bool? ZoneRedundant { get; } /// The status of the capability. public CapabilityStatus? Status { get; } /// The reason for the capability not being available. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.Serialization.cs index 8c05a0c272500..3e68c85d8267a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.Serialization.cs @@ -27,6 +27,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("serverKeyType"); writer.WriteStringValue(ServerKeyType.Value.ToString()); } + if (Optional.IsDefined(AutoRotationEnabled)) + { + writer.WritePropertyName("autoRotationEnabled"); + writer.WriteBooleanValue(AutoRotationEnabled.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -41,6 +46,7 @@ internal static ManagedInstanceEncryptionProtector DeserializeManagedInstanceEnc Optional serverKeyType = default; Optional uri = default; Optional thumbprint = default; + Optional autoRotationEnabled = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind")) @@ -97,11 +103,21 @@ internal static ManagedInstanceEncryptionProtector DeserializeManagedInstanceEnc thumbprint = property0.Value.GetString(); continue; } + if (property0.NameEquals("autoRotationEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + autoRotationEnabled = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new ManagedInstanceEncryptionProtector(id.Value, name.Value, type.Value, kind.Value, serverKeyName.Value, Optional.ToNullable(serverKeyType), uri.Value, thumbprint.Value); + return new ManagedInstanceEncryptionProtector(id.Value, name.Value, type.Value, kind.Value, serverKeyName.Value, Optional.ToNullable(serverKeyType), uri.Value, thumbprint.Value, Optional.ToNullable(autoRotationEnabled)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs index ed677d0e416fe..78980b4871844 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs @@ -24,13 +24,15 @@ public ManagedInstanceEncryptionProtector() /// The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. /// The URI of the server key. /// Thumbprint of the server key. - internal ManagedInstanceEncryptionProtector(string id, string name, string type, string kind, string serverKeyName, ServerKeyType? serverKeyType, string uri, string thumbprint) : base(id, name, type) + /// Key auto rotation opt-in flag. Either true or false. + internal ManagedInstanceEncryptionProtector(string id, string name, string type, string kind, string serverKeyName, ServerKeyType? serverKeyType, string uri, string thumbprint, bool? autoRotationEnabled) : base(id, name, type) { Kind = kind; ServerKeyName = serverKeyName; ServerKeyType = serverKeyType; Uri = uri; Thumbprint = thumbprint; + AutoRotationEnabled = autoRotationEnabled; } /// Kind of encryption protector. This is metadata used for the Azure portal experience. @@ -43,5 +45,7 @@ internal ManagedInstanceEncryptionProtector(string id, string name, string type, public string Uri { get; } /// Thumbprint of the server key. public string Thumbprint { get; } + /// Key auto rotation opt-in flag. Either true or false. + public bool? AutoRotationEnabled { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.Serialization.cs new file mode 100644 index 0000000000000..5228f31b3daff --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.Serialization.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstanceExternalAdministrator : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AdministratorType)) + { + writer.WritePropertyName("administratorType"); + writer.WriteStringValue(AdministratorType.Value.ToString()); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("principalType"); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + if (Optional.IsDefined(Login)) + { + writer.WritePropertyName("login"); + writer.WriteStringValue(Login); + } + if (Optional.IsDefined(Sid)) + { + writer.WritePropertyName("sid"); + writer.WriteStringValue(Sid.Value); + } + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"); + writer.WriteStringValue(TenantId.Value); + } + if (Optional.IsDefined(AzureADOnlyAuthentication)) + { + writer.WritePropertyName("azureADOnlyAuthentication"); + writer.WriteBooleanValue(AzureADOnlyAuthentication.Value); + } + writer.WriteEndObject(); + } + + internal static ManagedInstanceExternalAdministrator DeserializeManagedInstanceExternalAdministrator(JsonElement element) + { + Optional administratorType = default; + Optional principalType = default; + Optional login = default; + Optional sid = default; + Optional tenantId = default; + Optional azureADOnlyAuthentication = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("administratorType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + administratorType = new AdministratorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("principalType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + principalType = new PrincipalType(property.Value.GetString()); + continue; + } + if (property.NameEquals("login")) + { + login = property.Value.GetString(); + continue; + } + if (property.NameEquals("sid")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + sid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tenantId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("azureADOnlyAuthentication")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + azureADOnlyAuthentication = property.Value.GetBoolean(); + continue; + } + } + return new ManagedInstanceExternalAdministrator(Optional.ToNullable(administratorType), Optional.ToNullable(principalType), login.Value, Optional.ToNullable(sid), Optional.ToNullable(tenantId), Optional.ToNullable(azureADOnlyAuthentication)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs new file mode 100644 index 0000000000000..06ae31c378814 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Properties of a active directory administrator. + public partial class ManagedInstanceExternalAdministrator + { + /// Initializes a new instance of ManagedInstanceExternalAdministrator. + public ManagedInstanceExternalAdministrator() + { + } + + /// Initializes a new instance of ManagedInstanceExternalAdministrator. + /// Type of the sever administrator. + /// Principal Type of the sever administrator. + /// Login name of the server administrator. + /// SID (object ID) of the server administrator. + /// Tenant ID of the administrator. + /// Azure Active Directory only Authentication enabled. + internal ManagedInstanceExternalAdministrator(AdministratorType? administratorType, PrincipalType? principalType, string login, Guid? sid, Guid? tenantId, bool? azureADOnlyAuthentication) + { + AdministratorType = administratorType; + PrincipalType = principalType; + Login = login; + Sid = sid; + TenantId = tenantId; + AzureADOnlyAuthentication = azureADOnlyAuthentication; + } + + /// Type of the sever administrator. + public AdministratorType? AdministratorType { get; set; } + /// Principal Type of the sever administrator. + public PrincipalType? PrincipalType { get; set; } + /// Login name of the server administrator. + public string Login { get; set; } + /// SID (object ID) of the server administrator. + public Guid? Sid { get; set; } + /// Tenant ID of the administrator. + public Guid? TenantId { get; set; } + /// Azure Active Directory only Authentication enabled. + public bool? AzureADOnlyAuthentication { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceKey.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceKey.Serialization.cs index 04ba46a8ef133..246c95d1425d3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceKey.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceKey.Serialization.cs @@ -42,6 +42,7 @@ internal static ManagedInstanceKey DeserializeManagedInstanceKey(JsonElement ele Optional uri = default; Optional thumbprint = default; Optional creationDate = default; + Optional autoRotationEnabled = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind")) @@ -103,11 +104,21 @@ internal static ManagedInstanceKey DeserializeManagedInstanceKey(JsonElement ele creationDate = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("autoRotationEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + autoRotationEnabled = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new ManagedInstanceKey(id.Value, name.Value, type.Value, kind.Value, Optional.ToNullable(serverKeyType), uri.Value, thumbprint.Value, Optional.ToNullable(creationDate)); + return new ManagedInstanceKey(id.Value, name.Value, type.Value, kind.Value, Optional.ToNullable(serverKeyType), uri.Value, thumbprint.Value, Optional.ToNullable(creationDate), Optional.ToNullable(autoRotationEnabled)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceKey.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceKey.cs index 6362189c9e773..5958aa8c1016a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceKey.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceKey.cs @@ -26,13 +26,15 @@ public ManagedInstanceKey() /// The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. /// Thumbprint of the key. /// The key creation date. - internal ManagedInstanceKey(string id, string name, string type, string kind, ServerKeyType? serverKeyType, string uri, string thumbprint, DateTimeOffset? creationDate) : base(id, name, type) + /// Key auto rotation opt-in flag. Either true or false. + internal ManagedInstanceKey(string id, string name, string type, string kind, ServerKeyType? serverKeyType, string uri, string thumbprint, DateTimeOffset? creationDate, bool? autoRotationEnabled) : base(id, name, type) { Kind = kind; ServerKeyType = serverKeyType; Uri = uri; Thumbprint = thumbprint; CreationDate = creationDate; + AutoRotationEnabled = autoRotationEnabled; } /// Kind of encryption protector. This is metadata used for the Azure portal experience. @@ -45,5 +47,7 @@ internal ManagedInstanceKey(string id, string name, string type, string kind, Se public string Thumbprint { get; } /// The key creation date. public DateTimeOffset? CreationDate { get; } + /// Key auto rotation opt-in flag. Either true or false. + public bool? AutoRotationEnabled { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.Serialization.cs index 9c9080e51598f..9bced9bdcf514 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.Serialization.cs @@ -33,6 +33,7 @@ internal static ManagedInstanceLongTermRetentionBackup DeserializeManagedInstanc Optional databaseDeletionTime = default; Optional backupTime = default; Optional backupExpirationTime = default; + Optional backupStorageRedundancy = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -109,11 +110,21 @@ internal static ManagedInstanceLongTermRetentionBackup DeserializeManagedInstanc backupExpirationTime = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("backupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + backupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } } continue; } } - return new ManagedInstanceLongTermRetentionBackup(id.Value, name.Value, type.Value, managedInstanceName.Value, Optional.ToNullable(managedInstanceCreateTime), databaseName.Value, Optional.ToNullable(databaseDeletionTime), Optional.ToNullable(backupTime), Optional.ToNullable(backupExpirationTime)); + return new ManagedInstanceLongTermRetentionBackup(id.Value, name.Value, type.Value, managedInstanceName.Value, Optional.ToNullable(managedInstanceCreateTime), databaseName.Value, Optional.ToNullable(databaseDeletionTime), Optional.ToNullable(backupTime), Optional.ToNullable(backupExpirationTime), Optional.ToNullable(backupStorageRedundancy)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs index 360e51f6d4c7f..0c1ee7e335c3b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs @@ -27,7 +27,8 @@ public ManagedInstanceLongTermRetentionBackup() /// The delete time of the database. /// The time the backup was taken. /// The time the long term retention backup will expire. - internal ManagedInstanceLongTermRetentionBackup(string id, string name, string type, string managedInstanceName, DateTimeOffset? managedInstanceCreateTime, string databaseName, DateTimeOffset? databaseDeletionTime, DateTimeOffset? backupTime, DateTimeOffset? backupExpirationTime) : base(id, name, type) + /// The storage redundancy type of the backup. + internal ManagedInstanceLongTermRetentionBackup(string id, string name, string type, string managedInstanceName, DateTimeOffset? managedInstanceCreateTime, string databaseName, DateTimeOffset? databaseDeletionTime, DateTimeOffset? backupTime, DateTimeOffset? backupExpirationTime, BackupStorageRedundancy? backupStorageRedundancy) : base(id, name, type) { ManagedInstanceName = managedInstanceName; ManagedInstanceCreateTime = managedInstanceCreateTime; @@ -35,6 +36,7 @@ internal ManagedInstanceLongTermRetentionBackup(string id, string name, string t DatabaseDeletionTime = databaseDeletionTime; BackupTime = backupTime; BackupExpirationTime = backupExpirationTime; + BackupStorageRedundancy = backupStorageRedundancy; } /// The managed instance that the backup database belongs to. @@ -49,5 +51,7 @@ internal ManagedInstanceLongTermRetentionBackup(string id, string name, string t public DateTimeOffset? BackupTime { get; } /// The time the long term retention backup will expire. public DateTimeOffset? BackupExpirationTime { get; } + /// The storage redundancy type of the backup. + public BackupStorageRedundancy? BackupStorageRedundancy { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceMaintenanceConfigurationCapability.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceMaintenanceConfigurationCapability.Serialization.cs new file mode 100644 index 0000000000000..84fd5063437e3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceMaintenanceConfigurationCapability.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstanceMaintenanceConfigurationCapability + { + internal static ManagedInstanceMaintenanceConfigurationCapability DeserializeManagedInstanceMaintenanceConfigurationCapability(JsonElement element) + { + Optional name = default; + Optional status = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = property.Value.GetString().ToCapabilityStatus(); + continue; + } + if (property.NameEquals("reason")) + { + reason = property.Value.GetString(); + continue; + } + } + return new ManagedInstanceMaintenanceConfigurationCapability(name.Value, Optional.ToNullable(status), reason.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceMaintenanceConfigurationCapability.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceMaintenanceConfigurationCapability.cs new file mode 100644 index 0000000000000..171ffbe3630fa --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceMaintenanceConfigurationCapability.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The maintenance configuration capability. + public partial class ManagedInstanceMaintenanceConfigurationCapability + { + /// Initializes a new instance of ManagedInstanceMaintenanceConfigurationCapability. + internal ManagedInstanceMaintenanceConfigurationCapability() + { + } + + /// Initializes a new instance of ManagedInstanceMaintenanceConfigurationCapability. + /// Maintenance configuration name. + /// The status of the capability. + /// The reason for the capability not being available. + internal ManagedInstanceMaintenanceConfigurationCapability(string name, CapabilityStatus? status, string reason) + { + Name = name; + Status = status; + Reason = reason; + } + + /// Maintenance configuration name. + public string Name { get; } + /// The status of the capability. + public CapabilityStatus? Status { get; } + /// The reason for the capability not being available. + public string Reason { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePecProperty.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePecProperty.Serialization.cs new file mode 100644 index 0000000000000..c2f1d24cc9906 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePecProperty.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstancePecProperty + { + internal static ManagedInstancePecProperty DeserializeManagedInstancePecProperty(JsonElement element) + { + Optional id = default; + Optional properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = ManagedInstancePrivateEndpointConnectionProperties.DeserializeManagedInstancePrivateEndpointConnectionProperties(property.Value); + continue; + } + } + return new ManagedInstancePecProperty(id.Value, properties.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePecProperty.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePecProperty.cs new file mode 100644 index 0000000000000..8a69dcfdc1832 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePecProperty.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A private endpoint connection under a managed instance. + public partial class ManagedInstancePecProperty + { + /// Initializes a new instance of ManagedInstancePecProperty. + internal ManagedInstancePecProperty() + { + } + + /// Initializes a new instance of ManagedInstancePecProperty. + /// Resource ID. + /// Private endpoint connection properties. + internal ManagedInstancePecProperty(string id, ManagedInstancePrivateEndpointConnectionProperties properties) + { + Id = id; + Properties = properties; + } + + /// Resource ID. + public string Id { get; } + /// Private endpoint connection properties. + public ManagedInstancePrivateEndpointConnectionProperties Properties { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.Serialization.cs new file mode 100644 index 0000000000000..d1f209e4fd6d2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.Serialization.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstancePrivateEndpointConnection : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"); + writer.WriteObjectValue(PrivateEndpoint); + } + if (Optional.IsDefined(PrivateLinkServiceConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"); + writer.WriteObjectValue(PrivateLinkServiceConnectionState); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ManagedInstancePrivateEndpointConnection DeserializeManagedInstancePrivateEndpointConnection(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional privateEndpoint = default; + Optional privateLinkServiceConnectionState = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("privateEndpoint")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + privateEndpoint = ManagedInstancePrivateEndpointProperty.DeserializeManagedInstancePrivateEndpointProperty(property0.Value); + continue; + } + if (property0.NameEquals("privateLinkServiceConnectionState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + privateLinkServiceConnectionState = ManagedInstancePrivateLinkServiceConnectionStateProperty.DeserializeManagedInstancePrivateLinkServiceConnectionStateProperty(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState")) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ManagedInstancePrivateEndpointConnection(id.Value, name.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, provisioningState.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs new file mode 100644 index 0000000000000..da7fb5cb22572 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A private endpoint connection. + public partial class ManagedInstancePrivateEndpointConnection : ProxyResource + { + /// Initializes a new instance of ManagedInstancePrivateEndpointConnection. + public ManagedInstancePrivateEndpointConnection() + { + } + + /// Initializes a new instance of ManagedInstancePrivateEndpointConnection. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Private endpoint which the connection belongs to. + /// Connection State of the Private Endpoint Connection. + /// State of the Private Endpoint Connection. + internal ManagedInstancePrivateEndpointConnection(string id, string name, string type, ManagedInstancePrivateEndpointProperty privateEndpoint, ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState, string provisioningState) : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + } + + /// Private endpoint which the connection belongs to. + public ManagedInstancePrivateEndpointProperty PrivateEndpoint { get; set; } + /// Connection State of the Private Endpoint Connection. + public ManagedInstancePrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } + /// State of the Private Endpoint Connection. + public string ProvisioningState { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionListResult.Serialization.cs new file mode 100644 index 0000000000000..ae4f21d5b1f8b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ManagedInstancePrivateEndpointConnectionListResult + { + internal static ManagedInstancePrivateEndpointConnectionListResult DeserializeManagedInstancePrivateEndpointConnectionListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedInstancePrivateEndpointConnection.DeserializeManagedInstancePrivateEndpointConnection(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedInstancePrivateEndpointConnectionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionListResult.cs new file mode 100644 index 0000000000000..d610b11d69c72 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of private endpoint connections. + internal partial class ManagedInstancePrivateEndpointConnectionListResult + { + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionListResult. + internal ManagedInstancePrivateEndpointConnectionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ManagedInstancePrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionProperties.Serialization.cs new file mode 100644 index 0000000000000..06bb68dee229b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionProperties.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstancePrivateEndpointConnectionProperties + { + internal static ManagedInstancePrivateEndpointConnectionProperties DeserializeManagedInstancePrivateEndpointConnectionProperties(JsonElement element) + { + Optional privateEndpoint = default; + Optional privateLinkServiceConnectionState = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("privateEndpoint")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + privateEndpoint = ManagedInstancePrivateEndpointProperty.DeserializeManagedInstancePrivateEndpointProperty(property.Value); + continue; + } + if (property.NameEquals("privateLinkServiceConnectionState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + privateLinkServiceConnectionState = ManagedInstancePrivateLinkServiceConnectionStateProperty.DeserializeManagedInstancePrivateLinkServiceConnectionStateProperty(property.Value); + continue; + } + if (property.NameEquals("provisioningState")) + { + provisioningState = property.Value.GetString(); + continue; + } + } + return new ManagedInstancePrivateEndpointConnectionProperties(privateEndpoint.Value, privateLinkServiceConnectionState.Value, provisioningState.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionProperties.cs new file mode 100644 index 0000000000000..0895de6ab6ab7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnectionProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Properties of a private endpoint connection. + public partial class ManagedInstancePrivateEndpointConnectionProperties + { + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionProperties. + internal ManagedInstancePrivateEndpointConnectionProperties() + { + } + + /// Initializes a new instance of ManagedInstancePrivateEndpointConnectionProperties. + /// Private endpoint which the connection belongs to. + /// Connection State of the Private Endpoint Connection. + /// State of the Private Endpoint Connection. + internal ManagedInstancePrivateEndpointConnectionProperties(ManagedInstancePrivateEndpointProperty privateEndpoint, ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState, string provisioningState) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + } + + /// Private endpoint which the connection belongs to. + public ManagedInstancePrivateEndpointProperty PrivateEndpoint { get; } + /// Connection State of the Private Endpoint Connection. + public ManagedInstancePrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; } + /// State of the Private Endpoint Connection. + public string ProvisioningState { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointProperty.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointProperty.Serialization.cs new file mode 100644 index 0000000000000..41cc8abff799f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointProperty.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstancePrivateEndpointProperty : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } + writer.WriteEndObject(); + } + + internal static ManagedInstancePrivateEndpointProperty DeserializeManagedInstancePrivateEndpointProperty(JsonElement element) + { + Optional id = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + } + return new ManagedInstancePrivateEndpointProperty(id.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointProperty.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointProperty.cs new file mode 100644 index 0000000000000..bdaf05312d3a2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateEndpointProperty.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The ManagedInstancePrivateEndpointProperty. + public partial class ManagedInstancePrivateEndpointProperty + { + /// Initializes a new instance of ManagedInstancePrivateEndpointProperty. + public ManagedInstancePrivateEndpointProperty() + { + } + + /// Initializes a new instance of ManagedInstancePrivateEndpointProperty. + /// Resource id of the private endpoint. + internal ManagedInstancePrivateEndpointProperty(string id) + { + Id = id; + } + + /// Resource id of the private endpoint. + public string Id { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLink.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLink.Serialization.cs new file mode 100644 index 0000000000000..b061b9436fef3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLink.Serialization.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstancePrivateLink : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static ManagedInstancePrivateLink DeserializeManagedInstancePrivateLink(JsonElement element) + { + Optional properties = default; + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = ManagedInstancePrivateLinkProperties.DeserializeManagedInstancePrivateLinkProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new ManagedInstancePrivateLink(id.Value, name.Value, type.Value, properties.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs new file mode 100644 index 0000000000000..5f9351c3eec46 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A private link resource. + public partial class ManagedInstancePrivateLink : ProxyResource + { + /// Initializes a new instance of ManagedInstancePrivateLink. + public ManagedInstancePrivateLink() + { + } + + /// Initializes a new instance of ManagedInstancePrivateLink. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The private link resource group id. + internal ManagedInstancePrivateLink(string id, string name, string type, ManagedInstancePrivateLinkProperties properties) : base(id, name, type) + { + Properties = properties; + } + + /// The private link resource group id. + public ManagedInstancePrivateLinkProperties Properties { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkListResult.Serialization.cs new file mode 100644 index 0000000000000..1de499e5e9954 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ManagedInstancePrivateLinkListResult + { + internal static ManagedInstancePrivateLinkListResult DeserializeManagedInstancePrivateLinkListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedInstancePrivateLink.DeserializeManagedInstancePrivateLink(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedInstancePrivateLinkListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkListResult.cs new file mode 100644 index 0000000000000..62d5741220b5e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of private link resources. + internal partial class ManagedInstancePrivateLinkListResult + { + /// Initializes a new instance of ManagedInstancePrivateLinkListResult. + internal ManagedInstancePrivateLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedInstancePrivateLinkListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ManagedInstancePrivateLinkListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.Serialization.cs new file mode 100644 index 0000000000000..058c220a980e4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstancePrivateLinkProperties + { + internal static ManagedInstancePrivateLinkProperties DeserializeManagedInstancePrivateLinkProperties(JsonElement element) + { + Optional groupId = default; + Optional> requiredMembers = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupId")) + { + groupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredMembers")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredMembers = array; + continue; + } + } + return new ManagedInstancePrivateLinkProperties(groupId.Value, Optional.ToList(requiredMembers)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs new file mode 100644 index 0000000000000..ce11d6f374400 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Properties of a private link resource. + public partial class ManagedInstancePrivateLinkProperties + { + /// Initializes a new instance of ManagedInstancePrivateLinkProperties. + internal ManagedInstancePrivateLinkProperties() + { + RequiredMembers = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedInstancePrivateLinkProperties. + /// The private link resource group id. + /// The private link resource required member names. + internal ManagedInstancePrivateLinkProperties(string groupId, IReadOnlyList requiredMembers) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + } + + /// The private link resource group id. + public string GroupId { get; } + /// The private link resource required member names. + public IReadOnlyList RequiredMembers { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkServiceConnectionStateProperty.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkServiceConnectionStateProperty.Serialization.cs new file mode 100644 index 0000000000000..1c58cea596bfb --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkServiceConnectionStateProperty.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstancePrivateLinkServiceConnectionStateProperty : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("status"); + writer.WriteStringValue(Status); + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + writer.WriteEndObject(); + } + + internal static ManagedInstancePrivateLinkServiceConnectionStateProperty DeserializeManagedInstancePrivateLinkServiceConnectionStateProperty(JsonElement element) + { + string status = default; + string description = default; + Optional actionsRequired = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status")) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("description")) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionsRequired")) + { + actionsRequired = property.Value.GetString(); + continue; + } + } + return new ManagedInstancePrivateLinkServiceConnectionStateProperty(status, description, actionsRequired.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkServiceConnectionStateProperty.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkServiceConnectionStateProperty.cs index d7bc1e670be89..d987279c2d910 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkServiceConnectionStateProperty.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePrivateLinkServiceConnectionStateProperty.cs @@ -10,13 +10,13 @@ namespace Azure.ResourceManager.Sql.Models { /// The ManagedInstancePrivateLinkServiceConnectionStateProperty. - internal partial class ManagedInstancePrivateLinkServiceConnectionStateProperty + public partial class ManagedInstancePrivateLinkServiceConnectionStateProperty { /// Initializes a new instance of ManagedInstancePrivateLinkServiceConnectionStateProperty. /// The private link service connection status. /// The private link service connection description. /// or is null. - internal ManagedInstancePrivateLinkServiceConnectionStateProperty(string status, string description) + public ManagedInstancePrivateLinkServiceConnectionStateProperty(string status, string description) { if (status == null) { @@ -31,10 +31,21 @@ internal ManagedInstancePrivateLinkServiceConnectionStateProperty(string status, Description = description; } + /// Initializes a new instance of ManagedInstancePrivateLinkServiceConnectionStateProperty. + /// The private link service connection status. + /// The private link service connection description. + /// The private link service connection description. + internal ManagedInstancePrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + } + /// The private link service connection status. - public string Status { get; } + public string Status { get; set; } /// The private link service connection description. - public string Description { get; } + public string Description { get; set; } /// The private link service connection description. public string ActionsRequired { get; } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs index bede27dcbc767..bdfe98f728b61 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs @@ -28,6 +28,15 @@ public ManagedInstancePropertiesProvisioningState(string value) private const string UnknownValue = "Unknown"; private const string SucceededValue = "Succeeded"; private const string FailedValue = "Failed"; + private const string AcceptedValue = "Accepted"; + private const string CreatedValue = "Created"; + private const string DeletedValue = "Deleted"; + private const string UnrecognizedValue = "Unrecognized"; + private const string RunningValue = "Running"; + private const string CanceledValue = "Canceled"; + private const string NotSpecifiedValue = "NotSpecified"; + private const string RegisteringValue = "Registering"; + private const string TimedOutValue = "TimedOut"; /// Creating. public static ManagedInstancePropertiesProvisioningState Creating { get; } = new ManagedInstancePropertiesProvisioningState(CreatingValue); @@ -41,6 +50,24 @@ public ManagedInstancePropertiesProvisioningState(string value) public static ManagedInstancePropertiesProvisioningState Succeeded { get; } = new ManagedInstancePropertiesProvisioningState(SucceededValue); /// Failed. public static ManagedInstancePropertiesProvisioningState Failed { get; } = new ManagedInstancePropertiesProvisioningState(FailedValue); + /// Accepted. + public static ManagedInstancePropertiesProvisioningState Accepted { get; } = new ManagedInstancePropertiesProvisioningState(AcceptedValue); + /// Created. + public static ManagedInstancePropertiesProvisioningState Created { get; } = new ManagedInstancePropertiesProvisioningState(CreatedValue); + /// Deleted. + public static ManagedInstancePropertiesProvisioningState Deleted { get; } = new ManagedInstancePropertiesProvisioningState(DeletedValue); + /// Unrecognized. + public static ManagedInstancePropertiesProvisioningState Unrecognized { get; } = new ManagedInstancePropertiesProvisioningState(UnrecognizedValue); + /// Running. + public static ManagedInstancePropertiesProvisioningState Running { get; } = new ManagedInstancePropertiesProvisioningState(RunningValue); + /// Canceled. + public static ManagedInstancePropertiesProvisioningState Canceled { get; } = new ManagedInstancePropertiesProvisioningState(CanceledValue); + /// NotSpecified. + public static ManagedInstancePropertiesProvisioningState NotSpecified { get; } = new ManagedInstancePropertiesProvisioningState(NotSpecifiedValue); + /// Registering. + public static ManagedInstancePropertiesProvisioningState Registering { get; } = new ManagedInstancePropertiesProvisioningState(RegisteringValue); + /// TimedOut. + public static ManagedInstancePropertiesProvisioningState TimedOut { get; } = new ManagedInstancePropertiesProvisioningState(TimedOutValue); /// Determines if two values are the same. public static bool operator ==(ManagedInstancePropertiesProvisioningState left, ManagedInstancePropertiesProvisioningState right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQuery.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQuery.Serialization.cs new file mode 100644 index 0000000000000..b10e17a6809e5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQuery.Serialization.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedInstanceQuery : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(QueryText)) + { + writer.WritePropertyName("queryText"); + writer.WriteStringValue(QueryText); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ManagedInstanceQuery DeserializeManagedInstanceQuery(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional queryText = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("queryText")) + { + queryText = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ManagedInstanceQuery(id.Value, name.Value, type.Value, queryText.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQuery.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQuery.cs new file mode 100644 index 0000000000000..f4018e894d80a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQuery.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Database query. + public partial class ManagedInstanceQuery : ProxyResource + { + /// Initializes a new instance of ManagedInstanceQuery. + public ManagedInstanceQuery() + { + } + + /// Initializes a new instance of ManagedInstanceQuery. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Query text. + internal ManagedInstanceQuery(string id, string name, string type, string queryText) : base(id, name, type) + { + QueryText = queryText; + } + + /// Query text. + public string QueryText { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQueryStatistics.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQueryStatistics.Serialization.cs new file mode 100644 index 0000000000000..2731b798856fd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQueryStatistics.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ManagedInstanceQueryStatistics + { + internal static ManagedInstanceQueryStatistics DeserializeManagedInstanceQueryStatistics(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QueryStatistics.DeserializeQueryStatistics(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedInstanceQueryStatistics(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQueryStatistics.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQueryStatistics.cs new file mode 100644 index 0000000000000..6169c1767e6ad --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceQueryStatistics.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Execution statistics for one particular query. + internal partial class ManagedInstanceQueryStatistics + { + /// Initializes a new instance of ManagedInstanceQueryStatistics. + internal ManagedInstanceQueryStatistics() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedInstanceQueryStatistics. + /// Array of results. + /// Link to retrieve next page of results. + internal ManagedInstanceQueryStatistics(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.Serialization.cs index c7378be6e5916..4d1b3a23c7b6c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.Serialization.cs @@ -20,6 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"); @@ -118,6 +123,36 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("minimalTlsVersion"); writer.WriteStringValue(MinimalTlsVersion); } + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) + { + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); + } + if (Optional.IsDefined(ZoneRedundant)) + { + writer.WritePropertyName("zoneRedundant"); + writer.WriteBooleanValue(ZoneRedundant.Value); + } + if (Optional.IsDefined(PrimaryUserAssignedIdentityId)) + { + writer.WritePropertyName("primaryUserAssignedIdentityId"); + writer.WriteStringValue(PrimaryUserAssignedIdentityId); + } + if (Optional.IsDefined(KeyId)) + { + writer.WritePropertyName("keyId"); + writer.WriteStringValue(KeyId); + } + if (Optional.IsDefined(Administrators)) + { + writer.WritePropertyName("administrators"); + writer.WriteObjectValue(Administrators); + } + if (Optional.IsDefined(ServicePrincipal)) + { + writer.WritePropertyName("servicePrincipal"); + writer.WriteObjectValue(ServicePrincipal); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.cs index 9459d48f7f14b..9ee0be3049373 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceUpdate.cs @@ -18,10 +18,13 @@ public partial class ManagedInstanceUpdate public ManagedInstanceUpdate() { Tags = new ChangeTrackingDictionary(); + PrivateEndpointConnections = new ChangeTrackingList(); } /// Managed instance sku. public Sku Sku { get; set; } + /// Managed instance identity. + public ResourceIdentity Identity { get; set; } /// Resource tags. public IDictionary Tags { get; } public ManagedInstancePropertiesProvisioningState? ProvisioningState { get; } @@ -85,7 +88,23 @@ public ManagedInstanceUpdate() public string InstancePoolId { get; set; } /// Specifies maintenance configuration id to apply to this managed instance. public string MaintenanceConfigurationId { get; set; } + /// List of private endpoint connections on a managed instance. + public IReadOnlyList PrivateEndpointConnections { get; } /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. public string MinimalTlsVersion { get; set; } + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + public BackupStorageRedundancy? CurrentBackupStorageRedundancy { get; } + /// 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). + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + /// Whether or not the multi-az is enabled. + public bool? ZoneRedundant { get; set; } + /// The resource id of a user assigned identity to be used by default. + public string PrimaryUserAssignedIdentityId { get; set; } + /// A CMK URI of the key to use for encryption. + public string KeyId { get; set; } + /// The Azure Active Directory administrator of the server. + public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// The managed instance's service principal. + public ServicePrincipal ServicePrincipal { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVcoresCapability.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVcoresCapability.Serialization.cs index c661b1870bed8..08d911c350f32 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVcoresCapability.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVcoresCapability.Serialization.cs @@ -21,6 +21,7 @@ internal static ManagedInstanceVcoresCapability DeserializeManagedInstanceVcores Optional> supportedStorageSizes = default; Optional instancePoolSupported = default; Optional standaloneSupported = default; + Optional> supportedMaintenanceConfigurations = default; Optional status = default; Optional reason = default; foreach (var property in element.EnumerateObject()) @@ -85,6 +86,21 @@ internal static ManagedInstanceVcoresCapability DeserializeManagedInstanceVcores standaloneSupported = property.Value.GetBoolean(); continue; } + if (property.NameEquals("supportedMaintenanceConfigurations")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedInstanceMaintenanceConfigurationCapability.DeserializeManagedInstanceMaintenanceConfigurationCapability(item)); + } + supportedMaintenanceConfigurations = array; + continue; + } if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -101,7 +117,7 @@ internal static ManagedInstanceVcoresCapability DeserializeManagedInstanceVcores continue; } } - return new ManagedInstanceVcoresCapability(name.Value, Optional.ToNullable(value), includedMaxSize.Value, Optional.ToList(supportedStorageSizes), Optional.ToNullable(instancePoolSupported), Optional.ToNullable(standaloneSupported), Optional.ToNullable(status), reason.Value); + return new ManagedInstanceVcoresCapability(name.Value, Optional.ToNullable(value), includedMaxSize.Value, Optional.ToList(supportedStorageSizes), Optional.ToNullable(instancePoolSupported), Optional.ToNullable(standaloneSupported), Optional.ToList(supportedMaintenanceConfigurations), Optional.ToNullable(status), reason.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVcoresCapability.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVcoresCapability.cs index 46bfa2874ed65..96d8fcc1e6129 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVcoresCapability.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVcoresCapability.cs @@ -17,6 +17,7 @@ public partial class ManagedInstanceVcoresCapability internal ManagedInstanceVcoresCapability() { SupportedStorageSizes = new ChangeTrackingList(); + SupportedMaintenanceConfigurations = new ChangeTrackingList(); } /// Initializes a new instance of ManagedInstanceVcoresCapability. @@ -26,9 +27,10 @@ internal ManagedInstanceVcoresCapability() /// Storage size ranges. /// True if this service objective is supported for managed instances in an instance pool. /// True if this service objective is supported for standalone managed instances. + /// List of supported maintenance configurations. /// The status of the capability. /// The reason for the capability not being available. - internal ManagedInstanceVcoresCapability(string name, int? value, MaxSizeCapability includedMaxSize, IReadOnlyList supportedStorageSizes, bool? instancePoolSupported, bool? standaloneSupported, CapabilityStatus? status, string reason) + internal ManagedInstanceVcoresCapability(string name, int? value, MaxSizeCapability includedMaxSize, IReadOnlyList supportedStorageSizes, bool? instancePoolSupported, bool? standaloneSupported, IReadOnlyList supportedMaintenanceConfigurations, CapabilityStatus? status, string reason) { Name = name; Value = value; @@ -36,6 +38,7 @@ internal ManagedInstanceVcoresCapability(string name, int? value, MaxSizeCapabil SupportedStorageSizes = supportedStorageSizes; InstancePoolSupported = instancePoolSupported; StandaloneSupported = standaloneSupported; + SupportedMaintenanceConfigurations = supportedMaintenanceConfigurations; Status = status; Reason = reason; } @@ -52,6 +55,8 @@ internal ManagedInstanceVcoresCapability(string name, int? value, MaxSizeCapabil public bool? InstancePoolSupported { get; } /// True if this service objective is supported for standalone managed instances. public bool? StandaloneSupported { get; } + /// List of supported maintenance configurations. + public IReadOnlyList SupportedMaintenanceConfigurations { get; } /// The status of the capability. public CapabilityStatus? Status { get; } /// The reason for the capability not being available. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs index 77ffd1b516f6a..4023678dc33be 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs @@ -20,8 +20,8 @@ public ManagedInstanceVulnerabilityAssessment() /// Resource name. /// Resource type. /// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - /// A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - /// Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + /// 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. + /// 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. /// The recurring scans settings. internal ManagedInstanceVulnerabilityAssessment(string id, string name, string type, string storageContainerPath, string storageContainerSasKey, string storageAccountAccessKey, VulnerabilityAssessmentRecurringScansProperties recurringScans) : base(id, name, type) { @@ -33,9 +33,9 @@ internal ManagedInstanceVulnerabilityAssessment(string id, string name, string t /// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). public string StorageContainerPath { get; set; } - /// A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + /// 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. public string StorageContainerSasKey { get; set; } - /// Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + /// 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. public string StorageAccountAccessKey { get; set; } /// The recurring scans settings. public VulnerabilityAssessmentRecurringScansProperties RecurringScans { get; set; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.Serialization.cs index 6fcc4a593a928..6e9dbdbed0b51 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.Serialization.cs @@ -70,10 +70,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ManagedServerSecurityAlertPolicy DeserializeManagedServerSecurityAlertPolicy(JsonElement element) { + Optional systemData = default; Optional id = default; Optional name = default; Optional type = default; - Optional state = default; + Optional state = default; Optional> disabledAlerts = default; Optional> emailAddresses = default; Optional emailAccountAdmins = default; @@ -83,6 +84,16 @@ internal static ManagedServerSecurityAlertPolicy DeserializeManagedServerSecurit Optional creationTime = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = SystemData.DeserializeSystemData(property.Value); + continue; + } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -114,7 +125,7 @@ internal static ManagedServerSecurityAlertPolicy DeserializeManagedServerSecurit property0.ThrowNonNullablePropertyIsNull(); continue; } - state = property0.Value.GetString().ToSecurityAlertPolicyState(); + state = property0.Value.GetString().ToSecurityAlertsPolicyState(); continue; } if (property0.NameEquals("disabledAlerts")) @@ -191,7 +202,7 @@ internal static ManagedServerSecurityAlertPolicy DeserializeManagedServerSecurit continue; } } - return new ManagedServerSecurityAlertPolicy(id.Value, name.Value, type.Value, Optional.ToNullable(state), Optional.ToList(disabledAlerts), Optional.ToList(emailAddresses), Optional.ToNullable(emailAccountAdmins), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToNullable(creationTime)); + return new ManagedServerSecurityAlertPolicy(id.Value, name.Value, type.Value, systemData.Value, Optional.ToNullable(state), Optional.ToList(disabledAlerts), Optional.ToList(emailAddresses), Optional.ToNullable(emailAccountAdmins), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToNullable(creationTime)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs index 4cd7458bbf0f3..1cfdf689f38cc 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs @@ -25,16 +25,18 @@ public ManagedServerSecurityAlertPolicy() /// Resource ID. /// Resource name. /// Resource type. + /// SystemData of SecurityAlertPolicyResource. /// Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. - /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. /// Specifies an array of e-mail addresses to which the alert is sent. /// Specifies that the alert is sent to the account administrators. /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. /// Specifies the identifier key of the Threat Detection audit storage account. /// Specifies the number of days to keep in the Threat Detection audit logs. /// Specifies the UTC creation time of the policy. - internal ManagedServerSecurityAlertPolicy(string id, string name, string type, SecurityAlertPolicyState? state, IList disabledAlerts, IList emailAddresses, bool? emailAccountAdmins, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, DateTimeOffset? creationTime) : base(id, name, type) + internal ManagedServerSecurityAlertPolicy(string id, string name, string type, SystemData systemData, SecurityAlertsPolicyState? state, IList disabledAlerts, IList emailAddresses, bool? emailAccountAdmins, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, DateTimeOffset? creationTime) : base(id, name, type) { + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -45,9 +47,11 @@ internal ManagedServerSecurityAlertPolicy(string id, string name, string type, S CreationTime = creationTime; } + /// SystemData of SecurityAlertPolicyResource. + public SystemData SystemData { get; } /// Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. - public SecurityAlertPolicyState? State { get; set; } - /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + public SecurityAlertsPolicyState? State { get; set; } + /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. public IList DisabledAlerts { get; } /// Specifies an array of e-mail addresses to which the alert is sent. public IList EmailAddresses { get; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryption.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryption.Serialization.cs new file mode 100644 index 0000000000000..0cbfe654d7979 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryption.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ManagedTransparentDataEncryption : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToSerialString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ManagedTransparentDataEncryption DeserializeManagedTransparentDataEncryption(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional state = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("state")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + state = property0.Value.GetString().ToTransparentDataEncryptionState(); + continue; + } + } + continue; + } + } + return new ManagedTransparentDataEncryption(id.Value, name.Value, type.Value, Optional.ToNullable(state)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs new file mode 100644 index 0000000000000..57cee143a71fb --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A managed database transparent data encryption state. + public partial class ManagedTransparentDataEncryption : ProxyResource + { + /// Initializes a new instance of ManagedTransparentDataEncryption. + public ManagedTransparentDataEncryption() + { + } + + /// Initializes a new instance of ManagedTransparentDataEncryption. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Specifies the state of the transparent data encryption. + internal ManagedTransparentDataEncryption(string id, string name, string type, TransparentDataEncryptionState? state) : base(id, name, type) + { + State = state; + } + + /// Specifies the state of the transparent data encryption. + public TransparentDataEncryptionState? State { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryptionListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryptionListResult.Serialization.cs new file mode 100644 index 0000000000000..4063e1c68d106 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryptionListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ManagedTransparentDataEncryptionListResult + { + internal static ManagedTransparentDataEncryptionListResult DeserializeManagedTransparentDataEncryptionListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedTransparentDataEncryption.DeserializeManagedTransparentDataEncryption(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedTransparentDataEncryptionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryptionListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryptionListResult.cs new file mode 100644 index 0000000000000..919d2ed9febf5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedTransparentDataEncryptionListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of managed transparent data encryptions. + internal partial class ManagedTransparentDataEncryptionListResult + { + /// Initializes a new instance of ManagedTransparentDataEncryptionListResult. + internal ManagedTransparentDataEncryptionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedTransparentDataEncryptionListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ManagedTransparentDataEncryptionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MetricType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MetricType.cs new file mode 100644 index 0000000000000..bbdd111ce271c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MetricType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The MetricType. + public readonly partial struct MetricType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public MetricType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CpuValue = "cpu"; + private const string IoValue = "io"; + private const string LogIoValue = "logIo"; + private const string DurationValue = "duration"; + private const string DtuValue = "dtu"; + + /// cpu. + public static MetricType Cpu { get; } = new MetricType(CpuValue); + /// io. + public static MetricType Io { get; } = new MetricType(IoValue); + /// logIo. + public static MetricType LogIo { get; } = new MetricType(LogIoValue); + /// duration. + public static MetricType Duration { get; } = new MetricType(DurationValue); + /// dtu. + public static MetricType Dtu { get; } = new MetricType(DtuValue); + /// Determines if two values are the same. + public static bool operator ==(MetricType left, MetricType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MetricType left, MetricType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MetricType(string value) => new MetricType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MetricType other && Equals(other); + /// + public bool Equals(MetricType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/NetworkIsolationSettings.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/NetworkIsolationSettings.Serialization.cs new file mode 100644 index 0000000000000..e42597d6b7a13 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/NetworkIsolationSettings.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class NetworkIsolationSettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(StorageAccountResourceId)) + { + writer.WritePropertyName("storageAccountResourceId"); + writer.WriteStringValue(StorageAccountResourceId); + } + if (Optional.IsDefined(SqlServerResourceId)) + { + writer.WritePropertyName("sqlServerResourceId"); + writer.WriteStringValue(SqlServerResourceId); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/NetworkIsolationSettings.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/NetworkIsolationSettings.cs new file mode 100644 index 0000000000000..a2e7157c16e48 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/NetworkIsolationSettings.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains the ARM resources for which to create private endpoint connection. + public partial class NetworkIsolationSettings + { + /// Initializes a new instance of NetworkIsolationSettings. + public 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. + public string StorageAccountResourceId { get; set; } + /// 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. + public string SqlServerResourceId { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationImpact.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationImpact.cs index 9decca545cfa0..c2159248a12ab 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationImpact.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationImpact.cs @@ -8,26 +8,13 @@ namespace Azure.ResourceManager.Sql.Models { /// The impact of an operation, both in absolute and relative terms. - public partial class OperationImpact + internal partial class OperationImpact { /// Initializes a new instance of OperationImpact. internal OperationImpact() { } - /// Initializes a new instance of OperationImpact. - /// The name of the impact dimension. - /// The unit in which estimated impact to dimension is measured. - /// The absolute impact to dimension. - /// The relative impact to dimension (null if not applicable). - internal OperationImpact(string name, string unit, double? changeValueAbsolute, double? changeValueRelative) - { - Name = name; - Unit = unit; - ChangeValueAbsolute = changeValueAbsolute; - ChangeValueRelative = changeValueRelative; - } - /// The name of the impact dimension. public string Name { get; } /// The unit in which estimated impact to dimension is measured. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationMode.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationMode.cs new file mode 100644 index 0000000000000..48d326715258f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationMode.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Operation Mode. + public readonly partial struct OperationMode : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public OperationMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PolybaseImportValue = "PolybaseImport"; + + /// PolybaseImport. + public static OperationMode PolybaseImport { get; } = new OperationMode(PolybaseImportValue); + /// Determines if two values are the same. + public static bool operator ==(OperationMode left, OperationMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationMode left, OperationMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OperationMode(string value) => new OperationMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationMode other && Equals(other); + /// + public bool Equals(OperationMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRule.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRule.Serialization.cs new file mode 100644 index 0000000000000..90ac7803b1f01 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRule.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class OutboundFirewallRule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static OutboundFirewallRule DeserializeOutboundFirewallRule(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState")) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new OutboundFirewallRule(id.Value, name.Value, type.Value, provisioningState.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRule.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRule.cs new file mode 100644 index 0000000000000..4416c9e5f7edd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRule.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// An Azure SQL DB Server Outbound Firewall Rule. + public partial class OutboundFirewallRule : ProxyResource + { + /// Initializes a new instance of OutboundFirewallRule. + public OutboundFirewallRule() + { + } + + /// Initializes a new instance of OutboundFirewallRule. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The state of the outbound rule. + internal OutboundFirewallRule(string id, string name, string type, string provisioningState) : base(id, name, type) + { + ProvisioningState = provisioningState; + } + + /// The state of the outbound rule. + public string ProvisioningState { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRuleListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRuleListResult.Serialization.cs new file mode 100644 index 0000000000000..b44d767aa2537 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRuleListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class OutboundFirewallRuleListResult + { + internal static OutboundFirewallRuleListResult DeserializeOutboundFirewallRuleListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OutboundFirewallRule.DeserializeOutboundFirewallRule(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new OutboundFirewallRuleListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRuleListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRuleListResult.cs new file mode 100644 index 0000000000000..71a1e9b24fa4e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OutboundFirewallRuleListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of outbound rules. + internal partial class OutboundFirewallRuleListResult + { + /// Initializes a new instance of OutboundFirewallRuleListResult. + internal OutboundFirewallRuleListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of OutboundFirewallRuleListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal OutboundFirewallRuleListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrincipalType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrincipalType.cs new file mode 100644 index 0000000000000..c503239b46c31 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrincipalType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Principal Type of the sever administrator. + public readonly partial struct PrincipalType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public PrincipalType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "User"; + private const string GroupValue = "Group"; + private const string ApplicationValue = "Application"; + + /// User. + public static PrincipalType User { get; } = new PrincipalType(UserValue); + /// Group. + public static PrincipalType Group { get; } = new PrincipalType(GroupValue); + /// Application. + public static PrincipalType Application { get; } = new PrincipalType(ApplicationValue); + /// Determines if two values are the same. + public static bool operator ==(PrincipalType left, PrincipalType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PrincipalType left, PrincipalType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PrincipalType(string value) => new PrincipalType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PrincipalType other && Equals(other); + /// + public bool Equals(PrincipalType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnection.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnection.Serialization.cs index 973e974f188d4..399aeb1fb16b7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnection.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnection.Serialization.cs @@ -38,7 +38,7 @@ internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(J Optional type = default; Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; - Optional provisioningState = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -87,14 +87,19 @@ internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(J } if (property0.NameEquals("provisioningState")) { - provisioningState = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new PrivateEndpointProvisioningState(property0.Value.GetString()); continue; } } continue; } } - return new PrivateEndpointConnection(id.Value, name.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, provisioningState.Value); + return new PrivateEndpointConnection(id.Value, name.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnection.cs index b2c5ad7826142..49ba7a15524bb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnection.cs @@ -22,7 +22,7 @@ public PrivateEndpointConnection() /// Private endpoint which the connection belongs to. /// Connection state of the private endpoint connection. /// State of the private endpoint connection. - internal PrivateEndpointConnection(string id, string name, string type, PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState, string provisioningState) : base(id, name, type) + internal PrivateEndpointConnection(string id, string name, string type, PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState, PrivateEndpointProvisioningState? provisioningState) : base(id, name, type) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; @@ -34,6 +34,6 @@ internal PrivateEndpointConnection(string id, string name, string type, PrivateE /// Connection state of the private endpoint connection. public PrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } /// State of the private endpoint connection. - public string ProvisioningState { get; } + public PrivateEndpointProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs index 2d334fc0ec9d7..8543f3095efe3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs @@ -15,7 +15,7 @@ public partial class PrivateEndpointConnectionProperties internal static PrivateEndpointConnectionProperties DeserializePrivateEndpointConnectionProperties(JsonElement element) { Optional privateEndpoint = default; - Optional privateLinkServiceConnectionState = default; + Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -36,7 +36,7 @@ internal static PrivateEndpointConnectionProperties DeserializePrivateEndpointCo property.ThrowNonNullablePropertyIsNull(); continue; } - privateLinkServiceConnectionState = PrivateLinkServiceConnectionStatePropertyAutoGenerated.DeserializePrivateLinkServiceConnectionStatePropertyAutoGenerated(property.Value); + privateLinkServiceConnectionState = PrivateLinkServiceConnectionStateProperty.DeserializePrivateLinkServiceConnectionStateProperty(property.Value); continue; } if (property.NameEquals("provisioningState")) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.cs index a46a2d4918a74..ce793681223a9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -19,7 +19,7 @@ internal PrivateEndpointConnectionProperties() /// Private endpoint which the connection belongs to. /// Connection state of the private endpoint connection. /// State of the private endpoint connection. - internal PrivateEndpointConnectionProperties(PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStatePropertyAutoGenerated privateLinkServiceConnectionState, PrivateEndpointProvisioningState? provisioningState) + internal PrivateEndpointConnectionProperties(PrivateEndpointProperty privateEndpoint, PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState, PrivateEndpointProvisioningState? provisioningState) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; @@ -29,7 +29,7 @@ internal PrivateEndpointConnectionProperties(PrivateEndpointProperty privateEndp /// Private endpoint which the connection belongs to. public PrivateEndpointProperty PrivateEndpoint { get; } /// Connection state of the private endpoint connection. - public PrivateLinkServiceConnectionStatePropertyAutoGenerated PrivateLinkServiceConnectionState { get; } + public PrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; } /// State of the private endpoint connection. public PrivateEndpointProvisioningState? ProvisioningState { get; } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionRequestStatus.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionRequestStatus.Serialization.cs new file mode 100644 index 0000000000000..8673cc724157c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionRequestStatus.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class PrivateEndpointConnectionRequestStatus + { + internal static PrivateEndpointConnectionRequestStatus DeserializePrivateEndpointConnectionRequestStatus(JsonElement element) + { + Optional privateLinkServiceId = default; + Optional privateEndpointConnectionName = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("privateLinkServiceId")) + { + privateLinkServiceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("privateEndpointConnectionName")) + { + privateEndpointConnectionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("status")) + { + status = property.Value.GetString(); + continue; + } + } + return new PrivateEndpointConnectionRequestStatus(privateLinkServiceId.Value, privateEndpointConnectionName.Value, status.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionRequestStatus.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionRequestStatus.cs new file mode 100644 index 0000000000000..6132102d943a4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateEndpointConnectionRequestStatus.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains the private endpoint connection requests status. + public partial class PrivateEndpointConnectionRequestStatus + { + /// Initializes a new instance of PrivateEndpointConnectionRequestStatus. + internal PrivateEndpointConnectionRequestStatus() + { + } + + /// Initializes a new instance of PrivateEndpointConnectionRequestStatus. + /// Resource id for which the private endpoint is created. + /// The connection name for the private endpoint. + /// Status of this private endpoint connection. + internal PrivateEndpointConnectionRequestStatus(string privateLinkServiceId, string privateEndpointConnectionName, string status) + { + PrivateLinkServiceId = privateLinkServiceId; + PrivateEndpointConnectionName = privateEndpointConnectionName; + Status = status; + } + + /// Resource id for which the private endpoint is created. + public string PrivateLinkServiceId { get; } + /// The connection name for the private endpoint. + public string PrivateEndpointConnectionName { get; } + /// Status of this private endpoint connection. + public string Status { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkResourceProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkResourceProperties.Serialization.cs index 7f84857267ac8..16a01b002d4e8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkResourceProperties.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkResourceProperties.Serialization.cs @@ -17,6 +17,7 @@ internal static PrivateLinkResourceProperties DeserializePrivateLinkResourceProp { Optional groupId = default; Optional> requiredMembers = default; + Optional> requiredZoneNames = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("groupId")) @@ -39,8 +40,23 @@ internal static PrivateLinkResourceProperties DeserializePrivateLinkResourceProp requiredMembers = array; continue; } + if (property.NameEquals("requiredZoneNames")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredZoneNames = array; + continue; + } } - return new PrivateLinkResourceProperties(groupId.Value, Optional.ToList(requiredMembers)); + return new PrivateLinkResourceProperties(groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs index 7a46220efffd4..a33e201786ac7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs @@ -17,20 +17,25 @@ public partial class PrivateLinkResourceProperties internal PrivateLinkResourceProperties() { RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); } /// Initializes a new instance of PrivateLinkResourceProperties. /// The private link resource group id. /// The private link resource required member names. - internal PrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers) + /// The private link resource required zone names. + internal PrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames) { GroupId = groupId; RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; } /// The private link resource group id. public string GroupId { get; } /// The private link resource required member names. public IReadOnlyList RequiredMembers { get; } + /// The private link resource required zone names. + public IReadOnlyList RequiredZoneNames { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs index 61da9b5b6cf50..9f58d7ebd2c98 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.Serialization.cs @@ -16,7 +16,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("status"); - writer.WriteStringValue(Status); + writer.WriteStringValue(Status.ToString()); writer.WritePropertyName("description"); writer.WriteStringValue(Description); writer.WriteEndObject(); @@ -24,14 +24,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static PrivateLinkServiceConnectionStateProperty DeserializePrivateLinkServiceConnectionStateProperty(JsonElement element) { - string status = default; + PrivateLinkServiceConnectionStateStatus status = default; string description = default; - Optional actionsRequired = default; + Optional actionsRequired = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("status")) { - status = property.Value.GetString(); + status = new PrivateLinkServiceConnectionStateStatus(property.Value.GetString()); continue; } if (property.NameEquals("description")) @@ -41,11 +41,16 @@ internal static PrivateLinkServiceConnectionStateProperty DeserializePrivateLink } if (property.NameEquals("actionsRequired")) { - actionsRequired = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + actionsRequired = new PrivateLinkServiceConnectionStateActionsRequire(property.Value.GetString()); continue; } } - return new PrivateLinkServiceConnectionStateProperty(status, description, actionsRequired.Value); + return new PrivateLinkServiceConnectionStateProperty(status, description, Optional.ToNullable(actionsRequired)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs index f0b367b661a51..e2a8b6a9e6a02 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs @@ -15,13 +15,9 @@ public partial class PrivateLinkServiceConnectionStateProperty /// Initializes a new instance of PrivateLinkServiceConnectionStateProperty. /// The private link service connection status. /// The private link service connection description. - /// or is null. - public PrivateLinkServiceConnectionStateProperty(string status, string description) + /// is null. + public PrivateLinkServiceConnectionStateProperty(PrivateLinkServiceConnectionStateStatus status, string description) { - if (status == null) - { - throw new ArgumentNullException(nameof(status)); - } if (description == null) { throw new ArgumentNullException(nameof(description)); @@ -35,7 +31,7 @@ public PrivateLinkServiceConnectionStateProperty(string status, string descripti /// The private link service connection status. /// The private link service connection description. /// The actions required for private link service connection. - internal PrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired) + internal PrivateLinkServiceConnectionStateProperty(PrivateLinkServiceConnectionStateStatus status, string description, PrivateLinkServiceConnectionStateActionsRequire? actionsRequired) { Status = status; Description = description; @@ -43,10 +39,10 @@ internal PrivateLinkServiceConnectionStateProperty(string status, string descrip } /// The private link service connection status. - public string Status { get; set; } + public PrivateLinkServiceConnectionStateStatus Status { get; set; } /// The private link service connection description. public string Description { get; set; } /// The actions required for private link service connection. - public string ActionsRequired { get; } + public PrivateLinkServiceConnectionStateActionsRequire? ActionsRequired { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs deleted file mode 100644 index 45bb9b5ea2855..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - public partial class PrivateLinkServiceConnectionStatePropertyAutoGenerated - { - internal static PrivateLinkServiceConnectionStatePropertyAutoGenerated DeserializePrivateLinkServiceConnectionStatePropertyAutoGenerated(JsonElement element) - { - PrivateLinkServiceConnectionStateStatus status = default; - string description = default; - Optional actionsRequired = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("status")) - { - status = new PrivateLinkServiceConnectionStateStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("description")) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("actionsRequired")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - actionsRequired = new PrivateLinkServiceConnectionStateActionsRequire(property.Value.GetString()); - continue; - } - } - return new PrivateLinkServiceConnectionStatePropertyAutoGenerated(status, description, Optional.ToNullable(actionsRequired)); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs deleted file mode 100644 index 501ee0e23a9de..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/PrivateLinkServiceConnectionStatePropertyAutoGenerated.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The PrivateLinkServiceConnectionStatePropertyAutoGenerated. - public partial class PrivateLinkServiceConnectionStatePropertyAutoGenerated - { - /// Initializes a new instance of PrivateLinkServiceConnectionStatePropertyAutoGenerated. - /// The private link service connection status. - /// The private link service connection description. - /// is null. - internal PrivateLinkServiceConnectionStatePropertyAutoGenerated(PrivateLinkServiceConnectionStateStatus status, string description) - { - if (description == null) - { - throw new ArgumentNullException(nameof(description)); - } - - Status = status; - Description = description; - } - - /// Initializes a new instance of PrivateLinkServiceConnectionStatePropertyAutoGenerated. - /// The private link service connection status. - /// The private link service connection description. - /// The actions required for private link service connection. - internal PrivateLinkServiceConnectionStatePropertyAutoGenerated(PrivateLinkServiceConnectionStateStatus status, string description, PrivateLinkServiceConnectionStateActionsRequire? actionsRequired) - { - Status = status; - Description = description; - ActionsRequired = actionsRequired; - } - - /// The private link service connection status. - public PrivateLinkServiceConnectionStateStatus Status { get; } - /// The private link service connection description. - public string Description { get; } - /// The actions required for private link service connection. - public PrivateLinkServiceConnectionStateActionsRequire? ActionsRequired { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ProxyResourceWithWritableName.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ProxyResourceWithWritableName.Serialization.cs new file mode 100644 index 0000000000000..f6dec3f2996cc --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ProxyResourceWithWritableName.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ProxyResourceWithWritableName : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + writer.WriteEndObject(); + } + + internal static ProxyResourceWithWritableName DeserializeProxyResourceWithWritableName(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new ProxyResourceWithWritableName(id.Value, name.Value, type.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs new file mode 100644 index 0000000000000..b7844d5bd63b6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// ARM proxy resource. + public partial class ProxyResourceWithWritableName : ResourceWithWritableName + { + /// Initializes a new instance of ProxyResourceWithWritableName. + public ProxyResourceWithWritableName() + { + } + + /// Initializes a new instance of ProxyResourceWithWritableName. + /// Resource ID. + /// Resource name. + /// Resource type. + internal ProxyResourceWithWritableName(string id, string name, string type) : base(id, name, type) + { + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricInterval.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricInterval.Serialization.cs new file mode 100644 index 0000000000000..b5f105eb2fb12 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricInterval.Serialization.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class QueryMetricInterval : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Metrics)) + { + writer.WritePropertyName("metrics"); + writer.WriteStartArray(); + foreach (var item in Metrics) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static QueryMetricInterval DeserializeQueryMetricInterval(JsonElement element) + { + Optional intervalStartTime = default; + Optional intervalType = default; + Optional executionCount = default; + Optional> metrics = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("intervalStartTime")) + { + intervalStartTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("intervalType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + intervalType = new QueryTimeGrainType(property.Value.GetString()); + continue; + } + if (property.NameEquals("executionCount")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + executionCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("metrics")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QueryMetricProperties.DeserializeQueryMetricProperties(item)); + } + metrics = array; + continue; + } + } + return new QueryMetricInterval(intervalStartTime.Value, Optional.ToNullable(intervalType), Optional.ToNullable(executionCount), Optional.ToList(metrics)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricInterval.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricInterval.cs new file mode 100644 index 0000000000000..c1fcacefabd77 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricInterval.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Properties of a query metrics interval. + public partial class QueryMetricInterval + { + /// Initializes a new instance of QueryMetricInterval. + public QueryMetricInterval() + { + Metrics = new ChangeTrackingList(); + } + + /// Initializes a new instance of QueryMetricInterval. + /// The start time for the metric interval (ISO-8601 format). + /// Interval type (length). + /// Execution count of a query in this interval. + /// List of metric objects for this interval. + internal QueryMetricInterval(string intervalStartTime, QueryTimeGrainType? intervalType, long? executionCount, IList metrics) + { + IntervalStartTime = intervalStartTime; + IntervalType = intervalType; + ExecutionCount = executionCount; + Metrics = metrics; + } + + /// The start time for the metric interval (ISO-8601 format). + public string IntervalStartTime { get; } + /// Interval type (length). + public QueryTimeGrainType? IntervalType { get; } + /// Execution count of a query in this interval. + public long? ExecutionCount { get; } + /// List of metric objects for this interval. + public IList Metrics { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricProperties.Serialization.cs new file mode 100644 index 0000000000000..33f52b69aa6ea --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricProperties.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class QueryMetricProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static QueryMetricProperties DeserializeQueryMetricProperties(JsonElement element) + { + Optional name = default; + Optional displayName = default; + Optional unit = default; + Optional value = default; + Optional min = default; + Optional max = default; + Optional avg = default; + Optional sum = default; + Optional stdev = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName")) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + unit = new QueryMetricUnitType(property.Value.GetString()); + continue; + } + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("min")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + min = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("max")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + max = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("avg")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + avg = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("sum")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + sum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("stdev")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + stdev = property.Value.GetDouble(); + continue; + } + } + return new QueryMetricProperties(name.Value, displayName.Value, Optional.ToNullable(unit), Optional.ToNullable(value), Optional.ToNullable(min), Optional.ToNullable(max), Optional.ToNullable(avg), Optional.ToNullable(sum), Optional.ToNullable(stdev)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricProperties.cs new file mode 100644 index 0000000000000..4d084addef501 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Properties of a topquery metric in one interval. + public partial class QueryMetricProperties + { + /// Initializes a new instance of QueryMetricProperties. + public QueryMetricProperties() + { + } + + /// Initializes a new instance of QueryMetricProperties. + /// The name information for the metric. + /// The UI appropriate name for the metric. + /// The unit of the metric. + /// The value of the metric. + /// Metric value when min() aggregate function is used over the interval. + /// Metric value when max() aggregate function is used over the interval. + /// Metric value when avg() aggregate function is used over the interval. + /// Metric value when sum() aggregate function is used over the interval. + /// Metric value when stdev aggregate function is used over the interval. + internal QueryMetricProperties(string name, string displayName, QueryMetricUnitType? unit, double? value, double? min, double? max, double? avg, double? sum, double? stdev) + { + Name = name; + DisplayName = displayName; + Unit = unit; + Value = value; + Min = min; + Max = max; + Avg = avg; + Sum = sum; + Stdev = stdev; + } + + /// The name information for the metric. + public string Name { get; } + /// The UI appropriate name for the metric. + public string DisplayName { get; } + /// The unit of the metric. + public QueryMetricUnitType? Unit { get; } + /// The value of the metric. + public double? Value { get; } + /// Metric value when min() aggregate function is used over the interval. + public double? Min { get; } + /// Metric value when max() aggregate function is used over the interval. + public double? Max { get; } + /// Metric value when avg() aggregate function is used over the interval. + public double? Avg { get; } + /// Metric value when sum() aggregate function is used over the interval. + public double? Sum { get; } + /// Metric value when stdev aggregate function is used over the interval. + public double? Stdev { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricUnitType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricUnitType.cs new file mode 100644 index 0000000000000..1a6464fbfa6d2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricUnitType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The unit of the metric. + public readonly partial struct QueryMetricUnitType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public QueryMetricUnitType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PercentageValue = "percentage"; + private const string KBValue = "KB"; + private const string MicrosecondsValue = "microseconds"; + private const string CountValue = "count"; + + /// percentage. + public static QueryMetricUnitType Percentage { get; } = new QueryMetricUnitType(PercentageValue); + /// KB. + public static QueryMetricUnitType KB { get; } = new QueryMetricUnitType(KBValue); + /// microseconds. + public static QueryMetricUnitType Microseconds { get; } = new QueryMetricUnitType(MicrosecondsValue); + /// count. + public static QueryMetricUnitType Count { get; } = new QueryMetricUnitType(CountValue); + /// Determines if two values are the same. + public static bool operator ==(QueryMetricUnitType left, QueryMetricUnitType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QueryMetricUnitType left, QueryMetricUnitType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator QueryMetricUnitType(string value) => new QueryMetricUnitType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QueryMetricUnitType other && Equals(other); + /// + public bool Equals(QueryMetricUnitType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatistics.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatistics.Serialization.cs new file mode 100644 index 0000000000000..4d60a67e3df77 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatistics.Serialization.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class QueryStatistics : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Intervals)) + { + writer.WritePropertyName("intervals"); + writer.WriteStartArray(); + foreach (var item in Intervals) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static QueryStatistics DeserializeQueryStatistics(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional databaseName = default; + Optional queryId = default; + Optional startTime = default; + Optional endTime = default; + Optional> intervals = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("databaseName")) + { + databaseName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("queryId")) + { + queryId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("startTime")) + { + startTime = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("endTime")) + { + endTime = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("intervals")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(QueryMetricInterval.DeserializeQueryMetricInterval(item)); + } + intervals = array; + continue; + } + } + continue; + } + } + return new QueryStatistics(id.Value, name.Value, type.Value, databaseName.Value, queryId.Value, startTime.Value, endTime.Value, Optional.ToList(intervals)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatistics.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatistics.cs new file mode 100644 index 0000000000000..d9fa6e01fd9ee --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatistics.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The QueryStatistics. + public partial class QueryStatistics : ProxyResource + { + /// Initializes a new instance of QueryStatistics. + public QueryStatistics() + { + Intervals = new ChangeTrackingList(); + } + + /// Initializes a new instance of QueryStatistics. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Database name of the database in which this query was executed. + /// Unique query id (unique within one database). + /// The start time for the metric (ISO-8601 format). + /// The end time for the metric (ISO-8601 format). + /// List of intervals with appropriate metric data. + internal QueryStatistics(string id, string name, string type, string databaseName, string queryId, string startTime, string endTime, IList intervals) : base(id, name, type) + { + DatabaseName = databaseName; + QueryId = queryId; + StartTime = startTime; + EndTime = endTime; + Intervals = intervals; + } + + /// Database name of the database in which this query was executed. + public string DatabaseName { get; } + /// Unique query id (unique within one database). + public string QueryId { get; } + /// The start time for the metric (ISO-8601 format). + public string StartTime { get; } + /// The end time for the metric (ISO-8601 format). + public string EndTime { get; } + /// List of intervals with appropriate metric data. + public IList Intervals { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.Serialization.cs new file mode 100644 index 0000000000000..1b962c267b187 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class QueryStatisticsProperties + { + internal static QueryStatisticsProperties DeserializeQueryStatisticsProperties(JsonElement element) + { + Optional databaseName = default; + Optional queryId = default; + Optional startTime = default; + Optional endTime = default; + Optional> intervals = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("databaseName")) + { + databaseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("queryId")) + { + queryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTime")) + { + startTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("endTime")) + { + endTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("intervals")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QueryMetricInterval.DeserializeQueryMetricInterval(item)); + } + intervals = array; + continue; + } + } + return new QueryStatisticsProperties(databaseName.Value, queryId.Value, startTime.Value, endTime.Value, Optional.ToList(intervals)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.cs new file mode 100644 index 0000000000000..17d62c211fa9b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Properties of a query execution statistics. + public partial class QueryStatisticsProperties + { + /// Initializes a new instance of QueryStatisticsProperties. + internal QueryStatisticsProperties() + { + Intervals = new ChangeTrackingList(); + } + + /// Initializes a new instance of QueryStatisticsProperties. + /// Database name of the database in which this query was executed. + /// Unique query id (unique within one database). + /// The start time for the metric (ISO-8601 format). + /// The end time for the metric (ISO-8601 format). + /// List of intervals with appropriate metric data. + internal QueryStatisticsProperties(string databaseName, string queryId, string startTime, string endTime, IReadOnlyList intervals) + { + DatabaseName = databaseName; + QueryId = queryId; + StartTime = startTime; + EndTime = endTime; + Intervals = intervals; + } + + /// Database name of the database in which this query was executed. + public string DatabaseName { get; } + /// Unique query id (unique within one database). + public string QueryId { get; } + /// The start time for the metric (ISO-8601 format). + public string StartTime { get; } + /// The end time for the metric (ISO-8601 format). + public string EndTime { get; } + /// List of intervals with appropriate metric data. + public IReadOnlyList Intervals { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryTimeGrainType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryTimeGrainType.cs new file mode 100644 index 0000000000000..2a875d15b824c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryTimeGrainType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Interval type (length). + public readonly partial struct QueryTimeGrainType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public QueryTimeGrainType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PT1HValue = "PT1H"; + private const string P1DValue = "P1D"; + + /// PT1H. + public static QueryTimeGrainType PT1H { get; } = new QueryTimeGrainType(PT1HValue); + /// P1D. + public static QueryTimeGrainType P1D { get; } = new QueryTimeGrainType(P1DValue); + /// Determines if two values are the same. + public static bool operator ==(QueryTimeGrainType left, QueryTimeGrainType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QueryTimeGrainType left, QueryTimeGrainType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator QueryTimeGrainType(string value) => new QueryTimeGrainType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QueryTimeGrainType other && Equals(other); + /// + public bool Equals(QueryTimeGrainType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedAction.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedAction.Serialization.cs new file mode 100644 index 0000000000000..df362ef23449b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedAction.Serialization.cs @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class RecommendedAction : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteObjectValue(State); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static RecommendedAction DeserializeRecommendedAction(JsonElement element) + { + Optional kind = default; + Optional location = default; + Optional id = default; + Optional name = default; + Optional type = default; + Optional recommendationReason = default; + Optional validSince = default; + Optional lastRefresh = default; + Optional state = default; + Optional isExecutableAction = default; + Optional isRevertableAction = default; + Optional isArchivedAction = default; + Optional executeActionStartTime = default; + Optional executeActionDuration = default; + Optional revertActionStartTime = default; + Optional revertActionDuration = default; + Optional executeActionInitiatedBy = default; + Optional executeActionInitiatedTime = default; + Optional revertActionInitiatedBy = default; + Optional revertActionInitiatedTime = default; + Optional score = default; + Optional implementationDetails = default; + Optional errorDetails = default; + Optional> estimatedImpact = default; + Optional> observedImpact = default; + Optional> timeSeries = default; + Optional> linkedObjects = default; + Optional> details = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind")) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("recommendationReason")) + { + recommendationReason = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("validSince")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + validSince = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("lastRefresh")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + lastRefresh = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("state")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + state = RecommendedActionStateInfo.DeserializeRecommendedActionStateInfo(property0.Value); + continue; + } + if (property0.NameEquals("isExecutableAction")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isExecutableAction = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("isRevertableAction")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isRevertableAction = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("isArchivedAction")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isArchivedAction = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("executeActionStartTime")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + executeActionStartTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("executeActionDuration")) + { + executeActionDuration = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("revertActionStartTime")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + revertActionStartTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("revertActionDuration")) + { + revertActionDuration = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("executeActionInitiatedBy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + executeActionInitiatedBy = property0.Value.GetString().ToRecommendedActionInitiatedBy(); + continue; + } + if (property0.NameEquals("executeActionInitiatedTime")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + executeActionInitiatedTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("revertActionInitiatedBy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + revertActionInitiatedBy = property0.Value.GetString().ToRecommendedActionInitiatedBy(); + continue; + } + if (property0.NameEquals("revertActionInitiatedTime")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + revertActionInitiatedTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("score")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + score = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("implementationDetails")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + implementationDetails = RecommendedActionImplementationInfo.DeserializeRecommendedActionImplementationInfo(property0.Value); + continue; + } + if (property0.NameEquals("errorDetails")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + errorDetails = RecommendedActionErrorInfo.DeserializeRecommendedActionErrorInfo(property0.Value); + continue; + } + if (property0.NameEquals("estimatedImpact")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RecommendedActionImpactRecord.DeserializeRecommendedActionImpactRecord(item)); + } + estimatedImpact = array; + continue; + } + if (property0.NameEquals("observedImpact")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RecommendedActionImpactRecord.DeserializeRecommendedActionImpactRecord(item)); + } + observedImpact = array; + continue; + } + if (property0.NameEquals("timeSeries")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RecommendedActionMetricInfo.DeserializeRecommendedActionMetricInfo(item)); + } + timeSeries = array; + continue; + } + if (property0.NameEquals("linkedObjects")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + linkedObjects = array; + continue; + } + if (property0.NameEquals("details")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetObject()); + } + details = dictionary; + continue; + } + } + continue; + } + } + return new RecommendedAction(id.Value, name.Value, type.Value, kind.Value, location.Value, recommendationReason.Value, Optional.ToNullable(validSince), Optional.ToNullable(lastRefresh), state.Value, Optional.ToNullable(isExecutableAction), Optional.ToNullable(isRevertableAction), Optional.ToNullable(isArchivedAction), Optional.ToNullable(executeActionStartTime), executeActionDuration.Value, Optional.ToNullable(revertActionStartTime), revertActionDuration.Value, Optional.ToNullable(executeActionInitiatedBy), Optional.ToNullable(executeActionInitiatedTime), Optional.ToNullable(revertActionInitiatedBy), Optional.ToNullable(revertActionInitiatedTime), Optional.ToNullable(score), implementationDetails.Value, errorDetails.Value, Optional.ToList(estimatedImpact), Optional.ToList(observedImpact), Optional.ToList(timeSeries), Optional.ToList(linkedObjects), Optional.ToDictionary(details)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedAction.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedAction.cs new file mode 100644 index 0000000000000..c5e2fb0e94e3f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedAction.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Database, Server or Elastic Pool Recommended Action. + public partial class RecommendedAction : ProxyResource + { + /// Initializes a new instance of RecommendedAction. + public RecommendedAction() + { + EstimatedImpact = new ChangeTrackingList(); + ObservedImpact = new ChangeTrackingList(); + TimeSeries = new ChangeTrackingList(); + LinkedObjects = new ChangeTrackingList(); + Details = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of RecommendedAction. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource kind. + /// Resource location. + /// Gets the reason for recommending this action. e.g., DuplicateIndex. + /// Gets the time since when this recommended action is valid. + /// Gets time when this recommended action was last refreshed. + /// Gets the info of the current state the recommended action is in. + /// Gets if this recommended action is actionable by user. + /// Gets if changes applied by this recommended action can be reverted by user. + /// Gets if this recommended action was suggested some time ago but user chose to ignore this and system added a new recommended action again. + /// Gets the time when system started applying this recommended action on the user resource. e.g., index creation start time. + /// Gets the time taken for applying this recommended action on user resource. e.g., time taken for index creation. + /// Gets the time when system started reverting changes of this recommended action on user resource. e.g., time when index drop is executed. + /// Gets the time taken for reverting changes of this recommended action on user resource. e.g., time taken for dropping the created index. + /// Gets if approval for applying this recommended action was given by user/system. + /// Gets the time when this recommended action was approved for execution. + /// Gets if approval for reverting this recommended action was given by user/system. + /// Gets the time when this recommended action was approved for revert. + /// Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - Medium Impact and 3 - High Impact. + /// Gets the implementation details of this recommended action for user to apply it manually. + /// Gets the error details if and why this recommended action is put to error state. + /// Gets the estimated impact info for this recommended action e.g., Estimated CPU gain, Estimated Disk Space change. + /// Gets the observed/actual impact info for this recommended action e.g., Actual CPU gain, Actual Disk Space change. + /// Gets the time series info of metrics for this recommended action e.g., CPU consumption time series. + /// Gets the linked objects, if any. + /// Gets additional details specific to this recommended action. + internal RecommendedAction(string id, string name, string type, string kind, string location, string recommendationReason, DateTimeOffset? validSince, DateTimeOffset? lastRefresh, RecommendedActionStateInfo state, bool? isExecutableAction, bool? isRevertableAction, bool? isArchivedAction, DateTimeOffset? executeActionStartTime, string executeActionDuration, DateTimeOffset? revertActionStartTime, string revertActionDuration, RecommendedActionInitiatedBy? executeActionInitiatedBy, DateTimeOffset? executeActionInitiatedTime, RecommendedActionInitiatedBy? revertActionInitiatedBy, DateTimeOffset? revertActionInitiatedTime, int? score, RecommendedActionImplementationInfo implementationDetails, RecommendedActionErrorInfo errorDetails, IReadOnlyList estimatedImpact, IReadOnlyList observedImpact, IReadOnlyList timeSeries, IReadOnlyList linkedObjects, IReadOnlyDictionary details) : base(id, name, type) + { + Kind = kind; + Location = location; + RecommendationReason = recommendationReason; + ValidSince = validSince; + LastRefresh = lastRefresh; + State = state; + IsExecutableAction = isExecutableAction; + IsRevertableAction = isRevertableAction; + IsArchivedAction = isArchivedAction; + ExecuteActionStartTime = executeActionStartTime; + ExecuteActionDuration = executeActionDuration; + RevertActionStartTime = revertActionStartTime; + RevertActionDuration = revertActionDuration; + ExecuteActionInitiatedBy = executeActionInitiatedBy; + ExecuteActionInitiatedTime = executeActionInitiatedTime; + RevertActionInitiatedBy = revertActionInitiatedBy; + RevertActionInitiatedTime = revertActionInitiatedTime; + Score = score; + ImplementationDetails = implementationDetails; + ErrorDetails = errorDetails; + EstimatedImpact = estimatedImpact; + ObservedImpact = observedImpact; + TimeSeries = timeSeries; + LinkedObjects = linkedObjects; + Details = details; + } + + /// Resource kind. + public string Kind { get; } + /// Resource location. + public string Location { get; } + /// Gets the reason for recommending this action. e.g., DuplicateIndex. + public string RecommendationReason { get; } + /// Gets the time since when this recommended action is valid. + public DateTimeOffset? ValidSince { get; } + /// Gets time when this recommended action was last refreshed. + public DateTimeOffset? LastRefresh { get; } + /// Gets the info of the current state the recommended action is in. + public RecommendedActionStateInfo State { get; set; } + /// Gets if this recommended action is actionable by user. + public bool? IsExecutableAction { get; } + /// Gets if changes applied by this recommended action can be reverted by user. + public bool? IsRevertableAction { get; } + /// Gets if this recommended action was suggested some time ago but user chose to ignore this and system added a new recommended action again. + public bool? IsArchivedAction { get; } + /// Gets the time when system started applying this recommended action on the user resource. e.g., index creation start time. + public DateTimeOffset? ExecuteActionStartTime { get; } + /// Gets the time taken for applying this recommended action on user resource. e.g., time taken for index creation. + public string ExecuteActionDuration { get; } + /// Gets the time when system started reverting changes of this recommended action on user resource. e.g., time when index drop is executed. + public DateTimeOffset? RevertActionStartTime { get; } + /// Gets the time taken for reverting changes of this recommended action on user resource. e.g., time taken for dropping the created index. + public string RevertActionDuration { get; } + /// Gets if approval for applying this recommended action was given by user/system. + public RecommendedActionInitiatedBy? ExecuteActionInitiatedBy { get; } + /// Gets the time when this recommended action was approved for execution. + public DateTimeOffset? ExecuteActionInitiatedTime { get; } + /// Gets if approval for reverting this recommended action was given by user/system. + public RecommendedActionInitiatedBy? RevertActionInitiatedBy { get; } + /// Gets the time when this recommended action was approved for revert. + public DateTimeOffset? RevertActionInitiatedTime { get; } + /// Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - Medium Impact and 3 - High Impact. + public int? Score { get; } + /// Gets the implementation details of this recommended action for user to apply it manually. + public RecommendedActionImplementationInfo ImplementationDetails { get; } + /// Gets the error details if and why this recommended action is put to error state. + public RecommendedActionErrorInfo ErrorDetails { get; } + /// Gets the estimated impact info for this recommended action e.g., Estimated CPU gain, Estimated Disk Space change. + public IReadOnlyList EstimatedImpact { get; } + /// Gets the observed/actual impact info for this recommended action e.g., Actual CPU gain, Actual Disk Space change. + public IReadOnlyList ObservedImpact { get; } + /// Gets the time series info of metrics for this recommended action e.g., CPU consumption time series. + public IReadOnlyList TimeSeries { get; } + /// Gets the linked objects, if any. + public IReadOnlyList LinkedObjects { get; } + /// Gets additional details specific to this recommended action. + public IReadOnlyDictionary Details { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionCurrentState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionCurrentState.cs new file mode 100644 index 0000000000000..faab7d5f1c36c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionCurrentState.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// 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 readonly partial struct RecommendedActionCurrentState : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public RecommendedActionCurrentState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string PendingValue = "Pending"; + private const string ExecutingValue = "Executing"; + private const string VerifyingValue = "Verifying"; + private const string PendingRevertValue = "PendingRevert"; + private const string RevertCancelledValue = "RevertCancelled"; + private const string RevertingValue = "Reverting"; + private const string RevertedValue = "Reverted"; + private const string IgnoredValue = "Ignored"; + private const string ExpiredValue = "Expired"; + private const string MonitoringValue = "Monitoring"; + private const string ResolvedValue = "Resolved"; + private const string SuccessValue = "Success"; + private const string ErrorValue = "Error"; + + /// Active. + public static RecommendedActionCurrentState Active { get; } = new RecommendedActionCurrentState(ActiveValue); + /// Pending. + public static RecommendedActionCurrentState Pending { get; } = new RecommendedActionCurrentState(PendingValue); + /// Executing. + public static RecommendedActionCurrentState Executing { get; } = new RecommendedActionCurrentState(ExecutingValue); + /// Verifying. + public static RecommendedActionCurrentState Verifying { get; } = new RecommendedActionCurrentState(VerifyingValue); + /// PendingRevert. + public static RecommendedActionCurrentState PendingRevert { get; } = new RecommendedActionCurrentState(PendingRevertValue); + /// RevertCancelled. + public static RecommendedActionCurrentState RevertCancelled { get; } = new RecommendedActionCurrentState(RevertCancelledValue); + /// Reverting. + public static RecommendedActionCurrentState Reverting { get; } = new RecommendedActionCurrentState(RevertingValue); + /// Reverted. + public static RecommendedActionCurrentState Reverted { get; } = new RecommendedActionCurrentState(RevertedValue); + /// Ignored. + public static RecommendedActionCurrentState Ignored { get; } = new RecommendedActionCurrentState(IgnoredValue); + /// Expired. + public static RecommendedActionCurrentState Expired { get; } = new RecommendedActionCurrentState(ExpiredValue); + /// Monitoring. + public static RecommendedActionCurrentState Monitoring { get; } = new RecommendedActionCurrentState(MonitoringValue); + /// Resolved. + public static RecommendedActionCurrentState Resolved { get; } = new RecommendedActionCurrentState(ResolvedValue); + /// Success. + public static RecommendedActionCurrentState Success { get; } = new RecommendedActionCurrentState(SuccessValue); + /// Error. + public static RecommendedActionCurrentState Error { get; } = new RecommendedActionCurrentState(ErrorValue); + /// Determines if two values are the same. + public static bool operator ==(RecommendedActionCurrentState left, RecommendedActionCurrentState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RecommendedActionCurrentState left, RecommendedActionCurrentState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RecommendedActionCurrentState(string value) => new RecommendedActionCurrentState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RecommendedActionCurrentState other && Equals(other); + /// + public bool Equals(RecommendedActionCurrentState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionErrorInfo.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionErrorInfo.Serialization.cs new file mode 100644 index 0000000000000..d93c136d27104 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionErrorInfo.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class RecommendedActionErrorInfo + { + internal static RecommendedActionErrorInfo DeserializeRecommendedActionErrorInfo(JsonElement element) + { + Optional errorCode = default; + Optional isRetryable = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errorCode")) + { + errorCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("isRetryable")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + isRetryable = property.Value.GetString().ToIsRetryable(); + continue; + } + } + return new RecommendedActionErrorInfo(errorCode.Value, Optional.ToNullable(isRetryable)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs new file mode 100644 index 0000000000000..dcdda77a3a0c5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains error information for an Azure SQL Database, Server or Elastic Pool Recommended Action. + public partial class RecommendedActionErrorInfo + { + /// Initializes a new instance of RecommendedActionErrorInfo. + internal RecommendedActionErrorInfo() + { + } + + /// Initializes a new instance of RecommendedActionErrorInfo. + /// Gets the reason why the recommended action was put to error state. e.g., DatabaseHasQdsOff, IndexAlreadyExists. + /// Gets whether the error could be ignored and recommended action could be retried. Possible values are: Yes/No. + internal RecommendedActionErrorInfo(string errorCode, IsRetryable? isRetryable) + { + ErrorCode = errorCode; + IsRetryable = isRetryable; + } + + /// Gets the reason why the recommended action was put to error state. e.g., DatabaseHasQdsOff, IndexAlreadyExists. + public string ErrorCode { get; } + /// Gets whether the error could be ignored and recommended action could be retried. Possible values are: Yes/No. + public IsRetryable? IsRetryable { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationImpact.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImpactRecord.Serialization.cs similarity index 61% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationImpact.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImpactRecord.Serialization.cs index 7be0309562e1a..50e11eb382414 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/OperationImpact.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImpactRecord.Serialization.cs @@ -10,19 +10,20 @@ namespace Azure.ResourceManager.Sql.Models { - public partial class OperationImpact + public partial class RecommendedActionImpactRecord { - internal static OperationImpact DeserializeOperationImpact(JsonElement element) + internal static RecommendedActionImpactRecord DeserializeRecommendedActionImpactRecord(JsonElement element) { - Optional name = default; + Optional dimensionName = default; Optional unit = default; + Optional absoluteValue = default; Optional changeValueAbsolute = default; Optional changeValueRelative = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("name")) + if (property.NameEquals("dimensionName")) { - name = property.Value.GetString(); + dimensionName = property.Value.GetString(); continue; } if (property.NameEquals("unit")) @@ -30,6 +31,16 @@ internal static OperationImpact DeserializeOperationImpact(JsonElement element) unit = property.Value.GetString(); continue; } + if (property.NameEquals("absoluteValue")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + absoluteValue = property.Value.GetDouble(); + continue; + } if (property.NameEquals("changeValueAbsolute")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -51,7 +62,7 @@ internal static OperationImpact DeserializeOperationImpact(JsonElement element) continue; } } - return new OperationImpact(name.Value, unit.Value, Optional.ToNullable(changeValueAbsolute), Optional.ToNullable(changeValueRelative)); + return new RecommendedActionImpactRecord(dimensionName.Value, unit.Value, Optional.ToNullable(absoluteValue), Optional.ToNullable(changeValueAbsolute), Optional.ToNullable(changeValueRelative)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs new file mode 100644 index 0000000000000..ec398ef1ebb66 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains information of estimated or observed impact on various metrics for an Azure SQL Database, Server or Elastic Pool Recommended Action. + public partial class RecommendedActionImpactRecord + { + /// Initializes a new instance of RecommendedActionImpactRecord. + internal RecommendedActionImpactRecord() + { + } + + /// Initializes a new instance of RecommendedActionImpactRecord. + /// Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. + /// Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. + /// Gets the absolute value of this dimension if applicable. e.g., Number of Queries affected. + /// Gets the absolute change in the value of this dimension. e.g., Absolute Disk space change in Megabytes. + /// Gets the relative change in the value of this dimension. e.g., Relative Disk space change in Percentage. + internal RecommendedActionImpactRecord(string dimensionName, string unit, double? absoluteValue, double? changeValueAbsolute, double? changeValueRelative) + { + DimensionName = dimensionName; + Unit = unit; + AbsoluteValue = absoluteValue; + ChangeValueAbsolute = changeValueAbsolute; + ChangeValueRelative = changeValueRelative; + } + + /// Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. + public string DimensionName { get; } + /// Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, NumberOfQueriesAffected. + public string Unit { get; } + /// Gets the absolute value of this dimension if applicable. e.g., Number of Queries affected. + public double? AbsoluteValue { get; } + /// Gets the absolute change in the value of this dimension. e.g., Absolute Disk space change in Megabytes. + public double? ChangeValueAbsolute { get; } + /// Gets the relative change in the value of this dimension. e.g., Relative Disk space change in Percentage. + public double? ChangeValueRelative { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImplementationInfo.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImplementationInfo.Serialization.cs new file mode 100644 index 0000000000000..eaf9f5c06be1f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImplementationInfo.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class RecommendedActionImplementationInfo + { + internal static RecommendedActionImplementationInfo DeserializeRecommendedActionImplementationInfo(JsonElement element) + { + Optional method = default; + Optional script = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + method = property.Value.GetString().ToImplementationMethod(); + continue; + } + if (property.NameEquals("script")) + { + script = property.Value.GetString(); + continue; + } + } + return new RecommendedActionImplementationInfo(Optional.ToNullable(method), script.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs new file mode 100644 index 0000000000000..464f76a7ed2df --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains information for manual implementation for an Azure SQL Database, Server or Elastic Pool Recommended Action. + public partial class RecommendedActionImplementationInfo + { + /// Initializes a new instance of RecommendedActionImplementationInfo. + internal RecommendedActionImplementationInfo() + { + } + + /// Initializes a new instance of RecommendedActionImplementationInfo. + /// Gets the method in which this recommended action can be manually implemented. e.g., TSql, AzurePowerShell. + /// Gets the manual implementation script. e.g., T-SQL script that could be executed on the database. + internal RecommendedActionImplementationInfo(ImplementationMethod? method, string script) + { + Method = method; + Script = script; + } + + /// Gets the method in which this recommended action can be manually implemented. e.g., TSql, AzurePowerShell. + public ImplementationMethod? Method { get; } + /// Gets the manual implementation script. e.g., T-SQL script that could be executed on the database. + public string Script { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionInitiatedBy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionInitiatedBy.Serialization.cs new file mode 100644 index 0000000000000..07d4c3ecf874b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionInitiatedBy.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class RecommendedActionInitiatedByExtensions + { + public static string ToSerialString(this RecommendedActionInitiatedBy value) => value switch + { + RecommendedActionInitiatedBy.User => "User", + RecommendedActionInitiatedBy.System => "System", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedActionInitiatedBy value.") + }; + + public static RecommendedActionInitiatedBy ToRecommendedActionInitiatedBy(this string value) + { + if (string.Equals(value, "User", StringComparison.InvariantCultureIgnoreCase)) return RecommendedActionInitiatedBy.User; + if (string.Equals(value, "System", StringComparison.InvariantCultureIgnoreCase)) return RecommendedActionInitiatedBy.System; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedActionInitiatedBy value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs new file mode 100644 index 0000000000000..5ce2d5406231e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Gets if approval for applying this recommended action was given by user/system. + public enum RecommendedActionInitiatedBy + { + /// User. + User, + /// System. + System + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionMetricInfo.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionMetricInfo.Serialization.cs new file mode 100644 index 0000000000000..fb914e6c4cfa1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionMetricInfo.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class RecommendedActionMetricInfo + { + internal static RecommendedActionMetricInfo DeserializeRecommendedActionMetricInfo(JsonElement element) + { + Optional metricName = default; + Optional unit = default; + Optional timeGrain = default; + Optional startTime = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metricName")) + { + metricName = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit")) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeGrain")) + { + timeGrain = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + value = property.Value.GetDouble(); + continue; + } + } + return new RecommendedActionMetricInfo(metricName.Value, unit.Value, timeGrain.Value, Optional.ToNullable(startTime), Optional.ToNullable(value)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs new file mode 100644 index 0000000000000..1a32965d96914 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains time series of various impacted metrics for an Azure SQL Database, Server or Elastic Pool Recommended Action. + public partial class RecommendedActionMetricInfo + { + /// Initializes a new instance of RecommendedActionMetricInfo. + internal RecommendedActionMetricInfo() + { + } + + /// Initializes a new instance of RecommendedActionMetricInfo. + /// Gets the name of the metric. e.g., CPU, Number of Queries. + /// Gets the unit in which metric is measured. e.g., DTU, Frequency. + /// Gets the duration of time interval for the value given by this MetricInfo. e.g., PT1H (1 hour). + /// Gets the start time of time interval given by this MetricInfo. + /// Gets the value of the metric in the time interval given by this MetricInfo. + internal RecommendedActionMetricInfo(string metricName, string unit, string timeGrain, DateTimeOffset? startTime, double? value) + { + MetricName = metricName; + Unit = unit; + TimeGrain = timeGrain; + StartTime = startTime; + Value = value; + } + + /// Gets the name of the metric. e.g., CPU, Number of Queries. + public string MetricName { get; } + /// Gets the unit in which metric is measured. e.g., DTU, Frequency. + public string Unit { get; } + /// Gets the duration of time interval for the value given by this MetricInfo. e.g., PT1H (1 hour). + public string TimeGrain { get; } + /// Gets the start time of time interval given by this MetricInfo. + public DateTimeOffset? StartTime { get; } + /// Gets the value of the metric in the time interval given by this MetricInfo. + public double? Value { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionStateInfo.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionStateInfo.Serialization.cs new file mode 100644 index 0000000000000..d867ed83e9771 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionStateInfo.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class RecommendedActionStateInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("currentValue"); + writer.WriteStringValue(CurrentValue.ToString()); + writer.WriteEndObject(); + } + + internal static RecommendedActionStateInfo DeserializeRecommendedActionStateInfo(JsonElement element) + { + RecommendedActionCurrentState currentValue = default; + Optional actionInitiatedBy = default; + Optional lastModified = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("currentValue")) + { + currentValue = new RecommendedActionCurrentState(property.Value.GetString()); + continue; + } + if (property.NameEquals("actionInitiatedBy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + actionInitiatedBy = property.Value.GetString().ToRecommendedActionInitiatedBy(); + continue; + } + if (property.NameEquals("lastModified")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastModified = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new RecommendedActionStateInfo(currentValue, Optional.ToNullable(actionInitiatedBy), Optional.ToNullable(lastModified)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionStateInfo.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionStateInfo.cs new file mode 100644 index 0000000000000..262789c3ff646 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedActionStateInfo.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains information of current state for an Azure SQL Database, Server or Elastic Pool Recommended Action. + public partial class RecommendedActionStateInfo + { + /// Initializes a new instance of 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. + public RecommendedActionStateInfo(RecommendedActionCurrentState currentValue) + { + CurrentValue = currentValue; + } + + /// Initializes a new instance of 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. + /// 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. + /// Gets the time when the state was last modified. + internal RecommendedActionStateInfo(RecommendedActionCurrentState currentValue, RecommendedActionInitiatedBy? actionInitiatedBy, DateTimeOffset? lastModified) + { + CurrentValue = currentValue; + ActionInitiatedBy = actionInitiatedBy; + LastModified = lastModified; + } + + /// 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 RecommendedActionCurrentState CurrentValue { get; set; } + /// 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. + public RecommendedActionInitiatedBy? ActionInitiatedBy { get; } + /// Gets the time when the state was last modified. + public DateTimeOffset? LastModified { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPool.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPool.Serialization.cs deleted file mode 100644 index 3d8ce8c5c3b71..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPool.Serialization.cs +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - public partial class RecommendedElasticPool : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(Dtu)) - { - writer.WritePropertyName("dtu"); - writer.WriteNumberValue(Dtu.Value); - } - if (Optional.IsDefined(DatabaseDtuMin)) - { - writer.WritePropertyName("databaseDtuMin"); - writer.WriteNumberValue(DatabaseDtuMin.Value); - } - if (Optional.IsDefined(DatabaseDtuMax)) - { - writer.WritePropertyName("databaseDtuMax"); - writer.WriteNumberValue(DatabaseDtuMax.Value); - } - if (Optional.IsDefined(StorageMB)) - { - writer.WritePropertyName("storageMB"); - writer.WriteNumberValue(StorageMB.Value); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static RecommendedElasticPool DeserializeRecommendedElasticPool(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional databaseEdition = default; - Optional dtu = default; - Optional databaseDtuMin = default; - Optional databaseDtuMax = default; - Optional storageMB = default; - Optional observationPeriodStart = default; - Optional observationPeriodEnd = default; - Optional maxObservedDtu = default; - Optional maxObservedStorageMB = default; - Optional> databases = default; - Optional> metrics = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("databaseEdition")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - databaseEdition = new ElasticPoolEdition(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("dtu")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - dtu = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("databaseDtuMin")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - databaseDtuMin = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("databaseDtuMax")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - databaseDtuMax = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("storageMB")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - storageMB = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("observationPeriodStart")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - observationPeriodStart = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("observationPeriodEnd")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - observationPeriodEnd = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("maxObservedDtu")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - maxObservedDtu = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("maxObservedStorageMB")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - maxObservedStorageMB = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("databases")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(TrackedResource.DeserializeTrackedResource(item)); - } - databases = array; - continue; - } - if (property0.NameEquals("metrics")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(RecommendedElasticPoolMetric.DeserializeRecommendedElasticPoolMetric(item)); - } - metrics = array; - continue; - } - } - continue; - } - } - return new RecommendedElasticPool(id.Value, name.Value, type.Value, Optional.ToNullable(databaseEdition), Optional.ToNullable(dtu), Optional.ToNullable(databaseDtuMin), Optional.ToNullable(databaseDtuMax), Optional.ToNullable(storageMB), Optional.ToNullable(observationPeriodStart), Optional.ToNullable(observationPeriodEnd), Optional.ToNullable(maxObservedDtu), Optional.ToNullable(maxObservedStorageMB), Optional.ToList(databases), Optional.ToList(metrics)); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPool.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPool.cs deleted file mode 100644 index cfbb4a2efbd38..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPool.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents a recommended elastic pool. - public partial class RecommendedElasticPool : ProxyResource - { - /// Initializes a new instance of RecommendedElasticPool. - public RecommendedElasticPool() - { - Databases = new ChangeTrackingList(); - Metrics = new ChangeTrackingList(); - } - - /// Initializes a new instance of RecommendedElasticPool. - /// Resource ID. - /// Resource name. - /// Resource type. - /// The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. - /// The DTU for the recommended elastic pool. - /// The minimum DTU for the database. - /// The maximum DTU for the database. - /// Gets storage size in megabytes. - /// The observation period start (ISO8601 format). - /// The observation period start (ISO8601 format). - /// Gets maximum observed DTU. - /// Gets maximum observed storage in megabytes. - /// The list of databases in this pool. Expanded property. - /// The list of databases housed in the server. Expanded property. - internal RecommendedElasticPool(string id, string name, string type, ElasticPoolEdition? databaseEdition, double? dtu, double? databaseDtuMin, double? databaseDtuMax, double? storageMB, DateTimeOffset? observationPeriodStart, DateTimeOffset? observationPeriodEnd, double? maxObservedDtu, double? maxObservedStorageMB, IReadOnlyList databases, IReadOnlyList metrics) : base(id, name, type) - { - DatabaseEdition = databaseEdition; - Dtu = dtu; - DatabaseDtuMin = databaseDtuMin; - DatabaseDtuMax = databaseDtuMax; - StorageMB = storageMB; - ObservationPeriodStart = observationPeriodStart; - ObservationPeriodEnd = observationPeriodEnd; - MaxObservedDtu = maxObservedDtu; - MaxObservedStorageMB = maxObservedStorageMB; - Databases = databases; - Metrics = metrics; - } - - /// The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. - public ElasticPoolEdition? DatabaseEdition { get; } - /// The DTU for the recommended elastic pool. - public double? Dtu { get; set; } - /// The minimum DTU for the database. - public double? DatabaseDtuMin { get; set; } - /// The maximum DTU for the database. - public double? DatabaseDtuMax { get; set; } - /// Gets storage size in megabytes. - public double? StorageMB { get; set; } - /// The observation period start (ISO8601 format). - public DateTimeOffset? ObservationPeriodStart { get; } - /// The observation period start (ISO8601 format). - public DateTimeOffset? ObservationPeriodEnd { get; } - /// Gets maximum observed DTU. - public double? MaxObservedDtu { get; } - /// Gets maximum observed storage in megabytes. - public double? MaxObservedStorageMB { get; } - /// The list of databases in this pool. Expanded property. - public IReadOnlyList Databases { get; } - /// The list of databases housed in the server. Expanded property. - public IReadOnlyList Metrics { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListMetricsResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListMetricsResult.Serialization.cs deleted file mode 100644 index afee8b2a564e1..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListMetricsResult.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - internal partial class RecommendedElasticPoolListMetricsResult - { - internal static RecommendedElasticPoolListMetricsResult DeserializeRecommendedElasticPoolListMetricsResult(JsonElement element) - { - IReadOnlyList value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RecommendedElasticPoolMetric.DeserializeRecommendedElasticPoolMetric(item)); - } - value = array; - continue; - } - } - return new RecommendedElasticPoolListMetricsResult(value); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListMetricsResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListMetricsResult.cs deleted file mode 100644 index 71b57a8326aa3..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListMetricsResult.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents the response to a list recommended elastic pool metrics request. - internal partial class RecommendedElasticPoolListMetricsResult - { - /// Initializes a new instance of RecommendedElasticPoolListMetricsResult. - /// The list of recommended elastic pools metrics. - /// is null. - internal RecommendedElasticPoolListMetricsResult(IEnumerable value) - { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - - Value = value.ToList(); - } - - /// Initializes a new instance of RecommendedElasticPoolListMetricsResult. - /// The list of recommended elastic pools metrics. - internal RecommendedElasticPoolListMetricsResult(IReadOnlyList value) - { - Value = value; - } - - /// The list of recommended elastic pools metrics. - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListResult.Serialization.cs deleted file mode 100644 index 1ffed559d7114..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListResult.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - internal partial class RecommendedElasticPoolListResult - { - internal static RecommendedElasticPoolListResult DeserializeRecommendedElasticPoolListResult(JsonElement element) - { - IReadOnlyList value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RecommendedElasticPool.DeserializeRecommendedElasticPool(item)); - } - value = array; - continue; - } - } - return new RecommendedElasticPoolListResult(value); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListResult.cs deleted file mode 100644 index 558b74506e932..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolListResult.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents the response to a list recommended elastic pool request. - internal partial class RecommendedElasticPoolListResult - { - /// Initializes a new instance of RecommendedElasticPoolListResult. - /// The list of recommended elastic pools hosted in the server. - /// is null. - internal RecommendedElasticPoolListResult(IEnumerable value) - { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - - Value = value.ToList(); - } - - /// Initializes a new instance of RecommendedElasticPoolListResult. - /// The list of recommended elastic pools hosted in the server. - internal RecommendedElasticPoolListResult(IReadOnlyList value) - { - Value = value; - } - - /// The list of recommended elastic pools hosted in the server. - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolMetric.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolMetric.Serialization.cs deleted file mode 100644 index 1891650f9b8f2..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolMetric.Serialization.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - public partial class RecommendedElasticPoolMetric - { - internal static RecommendedElasticPoolMetric DeserializeRecommendedElasticPoolMetric(JsonElement element) - { - Optional dateTime = default; - Optional dtu = default; - Optional sizeGB = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("dateTime")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - dateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("dtu")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - dtu = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("sizeGB")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - sizeGB = property.Value.GetDouble(); - continue; - } - } - return new RecommendedElasticPoolMetric(Optional.ToNullable(dateTime), Optional.ToNullable(dtu), Optional.ToNullable(sizeGB)); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs deleted file mode 100644 index 20b55c0c58451..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents recommended elastic pool metric. - public partial class RecommendedElasticPoolMetric - { - /// Initializes a new instance of RecommendedElasticPoolMetric. - internal RecommendedElasticPoolMetric() - { - } - - /// Initializes a new instance of RecommendedElasticPoolMetric. - /// The time of metric (ISO8601 format). - /// Gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. - /// Gets or sets size in gigabytes. - internal RecommendedElasticPoolMetric(DateTimeOffset? dateTime, double? dtu, double? sizeGB) - { - DateTime = dateTime; - Dtu = dtu; - SizeGB = sizeGB; - } - - /// The time of metric (ISO8601 format). - public DateTimeOffset? DateTime { get; } - /// Gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. - public double? Dtu { get; } - /// Gets or sets size in gigabytes. - public double? SizeGB { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndex.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndex.cs deleted file mode 100644 index 88350bd22f5c7..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndex.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents a database recommended index. - public partial class RecommendedIndex : ProxyResource - { - /// Initializes a new instance of RecommendedIndex. - public RecommendedIndex() - { - Columns = new ChangeTrackingList(); - IncludedColumns = new ChangeTrackingList(); - EstimatedImpact = new ChangeTrackingList(); - ReportedImpact = new ChangeTrackingList(); - } - - /// Initializes a new instance of RecommendedIndex. - /// Resource ID. - /// Resource name. - /// Resource type. - /// The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. - /// The current recommendation state. - /// The UTC datetime showing when this resource was created (ISO8601 format). - /// The UTC datetime of when was this resource last changed (ISO8601 format). - /// The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). - /// The schema where table to build index over resides. - /// The table on which to build index. - /// Columns over which to build index. - /// The list of column names to be included in the index. - /// The full build index script. - /// The estimated impact of doing recommended index action. - /// The values reported after index action is complete. - internal RecommendedIndex(string id, string name, string type, RecommendedIndexAction? action, RecommendedIndexState? state, DateTimeOffset? created, DateTimeOffset? lastModified, RecommendedIndexType? indexType, string schema, string table, IReadOnlyList columns, IReadOnlyList includedColumns, string indexScript, IReadOnlyList estimatedImpact, IReadOnlyList reportedImpact) : base(id, name, type) - { - Action = action; - State = state; - Created = created; - LastModified = lastModified; - IndexType = indexType; - Schema = schema; - Table = table; - Columns = columns; - IncludedColumns = includedColumns; - IndexScript = indexScript; - EstimatedImpact = estimatedImpact; - ReportedImpact = reportedImpact; - } - - /// The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. - public RecommendedIndexAction? Action { get; } - /// The current recommendation state. - public RecommendedIndexState? State { get; } - /// The UTC datetime showing when this resource was created (ISO8601 format). - public DateTimeOffset? Created { get; } - /// The UTC datetime of when was this resource last changed (ISO8601 format). - public DateTimeOffset? LastModified { get; } - /// The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). - public RecommendedIndexType? IndexType { get; } - /// The schema where table to build index over resides. - public string Schema { get; } - /// The table on which to build index. - public string Table { get; } - /// Columns over which to build index. - public IReadOnlyList Columns { get; } - /// The list of column names to be included in the index. - public IReadOnlyList IncludedColumns { get; } - /// The full build index script. - public string IndexScript { get; } - /// The estimated impact of doing recommended index action. - public IReadOnlyList EstimatedImpact { get; } - /// The values reported after index action is complete. - public IReadOnlyList ReportedImpact { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexAction.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexAction.Serialization.cs deleted file mode 100644 index 1a5ff9c78581f..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexAction.Serialization.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - internal static partial class RecommendedIndexActionExtensions - { - public static string ToSerialString(this RecommendedIndexAction value) => value switch - { - RecommendedIndexAction.Create => "Create", - RecommendedIndexAction.Drop => "Drop", - RecommendedIndexAction.Rebuild => "Rebuild", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedIndexAction value.") - }; - - public static RecommendedIndexAction ToRecommendedIndexAction(this string value) - { - if (string.Equals(value, "Create", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexAction.Create; - if (string.Equals(value, "Drop", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexAction.Drop; - if (string.Equals(value, "Rebuild", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexAction.Rebuild; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedIndexAction value."); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexAction.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexAction.cs deleted file mode 100644 index 9721c91fd9f34..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexAction.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Sql.Models -{ - /// The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. - public enum RecommendedIndexAction - { - /// Create. - Create, - /// Drop. - Drop, - /// Rebuild. - Rebuild - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexState.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexState.Serialization.cs deleted file mode 100644 index 91930deea79c9..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexState.Serialization.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - internal static partial class RecommendedIndexStateExtensions - { - public static string ToSerialString(this RecommendedIndexState value) => value switch - { - RecommendedIndexState.Active => "Active", - RecommendedIndexState.Pending => "Pending", - RecommendedIndexState.Executing => "Executing", - RecommendedIndexState.Verifying => "Verifying", - RecommendedIndexState.PendingRevert => "Pending Revert", - RecommendedIndexState.Reverting => "Reverting", - RecommendedIndexState.Reverted => "Reverted", - RecommendedIndexState.Ignored => "Ignored", - RecommendedIndexState.Expired => "Expired", - RecommendedIndexState.Blocked => "Blocked", - RecommendedIndexState.Success => "Success", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedIndexState value.") - }; - - public static RecommendedIndexState ToRecommendedIndexState(this string value) - { - if (string.Equals(value, "Active", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Active; - if (string.Equals(value, "Pending", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Pending; - if (string.Equals(value, "Executing", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Executing; - if (string.Equals(value, "Verifying", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Verifying; - if (string.Equals(value, "Pending Revert", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.PendingRevert; - if (string.Equals(value, "Reverting", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Reverting; - if (string.Equals(value, "Reverted", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Reverted; - if (string.Equals(value, "Ignored", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Ignored; - if (string.Equals(value, "Expired", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Expired; - if (string.Equals(value, "Blocked", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Blocked; - if (string.Equals(value, "Success", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexState.Success; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedIndexState value."); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexState.cs deleted file mode 100644 index 9731a880fea49..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexState.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Sql.Models -{ - /// The current recommendation state. - public enum RecommendedIndexState - { - /// Active. - Active, - /// Pending. - Pending, - /// Executing. - Executing, - /// Verifying. - Verifying, - /// Pending Revert. - PendingRevert, - /// Reverting. - Reverting, - /// Reverted. - Reverted, - /// Ignored. - Ignored, - /// Expired. - Expired, - /// Blocked. - Blocked, - /// Success. - Success - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexType.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexType.Serialization.cs deleted file mode 100644 index efe020b2eb719..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexType.Serialization.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - internal static partial class RecommendedIndexTypeExtensions - { - public static string ToSerialString(this RecommendedIndexType value) => value switch - { - RecommendedIndexType.Clustered => "CLUSTERED", - RecommendedIndexType.Nonclustered => "NONCLUSTERED", - RecommendedIndexType.Columnstore => "COLUMNSTORE", - RecommendedIndexType.ClusteredColumnstore => "CLUSTERED COLUMNSTORE", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedIndexType value.") - }; - - public static RecommendedIndexType ToRecommendedIndexType(this string value) - { - if (string.Equals(value, "CLUSTERED", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexType.Clustered; - if (string.Equals(value, "NONCLUSTERED", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexType.Nonclustered; - if (string.Equals(value, "COLUMNSTORE", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexType.Columnstore; - if (string.Equals(value, "CLUSTERED COLUMNSTORE", StringComparison.InvariantCultureIgnoreCase)) return RecommendedIndexType.ClusteredColumnstore; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedIndexType value."); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexType.cs deleted file mode 100644 index 4a18054dfcad5..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndexType.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Sql.Models -{ - /// The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). - public enum RecommendedIndexType - { - /// CLUSTERED. - Clustered, - /// NONCLUSTERED. - Nonclustered, - /// COLUMNSTORE. - Columnstore, - /// CLUSTERED COLUMNSTORE. - ClusteredColumnstore - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.Serialization.cs new file mode 100644 index 0000000000000..1f32e6cebee18 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class RecommendedSensitivityLabelUpdate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Op)) + { + writer.WritePropertyName("op"); + writer.WriteStringValue(Op.Value.ToSerialString()); + } + if (Optional.IsDefined(Schema)) + { + writer.WritePropertyName("schema"); + writer.WriteStringValue(Schema); + } + if (Optional.IsDefined(Table)) + { + writer.WritePropertyName("table"); + writer.WriteStringValue(Table); + } + if (Optional.IsDefined(Column)) + { + writer.WritePropertyName("column"); + writer.WriteStringValue(Column); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static RecommendedSensitivityLabelUpdate DeserializeRecommendedSensitivityLabelUpdate(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional op = default; + Optional schema = default; + Optional table = default; + Optional column = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("op")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + op = property0.Value.GetString().ToRecommendedSensitivityLabelUpdateKind(); + continue; + } + if (property0.NameEquals("schema")) + { + schema = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("table")) + { + table = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("column")) + { + column = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new RecommendedSensitivityLabelUpdate(id.Value, name.Value, type.Value, Optional.ToNullable(op), schema.Value, table.Value, column.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs new file mode 100644 index 0000000000000..41d733407e45d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A recommended sensitivity label update operation. + public partial class RecommendedSensitivityLabelUpdate : ProxyResource + { + /// Initializes a new instance of RecommendedSensitivityLabelUpdate. + public RecommendedSensitivityLabelUpdate() + { + } + + /// Initializes a new instance of RecommendedSensitivityLabelUpdate. + /// Resource ID. + /// Resource name. + /// Resource type. + /// . + /// Schema name of the column to update. + /// Table name of the column to update. + /// Column name to update. + internal RecommendedSensitivityLabelUpdate(string id, string name, string type, RecommendedSensitivityLabelUpdateKind? op, string schema, string table, string column) : base(id, name, type) + { + Op = op; + Schema = schema; + Table = table; + Column = column; + } + + public RecommendedSensitivityLabelUpdateKind? Op { get; set; } + /// Schema name of the column to update. + public string Schema { get; set; } + /// Table name of the column to update. + public string Table { get; set; } + /// Column name to update. + public string Column { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.Serialization.cs new file mode 100644 index 0000000000000..461b4c3df2eb8 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class RecommendedSensitivityLabelUpdateKindExtensions + { + public static string ToSerialString(this RecommendedSensitivityLabelUpdateKind value) => value switch + { + RecommendedSensitivityLabelUpdateKind.Enable => "enable", + RecommendedSensitivityLabelUpdateKind.Disable => "disable", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedSensitivityLabelUpdateKind value.") + }; + + public static RecommendedSensitivityLabelUpdateKind ToRecommendedSensitivityLabelUpdateKind(this string value) + { + if (string.Equals(value, "enable", StringComparison.InvariantCultureIgnoreCase)) return RecommendedSensitivityLabelUpdateKind.Enable; + if (string.Equals(value, "disable", StringComparison.InvariantCultureIgnoreCase)) return RecommendedSensitivityLabelUpdateKind.Disable; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RecommendedSensitivityLabelUpdateKind value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs new file mode 100644 index 0000000000000..ba30a7e810447 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The RecommendedSensitivityLabelUpdateKind. + public enum RecommendedSensitivityLabelUpdateKind + { + /// enable. + Enable, + /// disable. + Disable + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.Serialization.cs new file mode 100644 index 0000000000000..0f5e2c8ac42ce --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class RecommendedSensitivityLabelUpdateList : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Operations)) + { + writer.WritePropertyName("operations"); + writer.WriteStartArray(); + foreach (var item in Operations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs new file mode 100644 index 0000000000000..3203c8328e9c9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of recommended sensitivity label update operations. + public partial class RecommendedSensitivityLabelUpdateList + { + /// Initializes a new instance of RecommendedSensitivityLabelUpdateList. + public RecommendedSensitivityLabelUpdateList() + { + Operations = new ChangeTrackingList(); + } + + public IList Operations { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLink.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLink.Serialization.cs index 1b44b71f24a7f..686db5fe1387a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLink.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLink.Serialization.cs @@ -24,27 +24,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ReplicationLink DeserializeReplicationLink(JsonElement element) { - Optional location = default; Optional id = default; Optional name = default; Optional type = default; - Optional isTerminationAllowed = default; - Optional replicationMode = default; Optional partnerServer = default; Optional partnerDatabase = default; Optional partnerLocation = default; Optional role = default; Optional partnerRole = default; + Optional replicationMode = default; Optional startTime = default; Optional percentComplete = default; Optional replicationState = default; + Optional isTerminationAllowed = default; + Optional linkType = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("location")) - { - location = property.Value.GetString(); - continue; - } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -69,21 +64,6 @@ internal static ReplicationLink DeserializeReplicationLink(JsonElement element) } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("isTerminationAllowed")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - isTerminationAllowed = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("replicationMode")) - { - replicationMode = property0.Value.GetString(); - continue; - } if (property0.NameEquals("partnerServer")) { partnerServer = property0.Value.GetString(); @@ -119,6 +99,11 @@ internal static ReplicationLink DeserializeReplicationLink(JsonElement element) partnerRole = property0.Value.GetString().ToReplicationRole(); continue; } + if (property0.NameEquals("replicationMode")) + { + replicationMode = property0.Value.GetString(); + continue; + } if (property0.NameEquals("startTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -149,11 +134,31 @@ internal static ReplicationLink DeserializeReplicationLink(JsonElement element) replicationState = new ReplicationState(property0.Value.GetString()); continue; } + if (property0.NameEquals("isTerminationAllowed")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isTerminationAllowed = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("linkType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + linkType = new ReplicationLinkType(property0.Value.GetString()); + continue; + } } continue; } } - return new ReplicationLink(id.Value, name.Value, type.Value, location.Value, Optional.ToNullable(isTerminationAllowed), replicationMode.Value, partnerServer.Value, partnerDatabase.Value, partnerLocation.Value, Optional.ToNullable(role), Optional.ToNullable(partnerRole), Optional.ToNullable(startTime), Optional.ToNullable(percentComplete), Optional.ToNullable(replicationState)); + return new ReplicationLink(id.Value, name.Value, type.Value, partnerServer.Value, partnerDatabase.Value, partnerLocation.Value, Optional.ToNullable(role), Optional.ToNullable(partnerRole), replicationMode.Value, Optional.ToNullable(startTime), Optional.ToNullable(percentComplete), Optional.ToNullable(replicationState), Optional.ToNullable(isTerminationAllowed), Optional.ToNullable(linkType)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLink.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLink.cs index e4b247fe7bfbc..3b975bdf8e706 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLink.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLink.cs @@ -9,7 +9,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// Represents a database replication link. + /// A replication link. public partial class ReplicationLink : ProxyResource { /// Initializes a new instance of ReplicationLink. @@ -21,53 +21,53 @@ public ReplicationLink() /// Resource ID. /// Resource name. /// Resource type. - /// Location of the server that contains this firewall rule. - /// Legacy value indicating whether termination is allowed. Currently always returns true. - /// Replication mode of this replication link. - /// The name of the server hosting the partner database. - /// The name of the partner database. - /// The Azure Region of the partner database. - /// The role of the database in the replication link. - /// The role of the partner database in the replication link. - /// The start time for the replication link. - /// The percentage of seeding complete for the replication link. - /// The replication state for the replication link. - internal ReplicationLink(string id, string name, string type, string location, bool? isTerminationAllowed, string replicationMode, string partnerServer, string partnerDatabase, string partnerLocation, ReplicationRole? role, ReplicationRole? partnerRole, DateTimeOffset? startTime, int? percentComplete, ReplicationState? replicationState) : base(id, name, type) + /// Resource partner server. + /// Resource partner database. + /// Resource partner location. + /// Local replication role. + /// Partner replication role. + /// Replication mode. + /// Time at which the link was created. + /// Seeding completion percentage for the link. + /// Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + /// Whether the user is currently allowed to terminate the link. + /// Link type (GEO, NAMED). + internal ReplicationLink(string id, string name, string type, string partnerServer, string partnerDatabase, string partnerLocation, ReplicationRole? role, ReplicationRole? partnerRole, string replicationMode, DateTimeOffset? startTime, int? percentComplete, ReplicationState? replicationState, bool? isTerminationAllowed, ReplicationLinkType? linkType) : base(id, name, type) { - Location = location; - IsTerminationAllowed = isTerminationAllowed; - ReplicationMode = replicationMode; PartnerServer = partnerServer; PartnerDatabase = partnerDatabase; PartnerLocation = partnerLocation; Role = role; PartnerRole = partnerRole; + ReplicationMode = replicationMode; StartTime = startTime; PercentComplete = percentComplete; ReplicationState = replicationState; + IsTerminationAllowed = isTerminationAllowed; + LinkType = linkType; } - /// Location of the server that contains this firewall rule. - public string Location { get; } - /// Legacy value indicating whether termination is allowed. Currently always returns true. - public bool? IsTerminationAllowed { get; } - /// Replication mode of this replication link. - public string ReplicationMode { get; } - /// The name of the server hosting the partner database. + /// Resource partner server. public string PartnerServer { get; } - /// The name of the partner database. + /// Resource partner database. public string PartnerDatabase { get; } - /// The Azure Region of the partner database. + /// Resource partner location. public string PartnerLocation { get; } - /// The role of the database in the replication link. + /// Local replication role. public ReplicationRole? Role { get; } - /// The role of the partner database in the replication link. + /// Partner replication role. public ReplicationRole? PartnerRole { get; } - /// The start time for the replication link. + /// Replication mode. + public string ReplicationMode { get; } + /// Time at which the link was created. public DateTimeOffset? StartTime { get; } - /// The percentage of seeding complete for the replication link. + /// Seeding completion percentage for the link. public int? PercentComplete { get; } - /// The replication state for the replication link. + /// Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). public ReplicationState? ReplicationState { get; } + /// Whether the user is currently allowed to terminate the link. + public bool? IsTerminationAllowed { get; } + /// Link type (GEO, NAMED). + public ReplicationLinkType? LinkType { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkListResult.Serialization.cs index 6dc666e9929df..607570bb7f49d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkListResult.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkListResult.Serialization.cs @@ -16,6 +16,7 @@ internal partial class ReplicationLinkListResult internal static ReplicationLinkListResult DeserializeReplicationLinkListResult(JsonElement element) { Optional> value = default; + Optional nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) @@ -33,8 +34,13 @@ internal static ReplicationLinkListResult DeserializeReplicationLinkListResult(J value = array; continue; } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } } - return new ReplicationLinkListResult(Optional.ToList(value)); + return new ReplicationLinkListResult(Optional.ToList(value), nextLink.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkListResult.cs index ba42ee3e04d49..dc97d7b8bb7f4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkListResult.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkListResult.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// Represents the response to a List database replication link request. + /// A list of replication links. internal partial class ReplicationLinkListResult { /// Initializes a new instance of ReplicationLinkListResult. @@ -20,13 +20,17 @@ internal ReplicationLinkListResult() } /// Initializes a new instance of ReplicationLinkListResult. - /// The list of database replication links housed in the database. - internal ReplicationLinkListResult(IReadOnlyList value) + /// Array of results. + /// Link to retrieve next page of results. + internal ReplicationLinkListResult(IReadOnlyList value, string nextLink) { Value = value; + NextLink = nextLink; } - /// The list of database replication links housed in the database. + /// Array of results. public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkType.cs new file mode 100644 index 0000000000000..f9fd07ed88667 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationLinkType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Link type (GEO, NAMED). + public readonly partial struct ReplicationLinkType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ReplicationLinkType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GEOValue = "GEO"; + private const string NamedValue = "NAMED"; + + /// GEO. + public static ReplicationLinkType GEO { get; } = new ReplicationLinkType(GEOValue); + /// NAMED. + public static ReplicationLinkType Named { get; } = new ReplicationLinkType(NamedValue); + /// Determines if two values are the same. + public static bool operator ==(ReplicationLinkType left, ReplicationLinkType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ReplicationLinkType left, ReplicationLinkType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ReplicationLinkType(string value) => new ReplicationLinkType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicationLinkType other && Equals(other); + /// + public bool Equals(ReplicationLinkType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationRole.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationRole.cs index cec4ac472546c..831b56f9d4a7d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationRole.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationRole.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// The role of the database in the replication link. + /// Local replication role. public enum ReplicationRole { /// Primary. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationState.cs index 961ccae5d2977..93b289adbb3ce 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationState.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationState.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// The replication state for the replication link. + /// Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). public readonly partial struct ReplicationState : IEquatable { private readonly string _value; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceIdentity.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceIdentity.Serialization.cs index 39fd5f18a04e9..58b85577544a2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceIdentity.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceIdentity.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -16,6 +17,17 @@ public partial class ResourceIdentity : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsCollectionDefined(UserAssignedIdentities)) + { + writer.WritePropertyName("userAssignedIdentities"); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } if (Optional.IsDefined(Type)) { writer.WritePropertyName("type"); @@ -26,11 +38,27 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ResourceIdentity DeserializeResourceIdentity(JsonElement element) { + Optional> userAssignedIdentities = default; Optional principalId = default; Optional type = default; Optional tenantId = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("userAssignedIdentities")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, UserIdentity.DeserializeUserIdentity(property0.Value)); + } + userAssignedIdentities = dictionary; + continue; + } if (property.NameEquals("principalId")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -62,7 +90,7 @@ internal static ResourceIdentity DeserializeResourceIdentity(JsonElement element continue; } } - return new ResourceIdentity(Optional.ToNullable(principalId), Optional.ToNullable(type), Optional.ToNullable(tenantId)); + return new ResourceIdentity(Optional.ToDictionary(userAssignedIdentities), Optional.ToNullable(principalId), Optional.ToNullable(type), Optional.ToNullable(tenantId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceIdentity.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceIdentity.cs index cd1d533ba5713..e772e6aec1fb8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceIdentity.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceIdentity.cs @@ -6,6 +6,8 @@ #nullable disable using System; +using System.Collections.Generic; +using Azure.Core; namespace Azure.ResourceManager.Sql.Models { @@ -15,19 +17,24 @@ public partial class ResourceIdentity /// Initializes a new instance of ResourceIdentity. public ResourceIdentity() { + UserAssignedIdentities = new ChangeTrackingDictionary(); } /// Initializes a new instance of ResourceIdentity. + /// The resource ids of the user assigned identities to use. /// The Azure Active Directory principal id. /// The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. /// The Azure Active Directory tenant id. - internal ResourceIdentity(Guid? principalId, IdentityType? type, Guid? tenantId) + internal ResourceIdentity(IDictionary userAssignedIdentities, Guid? principalId, IdentityType? type, Guid? tenantId) { + UserAssignedIdentities = userAssignedIdentities; PrincipalId = principalId; Type = type; TenantId = tenantId; } + /// The resource ids of the user assigned identities to use. + public IDictionary UserAssignedIdentities { get; } /// The Azure Active Directory principal id. public Guid? PrincipalId { get; } /// The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceWithWritableName.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceWithWritableName.Serialization.cs new file mode 100644 index 0000000000000..81b94e333fed1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceWithWritableName.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ResourceWithWritableName : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + writer.WriteEndObject(); + } + + internal static ResourceWithWritableName DeserializeResourceWithWritableName(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new ResourceWithWritableName(id.Value, name.Value, type.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceWithWritableName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceWithWritableName.cs new file mode 100644 index 0000000000000..7f84b9e2af255 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ResourceWithWritableName.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// ARM resource. + public partial class ResourceWithWritableName + { + /// Initializes a new instance of ResourceWithWritableName. + public ResourceWithWritableName() + { + } + + /// Initializes a new instance of ResourceWithWritableName. + /// Resource ID. + /// Resource name. + /// Resource type. + internal ResourceWithWritableName(string id, string name, string type) + { + Id = id; + Name = name; + Type = type; + } + + /// Resource ID. + public string Id { get; } + /// Resource name. + public string Name { get; set; } + /// Resource type. + public string Type { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabase.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabase.Serialization.cs index b3fe99968426e..bca514877be6b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabase.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabase.Serialization.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -16,6 +17,27 @@ public partial class RestorableDroppedDatabase : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WriteEndObject(); @@ -24,25 +46,50 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static RestorableDroppedDatabase DeserializeRestorableDroppedDatabase(JsonElement element) { + Optional sku = default; Optional location = default; + Optional> tags = default; Optional id = default; Optional name = default; Optional type = default; Optional databaseName = default; - Optional edition = default; - Optional maxSizeBytes = default; - Optional serviceLevelObjective = default; - Optional elasticPoolName = default; + Optional maxSizeBytes = default; Optional creationDate = default; Optional deletionDate = default; Optional earliestRestoreDate = default; + Optional backupStorageRedundancy = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + sku = Sku.DeserializeSku(property.Value); + continue; + } if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -72,24 +119,14 @@ internal static RestorableDroppedDatabase DeserializeRestorableDroppedDatabase(J databaseName = property0.Value.GetString(); continue; } - if (property0.NameEquals("edition")) - { - edition = property0.Value.GetString(); - continue; - } if (property0.NameEquals("maxSizeBytes")) { - maxSizeBytes = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("serviceLevelObjective")) - { - serviceLevelObjective = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("elasticPoolName")) - { - elasticPoolName = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + maxSizeBytes = property0.Value.GetInt64(); continue; } if (property0.NameEquals("creationDate")) @@ -122,11 +159,21 @@ internal static RestorableDroppedDatabase DeserializeRestorableDroppedDatabase(J earliestRestoreDate = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("backupStorageRedundancy")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + backupStorageRedundancy = new BackupStorageRedundancy(property0.Value.GetString()); + continue; + } } continue; } } - return new RestorableDroppedDatabase(id.Value, name.Value, type.Value, location.Value, databaseName.Value, edition.Value, maxSizeBytes.Value, serviceLevelObjective.Value, elasticPoolName.Value, Optional.ToNullable(creationDate), Optional.ToNullable(deletionDate), Optional.ToNullable(earliestRestoreDate)); + return new RestorableDroppedDatabase(id.Value, name.Value, type.Value, sku.Value, location.Value, Optional.ToDictionary(tags), databaseName.Value, Optional.ToNullable(maxSizeBytes), Optional.ToNullable(creationDate), Optional.ToNullable(deletionDate), Optional.ToNullable(earliestRestoreDate), Optional.ToNullable(backupStorageRedundancy)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabase.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabase.cs index d5e4f9836fedb..8b1074c902784 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabase.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabase.cs @@ -6,60 +6,63 @@ #nullable disable using System; +using System.Collections.Generic; +using Azure.Core; namespace Azure.ResourceManager.Sql.Models { - /// A restorable dropped database. + /// A restorable dropped database resource. public partial class RestorableDroppedDatabase : ProxyResource { /// Initializes a new instance of RestorableDroppedDatabase. public RestorableDroppedDatabase() { + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of RestorableDroppedDatabase. /// Resource ID. /// Resource name. /// Resource type. - /// The geo-location where the resource lives. + /// The name and tier of the SKU. + /// Resource location. + /// Resource tags. /// The name of the database. - /// The edition of the database. - /// The max size in bytes of the database. - /// The service level objective name of the database. - /// The elastic pool name of the database. + /// The max size of the database expressed in bytes. /// The creation date of the database (ISO8601 format). /// The deletion date of the database (ISO8601 format). /// The earliest restore date of the database (ISO8601 format). - internal RestorableDroppedDatabase(string id, string name, string type, string location, string databaseName, string edition, string maxSizeBytes, string serviceLevelObjective, string elasticPoolName, DateTimeOffset? creationDate, DateTimeOffset? deletionDate, DateTimeOffset? earliestRestoreDate) : base(id, name, type) + /// The storage account type used to store backups for this database. + internal RestorableDroppedDatabase(string id, string name, string type, Sku sku, string location, IDictionary tags, string databaseName, long? maxSizeBytes, DateTimeOffset? creationDate, DateTimeOffset? deletionDate, DateTimeOffset? earliestRestoreDate, BackupStorageRedundancy? backupStorageRedundancy) : base(id, name, type) { + Sku = sku; Location = location; + Tags = tags; DatabaseName = databaseName; - Edition = edition; MaxSizeBytes = maxSizeBytes; - ServiceLevelObjective = serviceLevelObjective; - ElasticPoolName = elasticPoolName; CreationDate = creationDate; DeletionDate = deletionDate; EarliestRestoreDate = earliestRestoreDate; + BackupStorageRedundancy = backupStorageRedundancy; } - /// The geo-location where the resource lives. - public string Location { get; } + /// The name and tier of the SKU. + public Sku Sku { get; set; } + /// Resource location. + public string Location { get; set; } + /// Resource tags. + public IDictionary Tags { get; } /// The name of the database. public string DatabaseName { get; } - /// The edition of the database. - public string Edition { get; } - /// The max size in bytes of the database. - public string MaxSizeBytes { get; } - /// The service level objective name of the database. - public string ServiceLevelObjective { get; } - /// The elastic pool name of the database. - public string ElasticPoolName { get; } + /// The max size of the database expressed in bytes. + public long? MaxSizeBytes { get; } /// The creation date of the database (ISO8601 format). public DateTimeOffset? CreationDate { get; } /// The deletion date of the database (ISO8601 format). public DateTimeOffset? DeletionDate { get; } /// The earliest restore date of the database (ISO8601 format). public DateTimeOffset? EarliestRestoreDate { get; } + /// The storage account type used to store backups for this database. + public BackupStorageRedundancy? BackupStorageRedundancy { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseListResult.Serialization.cs index a455f50a744f3..2f5c23e656484 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseListResult.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseListResult.Serialization.cs @@ -15,11 +15,17 @@ internal partial class RestorableDroppedDatabaseListResult { internal static RestorableDroppedDatabaseListResult DeserializeRestorableDroppedDatabaseListResult(JsonElement element) { - IReadOnlyList value = default; + Optional> value = default; + Optional nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -28,8 +34,13 @@ internal static RestorableDroppedDatabaseListResult DeserializeRestorableDropped value = array; continue; } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } } - return new RestorableDroppedDatabaseListResult(value); + return new RestorableDroppedDatabaseListResult(Optional.ToList(value), nextLink.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseListResult.cs index d3064cbf6007d..08226ef290594 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseListResult.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RestorableDroppedDatabaseListResult.cs @@ -5,36 +5,32 @@ #nullable disable -using System; using System.Collections.Generic; -using System.Linq; +using Azure.Core; namespace Azure.ResourceManager.Sql.Models { - /// The response to a list restorable dropped databases request. + /// A list of restorable dropped databases. internal partial class RestorableDroppedDatabaseListResult { /// Initializes a new instance of RestorableDroppedDatabaseListResult. - /// A list of restorable dropped databases. - /// is null. - internal RestorableDroppedDatabaseListResult(IEnumerable value) + internal RestorableDroppedDatabaseListResult() { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - - Value = value.ToList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of RestorableDroppedDatabaseListResult. - /// A list of restorable dropped databases. - internal RestorableDroppedDatabaseListResult(IReadOnlyList value) + /// Array of results. + /// Link to retrieve next page of results. + internal RestorableDroppedDatabaseListResult(IReadOnlyList value, string nextLink) { Value = value; + NextLink = nextLink; } - /// A list of restorable dropped databases. + /// Array of results. public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecondaryType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecondaryType.cs new file mode 100644 index 0000000000000..a3fa45fe36a2a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecondaryType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The secondary type of the database if it is a secondary. Valid values are Geo and Named. + public readonly partial struct SecondaryType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public SecondaryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GeoValue = "Geo"; + private const string NamedValue = "Named"; + + /// Geo. + public static SecondaryType Geo { get; } = new SecondaryType(GeoValue); + /// Named. + public static SecondaryType Named { get; } = new SecondaryType(NamedValue); + /// Determines if two values are the same. + public static bool operator ==(SecondaryType left, SecondaryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SecondaryType left, SecondaryType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SecondaryType(string value) => new SecondaryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SecondaryType other && Equals(other); + /// + public bool Equals(SecondaryType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.Serialization.cs deleted file mode 100644 index 1752e345f5b55..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - internal static partial class SecurityAlertPolicyEmailAccountAdminsExtensions - { - public static string ToSerialString(this SecurityAlertPolicyEmailAccountAdmins value) => value switch - { - SecurityAlertPolicyEmailAccountAdmins.Enabled => "Enabled", - SecurityAlertPolicyEmailAccountAdmins.Disabled => "Disabled", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SecurityAlertPolicyEmailAccountAdmins value.") - }; - - public static SecurityAlertPolicyEmailAccountAdmins ToSecurityAlertPolicyEmailAccountAdmins(this string value) - { - if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return SecurityAlertPolicyEmailAccountAdmins.Enabled; - if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return SecurityAlertPolicyEmailAccountAdmins.Disabled; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SecurityAlertPolicyEmailAccountAdmins value."); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyName.cs index 3e2d818a2931f..e0fcc792d5cbe 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyName.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyName.cs @@ -22,9 +22,9 @@ public SecurityAlertPolicyName(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string DefaultValue = "default"; + private const string DefaultValue = "Default"; - /// default. + /// Default. public static SecurityAlertPolicyName Default { get; } = new SecurityAlertPolicyName(DefaultValue); /// Determines if two values are the same. public static bool operator ==(SecurityAlertPolicyName left, SecurityAlertPolicyName right) => left.Equals(right); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyNameAutoGenerated.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyNameAutoGenerated.cs deleted file mode 100644 index 75cd36e715cdd..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyNameAutoGenerated.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The SecurityAlertPolicyNameAutoGenerated. - public readonly partial struct SecurityAlertPolicyNameAutoGenerated : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public SecurityAlertPolicyNameAutoGenerated(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DefaultValue = "Default"; - - /// Default. - public static SecurityAlertPolicyNameAutoGenerated Default { get; } = new SecurityAlertPolicyNameAutoGenerated(DefaultValue); - /// Determines if two values are the same. - public static bool operator ==(SecurityAlertPolicyNameAutoGenerated left, SecurityAlertPolicyNameAutoGenerated right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(SecurityAlertPolicyNameAutoGenerated left, SecurityAlertPolicyNameAutoGenerated right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator SecurityAlertPolicyNameAutoGenerated(string value) => new SecurityAlertPolicyNameAutoGenerated(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is SecurityAlertPolicyNameAutoGenerated other && Equals(other); - /// - public bool Equals(SecurityAlertPolicyNameAutoGenerated other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyState.cs index 2347eee745e92..2ce49f1a23b77 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyState.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyState.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. + /// 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 { /// New. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.Serialization.cs deleted file mode 100644 index c33354fff4389..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - internal static partial class SecurityAlertPolicyUseServerDefaultExtensions - { - public static string ToSerialString(this SecurityAlertPolicyUseServerDefault value) => value switch - { - SecurityAlertPolicyUseServerDefault.Enabled => "Enabled", - SecurityAlertPolicyUseServerDefault.Disabled => "Disabled", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SecurityAlertPolicyUseServerDefault value.") - }; - - public static SecurityAlertPolicyUseServerDefault ToSecurityAlertPolicyUseServerDefault(this string value) - { - if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return SecurityAlertPolicyUseServerDefault.Enabled; - if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return SecurityAlertPolicyUseServerDefault.Disabled; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SecurityAlertPolicyUseServerDefault value."); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertsPolicyState.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertsPolicyState.Serialization.cs new file mode 100644 index 0000000000000..84199dfa6866f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertsPolicyState.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class SecurityAlertsPolicyStateExtensions + { + public static string ToSerialString(this SecurityAlertsPolicyState value) => value switch + { + SecurityAlertsPolicyState.Enabled => "Enabled", + SecurityAlertsPolicyState.Disabled => "Disabled", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SecurityAlertsPolicyState value.") + }; + + public static SecurityAlertsPolicyState ToSecurityAlertsPolicyState(this string value) + { + if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return SecurityAlertsPolicyState.Enabled; + if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return SecurityAlertsPolicyState.Disabled; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SecurityAlertsPolicyState value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs similarity index 60% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs index 73377d6afe7fb..616e4cd9cf539 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs @@ -7,8 +7,8 @@ namespace Azure.ResourceManager.Sql.Models { - /// Specifies that the alert is sent to the account administrators. - public enum SecurityAlertPolicyEmailAccountAdmins + /// 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 { /// Enabled. Enabled, diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEvent.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEvent.Serialization.cs new file mode 100644 index 0000000000000..3a3caf1aca9b5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEvent.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class SecurityEvent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SecurityEvent DeserializeSecurityEvent(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional eventTime = default; + Optional securityEventType = default; + Optional subscription = default; + Optional server = default; + Optional database = default; + Optional clientIp = default; + Optional applicationName = default; + Optional principalName = default; + Optional securityEventSqlInjectionAdditionalProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("eventTime")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + eventTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("securityEventType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + securityEventType = property0.Value.GetString().ToSecurityEventType(); + continue; + } + if (property0.NameEquals("subscription")) + { + subscription = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("server")) + { + server = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("database")) + { + database = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("clientIp")) + { + clientIp = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("applicationName")) + { + applicationName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("principalName")) + { + principalName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("securityEventSqlInjectionAdditionalProperties")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + securityEventSqlInjectionAdditionalProperties = SecurityEventSqlInjectionAdditionalProperties.DeserializeSecurityEventSqlInjectionAdditionalProperties(property0.Value); + continue; + } + } + continue; + } + } + return new SecurityEvent(id.Value, name.Value, type.Value, Optional.ToNullable(eventTime), Optional.ToNullable(securityEventType), subscription.Value, server.Value, database.Value, clientIp.Value, applicationName.Value, principalName.Value, securityEventSqlInjectionAdditionalProperties.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEvent.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEvent.cs new file mode 100644 index 0000000000000..8aea6ef2873c2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEvent.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A security event. + public partial class SecurityEvent : ProxyResource + { + /// Initializes a new instance of SecurityEvent. + public SecurityEvent() + { + } + + /// Initializes a new instance of SecurityEvent. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The time when the security event occurred. + /// The type of the security event. + /// The subscription name. + /// The server name. + /// The database name. + /// The IP address of the client who executed the statement. + /// The application used to execute the statement. + /// The principal user who executed the statement. + /// The sql injection additional properties, populated only if the type of the security event is sql injection. + internal SecurityEvent(string id, string name, string type, DateTimeOffset? eventTime, SecurityEventType? securityEventType, string subscription, string server, string database, string clientIp, string applicationName, string principalName, SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties) : base(id, name, type) + { + EventTime = eventTime; + SecurityEventType = securityEventType; + Subscription = subscription; + Server = server; + Database = database; + ClientIp = clientIp; + ApplicationName = applicationName; + PrincipalName = principalName; + SecurityEventSqlInjectionAdditionalProperties = securityEventSqlInjectionAdditionalProperties; + } + + /// The time when the security event occurred. + public DateTimeOffset? EventTime { get; } + /// The type of the security event. + public SecurityEventType? SecurityEventType { get; } + /// The subscription name. + public string Subscription { get; } + /// The server name. + public string Server { get; } + /// The database name. + public string Database { get; } + /// The IP address of the client who executed the statement. + public string ClientIp { get; } + /// The application used to execute the statement. + public string ApplicationName { get; } + /// The principal user who executed the statement. + public string PrincipalName { get; } + /// The sql injection additional properties, populated only if the type of the security event is sql injection. + public SecurityEventSqlInjectionAdditionalProperties SecurityEventSqlInjectionAdditionalProperties { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventCollection.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventCollection.Serialization.cs new file mode 100644 index 0000000000000..d8fd6998ab61d --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventCollection.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class SecurityEventCollection + { + internal static SecurityEventCollection DeserializeSecurityEventCollection(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SecurityEvent.DeserializeSecurityEvent(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SecurityEventCollection(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventCollection.cs new file mode 100644 index 0000000000000..cbca164796c24 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventCollection.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of security events. + internal partial class SecurityEventCollection + { + /// Initializes a new instance of SecurityEventCollection. + internal SecurityEventCollection() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SecurityEventCollection. + /// Array of results. + /// Link to retrieve next page of results. + internal SecurityEventCollection(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.Serialization.cs new file mode 100644 index 0000000000000..cb7b25974b859 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.Serialization.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class SecurityEventSqlInjectionAdditionalProperties + { + internal static SecurityEventSqlInjectionAdditionalProperties DeserializeSecurityEventSqlInjectionAdditionalProperties(JsonElement element) + { + Optional threatId = default; + Optional statement = default; + Optional statementHighlightOffset = default; + Optional statementHighlightLength = default; + Optional errorCode = default; + Optional errorSeverity = default; + Optional errorMessage = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("threatId")) + { + threatId = property.Value.GetString(); + continue; + } + if (property.NameEquals("statement")) + { + statement = property.Value.GetString(); + continue; + } + if (property.NameEquals("statementHighlightOffset")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + statementHighlightOffset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("statementHighlightLength")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + statementHighlightLength = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("errorCode")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + errorCode = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("errorSeverity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + errorSeverity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("errorMessage")) + { + errorMessage = property.Value.GetString(); + continue; + } + } + return new SecurityEventSqlInjectionAdditionalProperties(threatId.Value, statement.Value, Optional.ToNullable(statementHighlightOffset), Optional.ToNullable(statementHighlightLength), Optional.ToNullable(errorCode), Optional.ToNullable(errorSeverity), errorMessage.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs new file mode 100644 index 0000000000000..c719936bd9c2c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The properties of a security event sql injection additional properties. + public partial class SecurityEventSqlInjectionAdditionalProperties + { + /// Initializes a new instance of SecurityEventSqlInjectionAdditionalProperties. + internal SecurityEventSqlInjectionAdditionalProperties() + { + } + + /// Initializes a new instance of SecurityEventSqlInjectionAdditionalProperties. + /// The threat ID. + /// The statement. + /// The statement highlight offset. + /// The statement highlight length. + /// The sql error code. + /// The sql error severity. + /// The sql error message. + internal SecurityEventSqlInjectionAdditionalProperties(string threatId, string statement, int? statementHighlightOffset, int? statementHighlightLength, int? errorCode, int? errorSeverity, string errorMessage) + { + ThreatId = threatId; + Statement = statement; + StatementHighlightOffset = statementHighlightOffset; + StatementHighlightLength = statementHighlightLength; + ErrorCode = errorCode; + ErrorSeverity = errorSeverity; + ErrorMessage = errorMessage; + } + + /// The threat ID. + public string ThreatId { get; } + /// The statement. + public string Statement { get; } + /// The statement highlight offset. + public int? StatementHighlightOffset { get; } + /// The statement highlight length. + public int? StatementHighlightLength { get; } + /// The sql error code. + public int? ErrorCode { get; } + /// The sql error severity. + public int? ErrorSeverity { get; } + /// The sql error message. + public string ErrorMessage { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventType.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventType.Serialization.cs new file mode 100644 index 0000000000000..4fd228d98fa37 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventType.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class SecurityEventTypeExtensions + { + public static string ToSerialString(this SecurityEventType value) => value switch + { + SecurityEventType.Undefined => "Undefined", + SecurityEventType.SqlInjectionVulnerability => "SqlInjectionVulnerability", + SecurityEventType.SqlInjectionExploit => "SqlInjectionExploit", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SecurityEventType value.") + }; + + public static SecurityEventType ToSecurityEventType(this string value) + { + if (string.Equals(value, "Undefined", StringComparison.InvariantCultureIgnoreCase)) return SecurityEventType.Undefined; + if (string.Equals(value, "SqlInjectionVulnerability", StringComparison.InvariantCultureIgnoreCase)) return SecurityEventType.SqlInjectionVulnerability; + if (string.Equals(value, "SqlInjectionExploit", StringComparison.InvariantCultureIgnoreCase)) return SecurityEventType.SqlInjectionExploit; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SecurityEventType value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventType.cs new file mode 100644 index 0000000000000..7cb3f848bb2a0 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventType.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The type of the security event. + public enum SecurityEventType + { + /// Undefined. + Undefined, + /// SqlInjectionVulnerability. + SqlInjectionVulnerability, + /// SqlInjectionExploit. + SqlInjectionExploit + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs new file mode 100644 index 0000000000000..ae87757dbd463 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The properties that are supported in the $filter operation. + internal partial class SecurityEventsFilterParameters + { + /// Initializes a new instance of SecurityEventsFilterParameters. + internal SecurityEventsFilterParameters() + { + } + + /// Filter on the event time. + public DateTimeOffset? EventTime { get; } + /// Whether to show server records or not. + public bool? ShowServerRecords { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabel.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabel.Serialization.cs index 80b6a13888915..80197ac59a2e6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabel.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabel.Serialization.cs @@ -48,9 +48,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static SensitivityLabel DeserializeSensitivityLabel(JsonElement element) { + Optional managedBy = default; Optional id = default; Optional name = default; Optional type = default; + Optional schemaName = default; + Optional tableName = default; + Optional columnName = default; Optional labelName = default; Optional labelId = default; Optional informationType = default; @@ -59,6 +63,11 @@ internal static SensitivityLabel DeserializeSensitivityLabel(JsonElement element Optional rank = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("managedBy")) + { + managedBy = property.Value.GetString(); + continue; + } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -83,6 +92,21 @@ internal static SensitivityLabel DeserializeSensitivityLabel(JsonElement element } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("schemaName")) + { + schemaName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("tableName")) + { + tableName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("columnName")) + { + columnName = property0.Value.GetString(); + continue; + } if (property0.NameEquals("labelName")) { labelName = property0.Value.GetString(); @@ -127,7 +151,7 @@ internal static SensitivityLabel DeserializeSensitivityLabel(JsonElement element continue; } } - return new SensitivityLabel(id.Value, name.Value, type.Value, labelName.Value, labelId.Value, informationType.Value, informationTypeId.Value, Optional.ToNullable(isDisabled), Optional.ToNullable(rank)); + return new SensitivityLabel(id.Value, name.Value, type.Value, managedBy.Value, schemaName.Value, tableName.Value, columnName.Value, labelName.Value, labelId.Value, informationType.Value, informationTypeId.Value, Optional.ToNullable(isDisabled), Optional.ToNullable(rank)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabel.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabel.cs index ffe73c9e3e60e..c2edde2b9c01e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabel.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabel.cs @@ -19,14 +19,22 @@ public SensitivityLabel() /// Resource ID. /// Resource name. /// Resource type. + /// Resource that manages the sensitivity label. + /// The schema name. + /// The table name. + /// The column name. /// The label name. /// The label ID. /// The information type. /// The information type ID. /// Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. /// . - internal SensitivityLabel(string id, string name, string type, string labelName, string labelId, string informationType, string informationTypeId, bool? isDisabled, SensitivityLabelRank? rank) : base(id, name, type) + internal SensitivityLabel(string id, string name, string type, string managedBy, string schemaName, string tableName, string columnName, string labelName, string labelId, string informationType, string informationTypeId, bool? isDisabled, SensitivityLabelRank? rank) : base(id, name, type) { + ManagedBy = managedBy; + SchemaName = schemaName; + TableName = tableName; + ColumnName = columnName; LabelName = labelName; LabelId = labelId; InformationType = informationType; @@ -35,6 +43,14 @@ internal SensitivityLabel(string id, string name, string type, string labelName, Rank = rank; } + /// Resource that manages the sensitivity label. + public string ManagedBy { get; } + /// The schema name. + public string SchemaName { get; } + /// The table name. + public string TableName { get; } + /// The column name. + public string ColumnName { get; } /// The label name. public string LabelName { get; set; } /// The label ID. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdate.Serialization.cs new file mode 100644 index 0000000000000..314e61bef97ac --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdate.Serialization.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class SensitivityLabelUpdate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Op)) + { + writer.WritePropertyName("op"); + writer.WriteStringValue(Op.Value.ToSerialString()); + } + if (Optional.IsDefined(Schema)) + { + writer.WritePropertyName("schema"); + writer.WriteStringValue(Schema); + } + if (Optional.IsDefined(Table)) + { + writer.WritePropertyName("table"); + writer.WriteStringValue(Table); + } + if (Optional.IsDefined(Column)) + { + writer.WritePropertyName("column"); + writer.WriteStringValue(Column); + } + if (Optional.IsDefined(SensitivityLabel)) + { + writer.WritePropertyName("sensitivityLabel"); + writer.WriteObjectValue(SensitivityLabel); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SensitivityLabelUpdate DeserializeSensitivityLabelUpdate(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional op = default; + Optional schema = default; + Optional table = default; + Optional column = default; + Optional sensitivityLabel = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("op")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + op = property0.Value.GetString().ToSensitivityLabelUpdateKind(); + continue; + } + if (property0.NameEquals("schema")) + { + schema = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("table")) + { + table = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("column")) + { + column = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("sensitivityLabel")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + sensitivityLabel = SensitivityLabel.DeserializeSensitivityLabel(property0.Value); + continue; + } + } + continue; + } + } + return new SensitivityLabelUpdate(id.Value, name.Value, type.Value, Optional.ToNullable(op), schema.Value, table.Value, column.Value, sensitivityLabel.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdate.cs new file mode 100644 index 0000000000000..a32a7d8994913 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdate.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A sensitivity label update operation. + public partial class SensitivityLabelUpdate : ProxyResource + { + /// Initializes a new instance of SensitivityLabelUpdate. + public SensitivityLabelUpdate() + { + } + + /// Initializes a new instance of SensitivityLabelUpdate. + /// Resource ID. + /// Resource name. + /// Resource type. + /// . + /// Schema name of the column to update. + /// Table name of the column to update. + /// Column name to update. + /// The sensitivity label information to apply on a column. + internal SensitivityLabelUpdate(string id, string name, string type, SensitivityLabelUpdateKind? op, string schema, string table, string column, SensitivityLabel sensitivityLabel) : base(id, name, type) + { + Op = op; + Schema = schema; + Table = table; + Column = column; + SensitivityLabel = sensitivityLabel; + } + + public SensitivityLabelUpdateKind? Op { get; set; } + /// Schema name of the column to update. + public string Schema { get; set; } + /// Table name of the column to update. + public string Table { get; set; } + /// Column name to update. + public string Column { get; set; } + /// The sensitivity label information to apply on a column. + public SensitivityLabel SensitivityLabel { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateKind.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateKind.Serialization.cs new file mode 100644 index 0000000000000..fc5fde49294cc --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateKind.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + internal static partial class SensitivityLabelUpdateKindExtensions + { + public static string ToSerialString(this SensitivityLabelUpdateKind value) => value switch + { + SensitivityLabelUpdateKind.Set => "set", + SensitivityLabelUpdateKind.Remove => "remove", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SensitivityLabelUpdateKind value.") + }; + + public static SensitivityLabelUpdateKind ToSensitivityLabelUpdateKind(this string value) + { + if (string.Equals(value, "set", StringComparison.InvariantCultureIgnoreCase)) return SensitivityLabelUpdateKind.Set; + if (string.Equals(value, "remove", StringComparison.InvariantCultureIgnoreCase)) return SensitivityLabelUpdateKind.Remove; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SensitivityLabelUpdateKind value."); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs new file mode 100644 index 0000000000000..e796a6799d846 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The SensitivityLabelUpdateKind. + public enum SensitivityLabelUpdateKind + { + /// set. + Set, + /// remove. + Remove + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateList.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateList.Serialization.cs new file mode 100644 index 0000000000000..a7453af8187a5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateList.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class SensitivityLabelUpdateList : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Operations)) + { + writer.WritePropertyName("operations"); + writer.WriteStartArray(); + foreach (var item in Operations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs new file mode 100644 index 0000000000000..fae73e400b5db --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of sensitivity label update operations. + public partial class SensitivityLabelUpdateList + { + /// Initializes a new instance of SensitivityLabelUpdateList. + public SensitivityLabelUpdateList() + { + Operations = new ChangeTrackingList(); + } + + public IList Operations { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Server.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Server.Serialization.cs index eba6793388d7a..4a3bfbb8322b4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Server.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Server.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -61,6 +62,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNetworkAccess"); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (Optional.IsDefined(PrimaryUserAssignedIdentityId)) + { + writer.WritePropertyName("primaryUserAssignedIdentityId"); + writer.WriteStringValue(PrimaryUserAssignedIdentityId); + } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"); + writer.WriteStringValue(FederatedClientId.Value); + } + if (Optional.IsDefined(KeyId)) + { + writer.WritePropertyName("keyId"); + writer.WriteStringValue(KeyId); + } + if (Optional.IsDefined(Administrators)) + { + writer.WritePropertyName("administrators"); + writer.WriteObjectValue(Administrators); + } + if (Optional.IsDefined(RestrictOutboundNetworkAccess)) + { + writer.WritePropertyName("restrictOutboundNetworkAccess"); + writer.WriteStringValue(RestrictOutboundNetworkAccess.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -81,7 +107,13 @@ internal static Server DeserializeServer(JsonElement element) Optional fullyQualifiedDomainName = default; Optional> privateEndpointConnections = default; Optional minimalTlsVersion = default; - Optional publicNetworkAccess = default; + Optional publicNetworkAccess = default; + Optional workspaceFeature = default; + Optional primaryUserAssignedIdentityId = default; + Optional federatedClientId = default; + Optional keyId = default; + Optional administrators = default; + Optional restrictOutboundNetworkAccess = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("identity")) @@ -195,14 +227,64 @@ internal static Server DeserializeServer(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - publicNetworkAccess = new ServerPublicNetworkAccess(property0.Value.GetString()); + publicNetworkAccess = new ServerNetworkAccessFlag(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("workspaceFeature")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + workspaceFeature = new ServerWorkspaceFeature(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("primaryUserAssignedIdentityId")) + { + primaryUserAssignedIdentityId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("federatedClientId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + federatedClientId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("keyId")) + { + keyId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("administrators")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + administrators = ServerExternalAdministrator.DeserializeServerExternalAdministrator(property0.Value); + continue; + } + if (property0.NameEquals("restrictOutboundNetworkAccess")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + restrictOutboundNetworkAccess = new ServerNetworkAccessFlag(property0.Value.GetString()); continue; } } continue; } } - return new Server(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), identity.Value, kind.Value, administratorLogin.Value, administratorLoginPassword.Value, version.Value, state.Value, fullyQualifiedDomainName.Value, Optional.ToList(privateEndpointConnections), minimalTlsVersion.Value, Optional.ToNullable(publicNetworkAccess)); + return new Server(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), identity.Value, kind.Value, administratorLogin.Value, administratorLoginPassword.Value, version.Value, state.Value, fullyQualifiedDomainName.Value, Optional.ToList(privateEndpointConnections), minimalTlsVersion.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(workspaceFeature), primaryUserAssignedIdentityId.Value, Optional.ToNullable(federatedClientId), keyId.Value, administrators.Value, Optional.ToNullable(restrictOutboundNetworkAccess)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Server.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Server.cs index c54736a2ebeb2..155d5047ea3c6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Server.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/Server.cs @@ -43,7 +43,13 @@ public Server(string location) : base(location) /// List of private endpoint connections on a server. /// Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. /// Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. - internal Server(string id, string name, string type, string location, IDictionary tags, ResourceIdentity identity, string kind, string administratorLogin, string administratorLoginPassword, string version, string state, string fullyQualifiedDomainName, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, ServerPublicNetworkAccess? publicNetworkAccess) : base(id, name, type, location, tags) + /// Whether or not existing server has a workspace created and if it allows connection from workspace. + /// The resource id of a user assigned identity to be used by default. + /// The Client id used for cross tenant CMK scenario. + /// A CMK URI of the key to use for encryption. + /// The Azure Active Directory identity of the server. + /// Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + internal Server(string id, string name, string type, string location, IDictionary tags, ResourceIdentity identity, string kind, string administratorLogin, string administratorLoginPassword, string version, string state, string fullyQualifiedDomainName, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, ServerNetworkAccessFlag? publicNetworkAccess, ServerWorkspaceFeature? workspaceFeature, string primaryUserAssignedIdentityId, Guid? federatedClientId, string keyId, ServerExternalAdministrator administrators, ServerNetworkAccessFlag? restrictOutboundNetworkAccess) : base(id, name, type, location, tags) { Identity = identity; Kind = kind; @@ -55,6 +61,12 @@ internal Server(string id, string name, string type, string location, IDictionar PrivateEndpointConnections = privateEndpointConnections; MinimalTlsVersion = minimalTlsVersion; PublicNetworkAccess = publicNetworkAccess; + WorkspaceFeature = workspaceFeature; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + FederatedClientId = federatedClientId; + KeyId = keyId; + Administrators = administrators; + RestrictOutboundNetworkAccess = restrictOutboundNetworkAccess; } /// The Azure Active Directory identity of the server. @@ -76,6 +88,18 @@ internal Server(string id, string name, string type, string location, IDictionar /// Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. public string MinimalTlsVersion { get; set; } /// Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. - public ServerPublicNetworkAccess? PublicNetworkAccess { get; set; } + public ServerNetworkAccessFlag? PublicNetworkAccess { get; set; } + /// Whether or not existing server has a workspace created and if it allows connection from workspace. + public ServerWorkspaceFeature? WorkspaceFeature { get; } + /// The resource id of a user assigned identity to be used by default. + public string PrimaryUserAssignedIdentityId { get; set; } + /// The Client id used for cross tenant CMK scenario. + public Guid? FederatedClientId { get; set; } + /// A CMK URI of the key to use for encryption. + public string KeyId { get; set; } + /// The Azure Active Directory identity of the server. + public ServerExternalAdministrator Administrators { get; set; } + /// Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + public ServerNetworkAccessFlag? RestrictOutboundNetworkAccess { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicy.Serialization.cs index a2b8b76e41ab3..e61177f5f300c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicy.Serialization.cs @@ -19,20 +19,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("properties"); writer.WriteStartObject(); - if (Optional.IsDefined(State)) - { - writer.WritePropertyName("state"); - writer.WriteStringValue(State.Value.ToSerialString()); - } - if (Optional.IsDefined(StorageEndpoint)) + if (Optional.IsDefined(IsDevopsAuditEnabled)) { - writer.WritePropertyName("storageEndpoint"); - writer.WriteStringValue(StorageEndpoint); - } - if (Optional.IsDefined(StorageAccountAccessKey)) - { - writer.WritePropertyName("storageAccountAccessKey"); - writer.WriteStringValue(StorageAccountAccessKey); + writer.WritePropertyName("isDevopsAuditEnabled"); + writer.WriteBooleanValue(IsDevopsAuditEnabled.Value); } if (Optional.IsDefined(RetentionDays)) { @@ -49,11 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (Optional.IsDefined(StorageAccountSubscriptionId)) - { - writer.WritePropertyName("storageAccountSubscriptionId"); - writer.WriteStringValue(StorageAccountSubscriptionId.Value); - } if (Optional.IsDefined(IsStorageSecondaryKeyInUse)) { writer.WritePropertyName("isStorageSecondaryKeyInUse"); @@ -69,6 +54,26 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queueDelayMs"); writer.WriteNumberValue(QueueDelayMs.Value); } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToSerialString()); + } + if (Optional.IsDefined(StorageEndpoint)) + { + writer.WritePropertyName("storageEndpoint"); + writer.WriteStringValue(StorageEndpoint); + } + if (Optional.IsDefined(StorageAccountAccessKey)) + { + writer.WritePropertyName("storageAccountAccessKey"); + writer.WriteStringValue(StorageAccountAccessKey); + } + if (Optional.IsDefined(StorageAccountSubscriptionId)) + { + writer.WritePropertyName("storageAccountSubscriptionId"); + writer.WriteStringValue(StorageAccountSubscriptionId.Value); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -78,15 +83,16 @@ internal static ServerBlobAuditingPolicy DeserializeServerBlobAuditingPolicy(Jso Optional id = default; Optional name = default; Optional type = default; - Optional state = default; - Optional storageEndpoint = default; - Optional storageAccountAccessKey = default; + Optional isDevopsAuditEnabled = default; Optional retentionDays = default; Optional> auditActionsAndGroups = default; - Optional storageAccountSubscriptionId = default; Optional isStorageSecondaryKeyInUse = default; Optional isAzureMonitorTargetEnabled = default; Optional queueDelayMs = default; + Optional state = default; + Optional storageEndpoint = default; + Optional storageAccountAccessKey = default; + Optional storageAccountSubscriptionId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -113,24 +119,14 @@ internal static ServerBlobAuditingPolicy DeserializeServerBlobAuditingPolicy(Jso } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("state")) + if (property0.NameEquals("isDevopsAuditEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - state = property0.Value.GetString().ToBlobAuditingPolicyState(); - continue; - } - if (property0.NameEquals("storageEndpoint")) - { - storageEndpoint = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("storageAccountAccessKey")) - { - storageAccountAccessKey = property0.Value.GetString(); + isDevopsAuditEnabled = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("retentionDays")) @@ -158,51 +154,71 @@ internal static ServerBlobAuditingPolicy DeserializeServerBlobAuditingPolicy(Jso auditActionsAndGroups = array; continue; } - if (property0.NameEquals("storageAccountSubscriptionId")) + if (property0.NameEquals("isStorageSecondaryKeyInUse")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - storageAccountSubscriptionId = property0.Value.GetGuid(); + isStorageSecondaryKeyInUse = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("isStorageSecondaryKeyInUse")) + if (property0.NameEquals("isAzureMonitorTargetEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - isStorageSecondaryKeyInUse = property0.Value.GetBoolean(); + isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("isAzureMonitorTargetEnabled")) + if (property0.NameEquals("queueDelayMs")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); + queueDelayMs = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("queueDelayMs")) + if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - queueDelayMs = property0.Value.GetInt32(); + state = property0.Value.GetString().ToBlobAuditingPolicyState(); + continue; + } + if (property0.NameEquals("storageEndpoint")) + { + storageEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountAccessKey")) + { + storageAccountAccessKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountSubscriptionId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + storageAccountSubscriptionId = property0.Value.GetGuid(); continue; } } continue; } } - return new ServerBlobAuditingPolicy(id.Value, name.Value, type.Value, Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(storageAccountSubscriptionId), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs)); + return new ServerBlobAuditingPolicy(id.Value, name.Value, type.Value, Optional.ToNullable(isDevopsAuditEnabled), Optional.ToNullable(retentionDays), Optional.ToList(auditActionsAndGroups), Optional.ToNullable(isStorageSecondaryKeyInUse), Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(queueDelayMs), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs index 02af09ef745a6..11052602837be 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs @@ -24,20 +24,28 @@ public ServerBlobAuditingPolicy() /// Resource ID. /// Resource name. /// Resource type. - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - /// Specifies the identifier key of the auditing storage account. + /// + /// Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. /// - /// If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true /// - /// 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. + /// When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs category on the master database should also be created. /// - /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + /// + /// + /// 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) + /// + /// . /// /// Specifies the number of days to keep in the audit logs in the storage account. /// @@ -155,12 +163,11 @@ public ServerBlobAuditingPolicy() /// /// 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). /// - /// Specifies the blob storage subscription Id. /// Specifies whether storageAccountAccessKey value is the storage's secondary key. /// /// 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. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// /// @@ -187,37 +194,60 @@ public ServerBlobAuditingPolicy() /// /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// - internal ServerBlobAuditingPolicy(string id, string name, string type, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, IList auditActionsAndGroups, Guid? storageAccountSubscriptionId, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs) : base(id, name, type) + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + /// 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). + /// + /// Specifies the blob storage subscription Id. + internal ServerBlobAuditingPolicy(string id, string name, string type, bool? isDevopsAuditEnabled, int? retentionDays, IList auditActionsAndGroups, bool? isStorageSecondaryKeyInUse, bool? isAzureMonitorTargetEnabled, int? queueDelayMs, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, type) { - State = state; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; + IsDevopsAuditEnabled = isDevopsAuditEnabled; RetentionDays = retentionDays; AuditActionsAndGroups = auditActionsAndGroups; - StorageAccountSubscriptionId = storageAccountSubscriptionId; IsStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; QueueDelayMs = queueDelayMs; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; } - /// Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - public BlobAuditingPolicyState? State { get; set; } - /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - public string StorageEndpoint { get; set; } /// - /// Specifies the identifier key of the auditing storage account. + /// Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. /// - /// If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true /// - /// 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. + /// When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs category on the master database should also be created. /// - /// For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + /// + /// + /// 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) + /// + /// . /// - public string StorageAccountAccessKey { get; set; } + public bool? IsDevopsAuditEnabled { get; set; } /// Specifies the number of days to keep in the audit logs in the storage account. public int? RetentionDays { get; set; } /// @@ -336,14 +366,12 @@ internal ServerBlobAuditingPolicy(string id, string name, string type, BlobAudit /// 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). /// public IList AuditActionsAndGroups { get; } - /// Specifies the blob storage subscription Id. - public Guid? StorageAccountSubscriptionId { get; set; } /// Specifies whether storageAccountAccessKey value is the storage's secondary key. public bool? IsStorageSecondaryKeyInUse { get; set; } /// /// Specifies whether audit events are sent to Azure Monitor. /// - /// In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. + /// In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. /// /// /// @@ -372,5 +400,25 @@ internal ServerBlobAuditingPolicy(string id, string name, string type, BlobAudit /// The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. /// public int? QueueDelayMs { get; set; } + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + public BlobAuditingPolicyState? State { get; set; } + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + public string StorageEndpoint { get; set; } + /// + /// 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). + /// + public string StorageAccountAccessKey { get; set; } + /// Specifies the blob storage subscription Id. + public Guid? StorageAccountSubscriptionId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicy.Serialization.cs index cf222e67591bb..8c210c2dea600 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicy.Serialization.cs @@ -20,7 +20,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ConnectionType)) { writer.WritePropertyName("connectionType"); - writer.WriteStringValue(ConnectionType.Value.ToSerialString()); + writer.WriteStringValue(ConnectionType.Value.ToString()); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -28,22 +28,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ServerConnectionPolicy DeserializeServerConnectionPolicy(JsonElement element) { - Optional kind = default; Optional location = default; + Optional kind = default; Optional id = default; Optional name = default; Optional type = default; Optional connectionType = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kind")) + if (property.NameEquals("location")) { - kind = property.Value.GetString(); + location = property.Value.GetString(); continue; } - if (property.NameEquals("location")) + if (property.NameEquals("kind")) { - location = property.Value.GetString(); + kind = property.Value.GetString(); continue; } if (property.NameEquals("id")) @@ -77,14 +77,14 @@ internal static ServerConnectionPolicy DeserializeServerConnectionPolicy(JsonEle property0.ThrowNonNullablePropertyIsNull(); continue; } - connectionType = property0.Value.GetString().ToServerConnectionType(); + connectionType = new ServerConnectionType(property0.Value.GetString()); continue; } } continue; } } - return new ServerConnectionPolicy(id.Value, name.Value, type.Value, kind.Value, location.Value, Optional.ToNullable(connectionType)); + return new ServerConnectionPolicy(id.Value, name.Value, type.Value, location.Value, kind.Value, Optional.ToNullable(connectionType)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicy.cs index 9feb3afe12b18..3608b1472b45a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicy.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.Sql.Models { - /// A server secure connection policy. + /// A server connection policy. public partial class ServerConnectionPolicy : ProxyResource { /// Initializes a new instance of ServerConnectionPolicy. @@ -19,20 +19,20 @@ public ServerConnectionPolicy() /// Resource ID. /// Resource name. /// Resource type. - /// Metadata used for the Azure portal experience. /// Resource location. + /// Metadata used for the Azure portal experience. /// The server connection type. - internal ServerConnectionPolicy(string id, string name, string type, string kind, string location, ServerConnectionType? connectionType) : base(id, name, type) + internal ServerConnectionPolicy(string id, string name, string type, string location, string kind, ServerConnectionType? connectionType) : base(id, name, type) { - Kind = kind; Location = location; + Kind = kind; ConnectionType = connectionType; } - /// Metadata used for the Azure portal experience. - public string Kind { get; } /// Resource location. public string Location { get; } + /// Metadata used for the Azure portal experience. + public string Kind { get; } /// The server connection type. public ServerConnectionType? ConnectionType { get; set; } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicyListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicyListResult.Serialization.cs new file mode 100644 index 0000000000000..ea03de4050414 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicyListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ServerConnectionPolicyListResult + { + internal static ServerConnectionPolicyListResult DeserializeServerConnectionPolicyListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ServerConnectionPolicy.DeserializeServerConnectionPolicy(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ServerConnectionPolicyListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicyListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicyListResult.cs new file mode 100644 index 0000000000000..d9181954f4524 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionPolicyListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of server connection policy objects. + internal partial class ServerConnectionPolicyListResult + { + /// Initializes a new instance of ServerConnectionPolicyListResult. + internal ServerConnectionPolicyListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServerConnectionPolicyListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ServerConnectionPolicyListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionType.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionType.Serialization.cs deleted file mode 100644 index b493963940dd0..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionType.Serialization.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - internal static partial class ServerConnectionTypeExtensions - { - public static string ToSerialString(this ServerConnectionType value) => value switch - { - ServerConnectionType.Default => "Default", - ServerConnectionType.Proxy => "Proxy", - ServerConnectionType.Redirect => "Redirect", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ServerConnectionType value.") - }; - - public static ServerConnectionType ToServerConnectionType(this string value) - { - if (string.Equals(value, "Default", StringComparison.InvariantCultureIgnoreCase)) return ServerConnectionType.Default; - if (string.Equals(value, "Proxy", StringComparison.InvariantCultureIgnoreCase)) return ServerConnectionType.Proxy; - if (string.Equals(value, "Redirect", StringComparison.InvariantCultureIgnoreCase)) return ServerConnectionType.Redirect; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ServerConnectionType value."); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionType.cs index 83e7804746ac9..d7bbfb4611e81 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionType.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerConnectionType.cs @@ -5,16 +5,50 @@ #nullable disable +using System; +using System.ComponentModel; + namespace Azure.ResourceManager.Sql.Models { /// The server connection type. - public enum ServerConnectionType + public readonly partial struct ServerConnectionType : IEquatable { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServerConnectionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string RedirectValue = "Redirect"; + private const string ProxyValue = "Proxy"; + /// Default. - Default, - /// Proxy. - Proxy, + public static ServerConnectionType Default { get; } = new ServerConnectionType(DefaultValue); /// Redirect. - Redirect + public static ServerConnectionType Redirect { get; } = new ServerConnectionType(RedirectValue); + /// Proxy. + public static ServerConnectionType Proxy { get; } = new ServerConnectionType(ProxyValue); + /// Determines if two values are the same. + public static bool operator ==(ServerConnectionType left, ServerConnectionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServerConnectionType left, ServerConnectionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServerConnectionType(string value) => new ServerConnectionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServerConnectionType other && Equals(other); + /// + public bool Equals(ServerConnectionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditSettingsListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditSettingsListResult.Serialization.cs new file mode 100644 index 0000000000000..15b3de4ebef6a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditSettingsListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ServerDevOpsAuditSettingsListResult + { + internal static ServerDevOpsAuditSettingsListResult DeserializeServerDevOpsAuditSettingsListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ServerDevOpsAuditingSettings.DeserializeServerDevOpsAuditingSettings(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ServerDevOpsAuditSettingsListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditSettingsListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditSettingsListResult.cs new file mode 100644 index 0000000000000..f06c74cb4f34e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditSettingsListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of server DevOps audit settings. + internal partial class ServerDevOpsAuditSettingsListResult + { + /// Initializes a new instance of ServerDevOpsAuditSettingsListResult. + internal ServerDevOpsAuditSettingsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServerDevOpsAuditSettingsListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ServerDevOpsAuditSettingsListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditingSettings.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditingSettings.Serialization.cs new file mode 100644 index 0000000000000..3e9ed163f3d48 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditingSettings.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ServerDevOpsAuditingSettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(IsAzureMonitorTargetEnabled)) + { + writer.WritePropertyName("isAzureMonitorTargetEnabled"); + writer.WriteBooleanValue(IsAzureMonitorTargetEnabled.Value); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToSerialString()); + } + if (Optional.IsDefined(StorageEndpoint)) + { + writer.WritePropertyName("storageEndpoint"); + writer.WriteStringValue(StorageEndpoint); + } + if (Optional.IsDefined(StorageAccountAccessKey)) + { + writer.WritePropertyName("storageAccountAccessKey"); + writer.WriteStringValue(StorageAccountAccessKey); + } + if (Optional.IsDefined(StorageAccountSubscriptionId)) + { + writer.WritePropertyName("storageAccountSubscriptionId"); + writer.WriteStringValue(StorageAccountSubscriptionId.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ServerDevOpsAuditingSettings DeserializeServerDevOpsAuditingSettings(JsonElement element) + { + Optional systemData = default; + Optional id = default; + Optional name = default; + Optional type = default; + Optional isAzureMonitorTargetEnabled = default; + Optional state = default; + Optional storageEndpoint = default; + Optional storageAccountAccessKey = default; + Optional storageAccountSubscriptionId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = SystemData.DeserializeSystemData(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("isAzureMonitorTargetEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isAzureMonitorTargetEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("state")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + state = property0.Value.GetString().ToBlobAuditingPolicyState(); + continue; + } + if (property0.NameEquals("storageEndpoint")) + { + storageEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountAccessKey")) + { + storageAccountAccessKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("storageAccountSubscriptionId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + storageAccountSubscriptionId = property0.Value.GetGuid(); + continue; + } + } + continue; + } + } + return new ServerDevOpsAuditingSettings(id.Value, name.Value, type.Value, systemData.Value, Optional.ToNullable(isAzureMonitorTargetEnabled), Optional.ToNullable(state), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(storageAccountSubscriptionId)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditingSettings.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditingSettings.cs new file mode 100644 index 0000000000000..1adc91979ea25 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDevOpsAuditingSettings.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A server DevOps auditing settings. + public partial class ServerDevOpsAuditingSettings : ProxyResource + { + /// Initializes a new instance of ServerDevOpsAuditingSettings. + public ServerDevOpsAuditingSettings() + { + } + + /// Initializes a new instance of ServerDevOpsAuditingSettings. + /// Resource ID. + /// Resource name. + /// Resource type. + /// SystemData of ServerDevOpsAuditSettingsResource. + /// + /// 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) + /// + /// . + /// + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + /// 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). + /// + /// Specifies the blob storage subscription Id. + internal ServerDevOpsAuditingSettings(string id, string name, string type, SystemData systemData, bool? isAzureMonitorTargetEnabled, BlobAuditingPolicyState? state, string storageEndpoint, string storageAccountAccessKey, Guid? storageAccountSubscriptionId) : base(id, name, type) + { + SystemData = systemData; + IsAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + State = state; + StorageEndpoint = storageEndpoint; + StorageAccountAccessKey = storageAccountAccessKey; + StorageAccountSubscriptionId = storageAccountSubscriptionId; + } + + /// SystemData of ServerDevOpsAuditSettingsResource. + public SystemData SystemData { get; } + /// + /// 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) + /// + /// . + /// + public bool? IsAzureMonitorTargetEnabled { get; set; } + /// Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + public BlobAuditingPolicyState? State { get; set; } + /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. + public string StorageEndpoint { get; set; } + /// + /// 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). + /// + public string StorageAccountAccessKey { get; set; } + /// Specifies the blob storage subscription Id. + public Guid? StorageAccountSubscriptionId { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDnsAliasAcquisition.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDnsAliasAcquisition.Serialization.cs index a5b8da9d13481..b900dd64e17ea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDnsAliasAcquisition.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDnsAliasAcquisition.Serialization.cs @@ -15,11 +15,8 @@ public partial class ServerDnsAliasAcquisition : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(OldServerDnsAliasId)) - { - writer.WritePropertyName("oldServerDnsAliasId"); - writer.WriteStringValue(OldServerDnsAliasId); - } + writer.WritePropertyName("oldServerDnsAliasId"); + writer.WriteStringValue(OldServerDnsAliasId); writer.WriteEndObject(); } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs index cf107d5bf9b3d..66a4074690ef9 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs @@ -5,17 +5,27 @@ #nullable disable +using System; + namespace Azure.ResourceManager.Sql.Models { - /// A server DNS alias acquisition request. + /// A server dns alias acquisition request. public partial class ServerDnsAliasAcquisition { /// Initializes a new instance of ServerDnsAliasAcquisition. - public ServerDnsAliasAcquisition() + /// The id of the server alias that will be acquired to point to this server instead. + /// is null. + public ServerDnsAliasAcquisition(string oldServerDnsAliasId) { + if (oldServerDnsAliasId == null) + { + throw new ArgumentNullException(nameof(oldServerDnsAliasId)); + } + + OldServerDnsAliasId = oldServerDnsAliasId; } /// The id of the server alias that will be acquired to point to this server instead. - public string OldServerDnsAliasId { get; set; } + public string OldServerDnsAliasId { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerExternalAdministrator.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerExternalAdministrator.Serialization.cs new file mode 100644 index 0000000000000..def2214cba929 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerExternalAdministrator.Serialization.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ServerExternalAdministrator : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AdministratorType)) + { + writer.WritePropertyName("administratorType"); + writer.WriteStringValue(AdministratorType.Value.ToString()); + } + if (Optional.IsDefined(PrincipalType)) + { + writer.WritePropertyName("principalType"); + writer.WriteStringValue(PrincipalType.Value.ToString()); + } + if (Optional.IsDefined(Login)) + { + writer.WritePropertyName("login"); + writer.WriteStringValue(Login); + } + if (Optional.IsDefined(Sid)) + { + writer.WritePropertyName("sid"); + writer.WriteStringValue(Sid.Value); + } + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"); + writer.WriteStringValue(TenantId.Value); + } + if (Optional.IsDefined(AzureADOnlyAuthentication)) + { + writer.WritePropertyName("azureADOnlyAuthentication"); + writer.WriteBooleanValue(AzureADOnlyAuthentication.Value); + } + writer.WriteEndObject(); + } + + internal static ServerExternalAdministrator DeserializeServerExternalAdministrator(JsonElement element) + { + Optional administratorType = default; + Optional principalType = default; + Optional login = default; + Optional sid = default; + Optional tenantId = default; + Optional azureADOnlyAuthentication = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("administratorType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + administratorType = new AdministratorType(property.Value.GetString()); + continue; + } + if (property.NameEquals("principalType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + principalType = new PrincipalType(property.Value.GetString()); + continue; + } + if (property.NameEquals("login")) + { + login = property.Value.GetString(); + continue; + } + if (property.NameEquals("sid")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + sid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("tenantId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tenantId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("azureADOnlyAuthentication")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + azureADOnlyAuthentication = property.Value.GetBoolean(); + continue; + } + } + return new ServerExternalAdministrator(Optional.ToNullable(administratorType), Optional.ToNullable(principalType), login.Value, Optional.ToNullable(sid), Optional.ToNullable(tenantId), Optional.ToNullable(azureADOnlyAuthentication)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerExternalAdministrator.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerExternalAdministrator.cs new file mode 100644 index 0000000000000..f0a84954e5fb2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerExternalAdministrator.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Properties of a active directory administrator. + public partial class ServerExternalAdministrator + { + /// Initializes a new instance of ServerExternalAdministrator. + public ServerExternalAdministrator() + { + } + + /// Initializes a new instance of ServerExternalAdministrator. + /// Type of the sever administrator. + /// Principal Type of the sever administrator. + /// Login name of the server administrator. + /// SID (object ID) of the server administrator. + /// Tenant ID of the administrator. + /// Azure Active Directory only Authentication enabled. + internal ServerExternalAdministrator(AdministratorType? administratorType, PrincipalType? principalType, string login, Guid? sid, Guid? tenantId, bool? azureADOnlyAuthentication) + { + AdministratorType = administratorType; + PrincipalType = principalType; + Login = login; + Sid = sid; + TenantId = tenantId; + AzureADOnlyAuthentication = azureADOnlyAuthentication; + } + + /// Type of the sever administrator. + public AdministratorType? AdministratorType { get; set; } + /// Principal Type of the sever administrator. + public PrincipalType? PrincipalType { get; set; } + /// Login name of the server administrator. + public string Login { get; set; } + /// SID (object ID) of the server administrator. + public Guid? Sid { get; set; } + /// Tenant ID of the administrator. + public Guid? TenantId { get; set; } + /// Azure Active Directory only Authentication enabled. + public bool? AzureADOnlyAuthentication { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerInfo.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerInfo.Serialization.cs new file mode 100644 index 0000000000000..7ad954802d425 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerInfo.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ServerInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("serverId"); + writer.WriteStringValue(ServerId); + writer.WriteEndObject(); + } + + internal static ServerInfo DeserializeServerInfo(JsonElement element) + { + string serverId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serverId")) + { + serverId = property.Value.GetString(); + continue; + } + } + return new ServerInfo(serverId); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerInfo.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerInfo.cs new file mode 100644 index 0000000000000..793d483e19241 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerInfo.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Server info for the server trust group. + public partial class ServerInfo + { + /// Initializes a new instance of ServerInfo. + /// Server Id. + /// is null. + public ServerInfo(string serverId) + { + if (serverId == null) + { + throw new ArgumentNullException(nameof(serverId)); + } + + ServerId = serverId; + } + + /// Server Id. + public string ServerId { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerKey.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerKey.Serialization.cs index 71cce92ed1398..a8f7fb24e696d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerKey.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerKey.Serialization.cs @@ -16,11 +16,6 @@ public partial class ServerKey : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(Kind)) - { - writer.WritePropertyName("kind"); - writer.WriteStringValue(Kind); - } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ServerKeyType)) @@ -33,16 +28,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("uri"); writer.WriteStringValue(Uri); } - if (Optional.IsDefined(Thumbprint)) - { - writer.WritePropertyName("thumbprint"); - writer.WriteStringValue(Thumbprint); - } - if (Optional.IsDefined(CreationDate)) - { - writer.WritePropertyName("creationDate"); - writer.WriteStringValue(CreationDate.Value, "O"); - } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -59,6 +44,7 @@ internal static ServerKey DeserializeServerKey(JsonElement element) Optional uri = default; Optional thumbprint = default; Optional creationDate = default; + Optional autoRotationEnabled = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind")) @@ -130,11 +116,21 @@ internal static ServerKey DeserializeServerKey(JsonElement element) creationDate = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("autoRotationEnabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + autoRotationEnabled = property0.Value.GetBoolean(); + continue; + } } continue; } } - return new ServerKey(id.Value, name.Value, type.Value, kind.Value, location.Value, subregion.Value, Optional.ToNullable(serverKeyType), uri.Value, thumbprint.Value, Optional.ToNullable(creationDate)); + return new ServerKey(id.Value, name.Value, type.Value, kind.Value, location.Value, subregion.Value, Optional.ToNullable(serverKeyType), uri.Value, thumbprint.Value, Optional.ToNullable(creationDate), Optional.ToNullable(autoRotationEnabled)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerKey.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerKey.cs index ec4c29819149a..9f7b98a097a28 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerKey.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerKey.cs @@ -25,10 +25,11 @@ public ServerKey() /// Resource location. /// Subregion of the server key. /// The server key type like 'ServiceManaged', 'AzureKeyVault'. - /// The URI of the server key. + /// The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. /// Thumbprint of the server key. /// The server key creation date. - internal ServerKey(string id, string name, string type, string kind, string location, string subregion, ServerKeyType? serverKeyType, string uri, string thumbprint, DateTimeOffset? creationDate) : base(id, name, type) + /// Key auto rotation opt-in flag. Either true or false. + internal ServerKey(string id, string name, string type, string kind, string location, string subregion, ServerKeyType? serverKeyType, string uri, string thumbprint, DateTimeOffset? creationDate, bool? autoRotationEnabled) : base(id, name, type) { Kind = kind; Location = location; @@ -37,21 +38,24 @@ internal ServerKey(string id, string name, string type, string kind, string loca Uri = uri; Thumbprint = thumbprint; CreationDate = creationDate; + AutoRotationEnabled = autoRotationEnabled; } /// Kind of encryption protector. This is metadata used for the Azure portal experience. - public string Kind { get; set; } + public string Kind { get; } /// Resource location. public string Location { get; } /// Subregion of the server key. public string Subregion { get; } /// The server key type like 'ServiceManaged', 'AzureKeyVault'. public ServerKeyType? ServerKeyType { get; set; } - /// The URI of the server key. + /// The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. public string Uri { get; set; } /// Thumbprint of the server key. - public string Thumbprint { get; set; } + public string Thumbprint { get; } /// The server key creation date. - public DateTimeOffset? CreationDate { get; set; } + public DateTimeOffset? CreationDate { get; } + /// Key auto rotation opt-in flag. Either true or false. + public bool? AutoRotationEnabled { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerNetworkAccessFlag.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerNetworkAccessFlag.cs new file mode 100644 index 0000000000000..05ac2cc41e2a7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerNetworkAccessFlag.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + public readonly partial struct ServerNetworkAccessFlag : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServerNetworkAccessFlag(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static ServerNetworkAccessFlag Enabled { get; } = new ServerNetworkAccessFlag(EnabledValue); + /// Disabled. + public static ServerNetworkAccessFlag Disabled { get; } = new ServerNetworkAccessFlag(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(ServerNetworkAccessFlag left, ServerNetworkAccessFlag right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServerNetworkAccessFlag left, ServerNetworkAccessFlag right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServerNetworkAccessFlag(string value) => new ServerNetworkAccessFlag(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServerNetworkAccessFlag other && Equals(other); + /// + public bool Equals(ServerNetworkAccessFlag other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndex.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperation.Serialization.cs similarity index 53% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndex.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperation.Serialization.cs index 0a7a01774bf9d..34490b7b395d2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RecommendedIndex.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperation.Serialization.cs @@ -6,13 +6,12 @@ #nullable disable using System; -using System.Collections.Generic; using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.Sql.Models { - public partial class RecommendedIndex : IUtf8JsonSerializable + public partial class ServerOperation : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -23,23 +22,24 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static RecommendedIndex DeserializeRecommendedIndex(JsonElement element) + internal static ServerOperation DeserializeServerOperation(JsonElement element) { Optional id = default; Optional name = default; Optional type = default; - Optional action = default; - Optional state = default; - Optional created = default; - Optional lastModified = default; - Optional indexType = default; - Optional schema = default; - Optional table = default; - Optional> columns = default; - Optional> includedColumns = default; - Optional indexScript = default; - Optional> estimatedImpact = default; - Optional> reportedImpact = default; + Optional operation = default; + Optional operationFriendlyName = default; + Optional percentComplete = default; + Optional serverName = default; + Optional startTime = default; + Optional state = default; + Optional errorCode = default; + Optional errorDescription = default; + Optional errorSeverity = default; + Optional isUserError = default; + Optional estimatedCompletionTime = default; + Optional description = default; + Optional isCancellable = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) @@ -66,136 +66,116 @@ internal static RecommendedIndex DeserializeRecommendedIndex(JsonElement element } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("action")) + if (property0.NameEquals("operation")) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - action = property0.Value.GetString().ToRecommendedIndexAction(); + operation = property0.Value.GetString(); continue; } - if (property0.NameEquals("state")) + if (property0.NameEquals("operationFriendlyName")) + { + operationFriendlyName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("percentComplete")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - state = property0.Value.GetString().ToRecommendedIndexState(); + percentComplete = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("serverName")) + { + serverName = property0.Value.GetString(); continue; } - if (property0.NameEquals("created")) + if (property0.NameEquals("startTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - created = property0.Value.GetDateTimeOffset("O"); + startTime = property0.Value.GetDateTimeOffset("O"); continue; } - if (property0.NameEquals("lastModified")) + if (property0.NameEquals("state")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - lastModified = property0.Value.GetDateTimeOffset("O"); + state = new ManagementOperationState(property0.Value.GetString()); continue; } - if (property0.NameEquals("indexType")) + if (property0.NameEquals("errorCode")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - indexType = property0.Value.GetString().ToRecommendedIndexType(); - continue; - } - if (property0.NameEquals("schema")) - { - schema = property0.Value.GetString(); + errorCode = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("table")) + if (property0.NameEquals("errorDescription")) { - table = property0.Value.GetString(); + errorDescription = property0.Value.GetString(); continue; } - if (property0.NameEquals("columns")) + if (property0.NameEquals("errorSeverity")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - columns = array; + errorSeverity = property0.Value.GetInt32(); continue; } - if (property0.NameEquals("includedColumns")) + if (property0.NameEquals("isUserError")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - includedColumns = array; - continue; - } - if (property0.NameEquals("indexScript")) - { - indexScript = property0.Value.GetString(); + isUserError = property0.Value.GetBoolean(); continue; } - if (property0.NameEquals("estimatedImpact")) + if (property0.NameEquals("estimatedCompletionTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(OperationImpact.DeserializeOperationImpact(item)); - } - estimatedImpact = array; + estimatedCompletionTime = property0.Value.GetDateTimeOffset("O"); continue; } - if (property0.NameEquals("reportedImpact")) + if (property0.NameEquals("description")) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isCancellable")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(OperationImpact.DeserializeOperationImpact(item)); - } - reportedImpact = array; + isCancellable = property0.Value.GetBoolean(); continue; } } continue; } } - return new RecommendedIndex(id.Value, name.Value, type.Value, Optional.ToNullable(action), Optional.ToNullable(state), Optional.ToNullable(created), Optional.ToNullable(lastModified), Optional.ToNullable(indexType), schema.Value, table.Value, Optional.ToList(columns), Optional.ToList(includedColumns), indexScript.Value, Optional.ToList(estimatedImpact), Optional.ToList(reportedImpact)); + return new ServerOperation(id.Value, name.Value, type.Value, operation.Value, operationFriendlyName.Value, Optional.ToNullable(percentComplete), serverName.Value, Optional.ToNullable(startTime), Optional.ToNullable(state), Optional.ToNullable(errorCode), errorDescription.Value, Optional.ToNullable(errorSeverity), Optional.ToNullable(isUserError), Optional.ToNullable(estimatedCompletionTime), description.Value, Optional.ToNullable(isCancellable)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperation.cs new file mode 100644 index 0000000000000..938fd47458050 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperation.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A server operation. + public partial class ServerOperation : ProxyResource + { + /// Initializes a new instance of ServerOperation. + public ServerOperation() + { + } + + /// Initializes a new instance of ServerOperation. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The name of operation. + /// The friendly name of operation. + /// The percentage of the operation completed. + /// The name of the server. + /// The operation start time. + /// The operation state. + /// The operation error code. + /// The operation error description. + /// The operation error severity. + /// Whether or not the error is a user error. + /// The estimated completion time of the operation. + /// The operation description. + /// Whether the operation can be cancelled. + internal ServerOperation(string id, string name, string type, string operation, string operationFriendlyName, int? percentComplete, string serverName, DateTimeOffset? startTime, ManagementOperationState? state, int? errorCode, string errorDescription, int? errorSeverity, bool? isUserError, DateTimeOffset? estimatedCompletionTime, string description, bool? isCancellable) : base(id, name, type) + { + Operation = operation; + OperationFriendlyName = operationFriendlyName; + PercentComplete = percentComplete; + ServerName = serverName; + StartTime = startTime; + State = state; + ErrorCode = errorCode; + ErrorDescription = errorDescription; + ErrorSeverity = errorSeverity; + IsUserError = isUserError; + EstimatedCompletionTime = estimatedCompletionTime; + Description = description; + IsCancellable = isCancellable; + } + + /// The name of operation. + public string Operation { get; } + /// The friendly name of operation. + public string OperationFriendlyName { get; } + /// The percentage of the operation completed. + public int? PercentComplete { get; } + /// The name of the server. + public string ServerName { get; } + /// The operation start time. + public DateTimeOffset? StartTime { get; } + /// The operation state. + public ManagementOperationState? State { get; } + /// The operation error code. + public int? ErrorCode { get; } + /// The operation error description. + public string ErrorDescription { get; } + /// The operation error severity. + public int? ErrorSeverity { get; } + /// Whether or not the error is a user error. + public bool? IsUserError { get; } + /// The estimated completion time of the operation. + public DateTimeOffset? EstimatedCompletionTime { get; } + /// The operation description. + public string Description { get; } + /// Whether the operation can be cancelled. + public bool? IsCancellable { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.Serialization.cs new file mode 100644 index 0000000000000..6b37a1f399bd6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ServerOperationListResult + { + internal static ServerOperationListResult DeserializeServerOperationListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ServerOperation.DeserializeServerOperation(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ServerOperationListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.cs new file mode 100644 index 0000000000000..83a7b2fc0ba0a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerOperationListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The response to a list server operations request. + internal partial class ServerOperationListResult + { + /// Initializes a new instance of ServerOperationListResult. + internal ServerOperationListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServerOperationListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ServerOperationListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerPublicNetworkAccess.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerPublicNetworkAccess.cs deleted file mode 100644 index 49859811870fa..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerPublicNetworkAccess.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. - public readonly partial struct ServerPublicNetworkAccess : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public ServerPublicNetworkAccess(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// Enabled. - public static ServerPublicNetworkAccess Enabled { get; } = new ServerPublicNetworkAccess(EnabledValue); - /// Disabled. - public static ServerPublicNetworkAccess Disabled { get; } = new ServerPublicNetworkAccess(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(ServerPublicNetworkAccess left, ServerPublicNetworkAccess right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ServerPublicNetworkAccess left, ServerPublicNetworkAccess right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ServerPublicNetworkAccess(string value) => new ServerPublicNetworkAccess(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ServerPublicNetworkAccess other && Equals(other); - /// - public bool Equals(ServerPublicNetworkAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerSecurityAlertPolicy.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerSecurityAlertPolicy.Serialization.cs index 4eda062151b99..bde7a5bd920be 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerSecurityAlertPolicy.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerSecurityAlertPolicy.Serialization.cs @@ -70,10 +70,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ServerSecurityAlertPolicy DeserializeServerSecurityAlertPolicy(JsonElement element) { + Optional systemData = default; Optional id = default; Optional name = default; Optional type = default; - Optional state = default; + Optional state = default; Optional> disabledAlerts = default; Optional> emailAddresses = default; Optional emailAccountAdmins = default; @@ -83,6 +84,16 @@ internal static ServerSecurityAlertPolicy DeserializeServerSecurityAlertPolicy(J Optional creationTime = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = SystemData.DeserializeSystemData(property.Value); + continue; + } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -114,7 +125,7 @@ internal static ServerSecurityAlertPolicy DeserializeServerSecurityAlertPolicy(J property0.ThrowNonNullablePropertyIsNull(); continue; } - state = property0.Value.GetString().ToSecurityAlertPolicyState(); + state = property0.Value.GetString().ToSecurityAlertsPolicyState(); continue; } if (property0.NameEquals("disabledAlerts")) @@ -191,7 +202,7 @@ internal static ServerSecurityAlertPolicy DeserializeServerSecurityAlertPolicy(J continue; } } - return new ServerSecurityAlertPolicy(id.Value, name.Value, type.Value, Optional.ToNullable(state), Optional.ToList(disabledAlerts), Optional.ToList(emailAddresses), Optional.ToNullable(emailAccountAdmins), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToNullable(creationTime)); + return new ServerSecurityAlertPolicy(id.Value, name.Value, type.Value, systemData.Value, Optional.ToNullable(state), Optional.ToList(disabledAlerts), Optional.ToList(emailAddresses), Optional.ToNullable(emailAccountAdmins), storageEndpoint.Value, storageAccountAccessKey.Value, Optional.ToNullable(retentionDays), Optional.ToNullable(creationTime)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs index 1c1c990eb99fa..16d05a10d07df 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs @@ -25,16 +25,18 @@ public ServerSecurityAlertPolicy() /// Resource ID. /// Resource name. /// Resource type. + /// SystemData of SecurityAlertPolicyResource. /// Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. - /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. /// Specifies an array of e-mail addresses to which the alert is sent. /// Specifies that the alert is sent to the account administrators. /// Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. /// Specifies the identifier key of the Threat Detection audit storage account. /// Specifies the number of days to keep in the Threat Detection audit logs. /// Specifies the UTC creation time of the policy. - internal ServerSecurityAlertPolicy(string id, string name, string type, SecurityAlertPolicyState? state, IList disabledAlerts, IList emailAddresses, bool? emailAccountAdmins, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, DateTimeOffset? creationTime) : base(id, name, type) + internal ServerSecurityAlertPolicy(string id, string name, string type, SystemData systemData, SecurityAlertsPolicyState? state, IList disabledAlerts, IList emailAddresses, bool? emailAccountAdmins, string storageEndpoint, string storageAccountAccessKey, int? retentionDays, DateTimeOffset? creationTime) : base(id, name, type) { + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -45,9 +47,11 @@ internal ServerSecurityAlertPolicy(string id, string name, string type, Security CreationTime = creationTime; } + /// SystemData of SecurityAlertPolicyResource. + public SystemData SystemData { get; } /// Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. - public SecurityAlertPolicyState? State { get; set; } - /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + public SecurityAlertsPolicyState? State { get; set; } + /// Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. public IList DisabledAlerts { get; } /// Specifies an array of e-mail addresses to which the alert is sent. public IList EmailAddresses { get; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroup.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroup.Serialization.cs new file mode 100644 index 0000000000000..8bad658279589 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroup.Serialization.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ServerTrustGroup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(GroupMembers)) + { + writer.WritePropertyName("groupMembers"); + writer.WriteStartArray(); + foreach (var item in GroupMembers) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TrustScopes)) + { + writer.WritePropertyName("trustScopes"); + writer.WriteStartArray(); + foreach (var item in TrustScopes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ServerTrustGroup DeserializeServerTrustGroup(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional> groupMembers = default; + Optional> trustScopes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("groupMembers")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ServerInfo.DeserializeServerInfo(item)); + } + groupMembers = array; + continue; + } + if (property0.NameEquals("trustScopes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(new ServerTrustGroupPropertiesTrustScopesItem(item.GetString())); + } + trustScopes = array; + continue; + } + } + continue; + } + } + return new ServerTrustGroup(id.Value, name.Value, type.Value, Optional.ToList(groupMembers), Optional.ToList(trustScopes)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroup.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroup.cs new file mode 100644 index 0000000000000..6cff5a82800fe --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroup.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A server trust group. + public partial class ServerTrustGroup : ProxyResource + { + /// Initializes a new instance of ServerTrustGroup. + public ServerTrustGroup() + { + GroupMembers = new ChangeTrackingList(); + TrustScopes = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServerTrustGroup. + /// Resource ID. + /// Resource name. + /// Resource type. + /// Group members information for the server trust group. + /// Trust scope of the server trust group. + internal ServerTrustGroup(string id, string name, string type, IList groupMembers, IList trustScopes) : base(id, name, type) + { + GroupMembers = groupMembers; + TrustScopes = trustScopes; + } + + /// Group members information for the server trust group. + public IList GroupMembers { get; } + /// Trust scope of the server trust group. + public IList TrustScopes { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupListResult.Serialization.cs new file mode 100644 index 0000000000000..2aef26c9cbdf9 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class ServerTrustGroupListResult + { + internal static ServerTrustGroupListResult DeserializeServerTrustGroupListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ServerTrustGroup.DeserializeServerTrustGroup(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ServerTrustGroupListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupListResult.cs new file mode 100644 index 0000000000000..c15b52eb27bb1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of server trust groups. + internal partial class ServerTrustGroupListResult + { + /// Initializes a new instance of ServerTrustGroupListResult. + internal ServerTrustGroupListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ServerTrustGroupListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal ServerTrustGroupListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupPropertiesTrustScopesItem.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupPropertiesTrustScopesItem.cs new file mode 100644 index 0000000000000..48eaf381165d1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerTrustGroupPropertiesTrustScopesItem.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The ServerTrustGroupPropertiesTrustScopesItem. + public readonly partial struct ServerTrustGroupPropertiesTrustScopesItem : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServerTrustGroupPropertiesTrustScopesItem(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GlobalTransactionsValue = "GlobalTransactions"; + private const string ServiceBrokerValue = "ServiceBroker"; + + /// GlobalTransactions. + public static ServerTrustGroupPropertiesTrustScopesItem GlobalTransactions { get; } = new ServerTrustGroupPropertiesTrustScopesItem(GlobalTransactionsValue); + /// ServiceBroker. + public static ServerTrustGroupPropertiesTrustScopesItem ServiceBroker { get; } = new ServerTrustGroupPropertiesTrustScopesItem(ServiceBrokerValue); + /// Determines if two values are the same. + public static bool operator ==(ServerTrustGroupPropertiesTrustScopesItem left, ServerTrustGroupPropertiesTrustScopesItem right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServerTrustGroupPropertiesTrustScopesItem left, ServerTrustGroupPropertiesTrustScopesItem right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServerTrustGroupPropertiesTrustScopesItem(string value) => new ServerTrustGroupPropertiesTrustScopesItem(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServerTrustGroupPropertiesTrustScopesItem other && Equals(other); + /// + public bool Equals(ServerTrustGroupPropertiesTrustScopesItem other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerUpdate.Serialization.cs index d8a740047eade..a005966e2bc20 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerUpdate.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerUpdate.Serialization.cs @@ -15,6 +15,11 @@ public partial class ServerUpdate : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"); @@ -53,6 +58,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNetworkAccess"); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (Optional.IsDefined(PrimaryUserAssignedIdentityId)) + { + writer.WritePropertyName("primaryUserAssignedIdentityId"); + writer.WriteStringValue(PrimaryUserAssignedIdentityId); + } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"); + writer.WriteStringValue(FederatedClientId.Value); + } + if (Optional.IsDefined(KeyId)) + { + writer.WritePropertyName("keyId"); + writer.WriteStringValue(KeyId); + } + if (Optional.IsDefined(Administrators)) + { + writer.WritePropertyName("administrators"); + writer.WriteObjectValue(Administrators); + } + if (Optional.IsDefined(RestrictOutboundNetworkAccess)) + { + writer.WritePropertyName("restrictOutboundNetworkAccess"); + writer.WriteStringValue(RestrictOutboundNetworkAccess.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerUpdate.cs index d12e29b89c95c..211c2b17b428b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerUpdate.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerUpdate.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Collections.Generic; using Azure.Core; @@ -20,6 +21,8 @@ public ServerUpdate() PrivateEndpointConnections = new ChangeTrackingList(); } + /// Server identity. + public ResourceIdentity Identity { get; set; } /// Resource tags. public IDictionary Tags { get; } /// Administrator username for the server. Once created it cannot be changed. @@ -37,6 +40,18 @@ public ServerUpdate() /// Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. public string MinimalTlsVersion { get; set; } /// Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. - public ServerPublicNetworkAccess? PublicNetworkAccess { get; set; } + public ServerNetworkAccessFlag? PublicNetworkAccess { get; set; } + /// Whether or not existing server has a workspace created and if it allows connection from workspace. + public ServerWorkspaceFeature? WorkspaceFeature { get; } + /// The resource id of a user assigned identity to be used by default. + public string PrimaryUserAssignedIdentityId { get; set; } + /// The Client id used for cross tenant CMK scenario. + public Guid? FederatedClientId { get; set; } + /// A CMK URI of the key to use for encryption. + public string KeyId { get; set; } + /// The Azure Active Directory identity of the server. + public ServerExternalAdministrator Administrators { get; set; } + /// Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + public ServerNetworkAccessFlag? RestrictOutboundNetworkAccess { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs index 8e9dab73aef5e..0a7f9fd6f88bd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs @@ -20,8 +20,8 @@ public ServerVulnerabilityAssessment() /// Resource name. /// Resource type. /// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - /// A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - /// Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + /// 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. + /// 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. /// The recurring scans settings. internal ServerVulnerabilityAssessment(string id, string name, string type, string storageContainerPath, string storageContainerSasKey, string storageAccountAccessKey, VulnerabilityAssessmentRecurringScansProperties recurringScans) : base(id, name, type) { @@ -33,9 +33,9 @@ internal ServerVulnerabilityAssessment(string id, string name, string type, stri /// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). public string StorageContainerPath { get; set; } - /// A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + /// 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. public string StorageContainerSasKey { get; set; } - /// Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + /// 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. public string StorageAccountAccessKey { get; set; } /// The recurring scans settings. public VulnerabilityAssessmentRecurringScansProperties RecurringScans { get; set; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerWorkspaceFeature.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerWorkspaceFeature.cs new file mode 100644 index 0000000000000..a9cc3a9839f56 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServerWorkspaceFeature.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Whether or not existing server has a workspace created and if it allows connection from workspace. + public readonly partial struct ServerWorkspaceFeature : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServerWorkspaceFeature(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConnectedValue = "Connected"; + private const string DisconnectedValue = "Disconnected"; + + /// Connected. + public static ServerWorkspaceFeature Connected { get; } = new ServerWorkspaceFeature(ConnectedValue); + /// Disconnected. + public static ServerWorkspaceFeature Disconnected { get; } = new ServerWorkspaceFeature(DisconnectedValue); + /// Determines if two values are the same. + public static bool operator ==(ServerWorkspaceFeature left, ServerWorkspaceFeature right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServerWorkspaceFeature left, ServerWorkspaceFeature right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServerWorkspaceFeature(string value) => new ServerWorkspaceFeature(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServerWorkspaceFeature other && Equals(other); + /// + public bool Equals(ServerWorkspaceFeature other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveCapability.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveCapability.Serialization.cs index 0ec960a053290..9c9ae074bfbde 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveCapability.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveCapability.Serialization.cs @@ -27,6 +27,7 @@ internal static ServiceObjectiveCapability DeserializeServiceObjectiveCapability Optional supportedAutoPauseDelay = default; Optional> supportedMinCapacities = default; Optional computeModel = default; + Optional> supportedMaintenanceConfigurations = default; Optional status = default; Optional reason = default; foreach (var property in element.EnumerateObject()) @@ -146,6 +147,21 @@ internal static ServiceObjectiveCapability DeserializeServiceObjectiveCapability computeModel = property.Value.GetString(); continue; } + if (property.NameEquals("supportedMaintenanceConfigurations")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MaintenanceConfigurationCapability.DeserializeMaintenanceConfigurationCapability(item)); + } + supportedMaintenanceConfigurations = array; + continue; + } if (property.NameEquals("status")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -162,7 +178,7 @@ internal static ServiceObjectiveCapability DeserializeServiceObjectiveCapability continue; } } - return new ServiceObjectiveCapability(Optional.ToNullable(id), name.Value, Optional.ToList(supportedMaxSizes), performanceLevel.Value, sku.Value, Optional.ToList(supportedLicenseTypes), includedMaxSize.Value, Optional.ToNullable(zoneRedundant), supportedAutoPauseDelay.Value, Optional.ToList(supportedMinCapacities), computeModel.Value, Optional.ToNullable(status), reason.Value); + return new ServiceObjectiveCapability(Optional.ToNullable(id), name.Value, Optional.ToList(supportedMaxSizes), performanceLevel.Value, sku.Value, Optional.ToList(supportedLicenseTypes), includedMaxSize.Value, Optional.ToNullable(zoneRedundant), supportedAutoPauseDelay.Value, Optional.ToList(supportedMinCapacities), computeModel.Value, Optional.ToList(supportedMaintenanceConfigurations), Optional.ToNullable(status), reason.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveCapability.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveCapability.cs index 2a7ad2932ab97..58056cd2822f3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveCapability.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveCapability.cs @@ -20,6 +20,7 @@ internal ServiceObjectiveCapability() SupportedMaxSizes = new ChangeTrackingList(); SupportedLicenseTypes = new ChangeTrackingList(); SupportedMinCapacities = new ChangeTrackingList(); + SupportedMaintenanceConfigurations = new ChangeTrackingList(); } /// Initializes a new instance of ServiceObjectiveCapability. @@ -34,9 +35,10 @@ internal ServiceObjectiveCapability() /// Supported time range for auto pause delay. /// List of supported min capacities. /// The compute model. + /// List of supported maintenance configurations. /// The status of the capability. /// The reason for the capability not being available. - internal ServiceObjectiveCapability(Guid? id, string name, IReadOnlyList supportedMaxSizes, PerformanceLevelCapability performanceLevel, Sku sku, IReadOnlyList supportedLicenseTypes, MaxSizeCapability includedMaxSize, bool? zoneRedundant, AutoPauseDelayTimeRange supportedAutoPauseDelay, IReadOnlyList supportedMinCapacities, string computeModel, CapabilityStatus? status, string reason) + internal ServiceObjectiveCapability(Guid? id, string name, IReadOnlyList supportedMaxSizes, PerformanceLevelCapability performanceLevel, Sku sku, IReadOnlyList supportedLicenseTypes, MaxSizeCapability includedMaxSize, bool? zoneRedundant, AutoPauseDelayTimeRange supportedAutoPauseDelay, IReadOnlyList supportedMinCapacities, string computeModel, IReadOnlyList supportedMaintenanceConfigurations, CapabilityStatus? status, string reason) { Id = id; Name = name; @@ -49,6 +51,7 @@ internal ServiceObjectiveCapability(Guid? id, string name, IReadOnlyList SupportedMinCapacities { get; } /// The compute model. public string ComputeModel { get; } + /// List of supported maintenance configurations. + public IReadOnlyList SupportedMaintenanceConfigurations { get; } /// The status of the capability. public CapabilityStatus? Status { get; } /// The reason for the capability not being available. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveName.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveName.cs index f300cbf57bb6c..7f2277024667f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveName.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceObjectiveName.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.Sql.Models { - /// The name of the service objective to assign to the database. - public readonly partial struct ServiceObjectiveName : IEquatable + /// The serviceLevelObjective for SLO usage metric. + internal readonly partial struct ServiceObjectiveName : IEquatable { private readonly string _value; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs new file mode 100644 index 0000000000000..cb50a10bd6349 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class ServicePrincipal : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static ServicePrincipal DeserializeServicePrincipal(JsonElement element) + { + Optional principalId = default; + Optional clientId = default; + Optional tenantId = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId")) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new ServicePrincipalType(property.Value.GetString()); + continue; + } + } + return new ServicePrincipal(principalId.Value, clientId.Value, tenantId.Value, Optional.ToNullable(type)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs new file mode 100644 index 0000000000000..b6aa1ff53a7fd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipal.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// The managed instance's service principal configuration for a resource. + public partial class ServicePrincipal + { + /// Initializes a new instance of ServicePrincipal. + public ServicePrincipal() + { + } + + /// Initializes a new instance of ServicePrincipal. + /// The Azure Active Directory application object id. + /// The Azure Active Directory application client id. + /// The Azure Active Directory tenant id. + /// Service principal type. + internal ServicePrincipal(string principalId, string clientId, string tenantId, ServicePrincipalType? type) + { + PrincipalId = principalId; + ClientId = clientId; + TenantId = tenantId; + Type = type; + } + + /// The Azure Active Directory application object id. + public string PrincipalId { get; } + /// The Azure Active Directory application client id. + public string ClientId { get; } + /// The Azure Active Directory tenant id. + public string TenantId { get; } + /// Service principal type. + public ServicePrincipalType? Type { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs new file mode 100644 index 0000000000000..b1ef70e057a00 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServicePrincipalType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Service principal type. + public readonly partial struct ServicePrincipalType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public ServicePrincipalType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string SystemAssignedValue = "SystemAssigned"; + + /// None. + public static ServicePrincipalType None { get; } = new ServicePrincipalType(NoneValue); + /// SystemAssigned. + public static ServicePrincipalType SystemAssigned { get; } = new ServicePrincipalType(SystemAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(ServicePrincipalType left, ServicePrincipalType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServicePrincipalType left, ServicePrincipalType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ServicePrincipalType(string value) => new ServicePrincipalType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServicePrincipalType other && Equals(other); + /// + public bool Equals(ServicePrincipalType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisor.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisor.Serialization.cs deleted file mode 100644 index bb05655114130..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisor.Serialization.cs +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - public partial class ServiceTierAdvisor : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static ServiceTierAdvisor DeserializeServiceTierAdvisor(JsonElement element) - { - Optional id = default; - Optional name = default; - Optional type = default; - Optional observationPeriodStart = default; - Optional observationPeriodEnd = default; - Optional activeTimeRatio = default; - Optional minDtu = default; - Optional avgDtu = default; - Optional maxDtu = default; - Optional maxSizeInGB = default; - Optional> serviceLevelObjectiveUsageMetrics = default; - Optional currentServiceLevelObjective = default; - Optional currentServiceLevelObjectiveId = default; - Optional usageBasedRecommendationServiceLevelObjective = default; - Optional usageBasedRecommendationServiceLevelObjectiveId = default; - Optional databaseSizeBasedRecommendationServiceLevelObjective = default; - Optional databaseSizeBasedRecommendationServiceLevelObjectiveId = default; - Optional disasterPlanBasedRecommendationServiceLevelObjective = default; - Optional disasterPlanBasedRecommendationServiceLevelObjectiveId = default; - Optional overallRecommendationServiceLevelObjective = default; - Optional overallRecommendationServiceLevelObjectiveId = default; - Optional confidence = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = property.Value.GetString(); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("observationPeriodStart")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - observationPeriodStart = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("observationPeriodEnd")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - observationPeriodEnd = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("activeTimeRatio")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - activeTimeRatio = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("minDtu")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - minDtu = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("avgDtu")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - avgDtu = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("maxDtu")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - maxDtu = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("maxSizeInGB")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - maxSizeInGB = property0.Value.GetDouble(); - continue; - } - if (property0.NameEquals("serviceLevelObjectiveUsageMetrics")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(SloUsageMetric.DeserializeSloUsageMetric(item)); - } - serviceLevelObjectiveUsageMetrics = array; - continue; - } - if (property0.NameEquals("currentServiceLevelObjective")) - { - currentServiceLevelObjective = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("currentServiceLevelObjectiveId")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - currentServiceLevelObjectiveId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("usageBasedRecommendationServiceLevelObjective")) - { - usageBasedRecommendationServiceLevelObjective = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("usageBasedRecommendationServiceLevelObjectiveId")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - usageBasedRecommendationServiceLevelObjectiveId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("databaseSizeBasedRecommendationServiceLevelObjective")) - { - databaseSizeBasedRecommendationServiceLevelObjective = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("databaseSizeBasedRecommendationServiceLevelObjectiveId")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - databaseSizeBasedRecommendationServiceLevelObjectiveId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("disasterPlanBasedRecommendationServiceLevelObjective")) - { - disasterPlanBasedRecommendationServiceLevelObjective = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("disasterPlanBasedRecommendationServiceLevelObjectiveId")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - disasterPlanBasedRecommendationServiceLevelObjectiveId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("overallRecommendationServiceLevelObjective")) - { - overallRecommendationServiceLevelObjective = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("overallRecommendationServiceLevelObjectiveId")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - overallRecommendationServiceLevelObjectiveId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("confidence")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - confidence = property0.Value.GetDouble(); - continue; - } - } - continue; - } - } - return new ServiceTierAdvisor(id.Value, name.Value, type.Value, Optional.ToNullable(observationPeriodStart), Optional.ToNullable(observationPeriodEnd), Optional.ToNullable(activeTimeRatio), Optional.ToNullable(minDtu), Optional.ToNullable(avgDtu), Optional.ToNullable(maxDtu), Optional.ToNullable(maxSizeInGB), Optional.ToList(serviceLevelObjectiveUsageMetrics), currentServiceLevelObjective.Value, Optional.ToNullable(currentServiceLevelObjectiveId), usageBasedRecommendationServiceLevelObjective.Value, Optional.ToNullable(usageBasedRecommendationServiceLevelObjectiveId), databaseSizeBasedRecommendationServiceLevelObjective.Value, Optional.ToNullable(databaseSizeBasedRecommendationServiceLevelObjectiveId), disasterPlanBasedRecommendationServiceLevelObjective.Value, Optional.ToNullable(disasterPlanBasedRecommendationServiceLevelObjectiveId), overallRecommendationServiceLevelObjective.Value, Optional.ToNullable(overallRecommendationServiceLevelObjectiveId), Optional.ToNullable(confidence)); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisor.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisor.cs deleted file mode 100644 index f93450e32a802..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisor.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents a Service Tier Advisor. - public partial class ServiceTierAdvisor : ProxyResource - { - /// Initializes a new instance of ServiceTierAdvisor. - public ServiceTierAdvisor() - { - ServiceLevelObjectiveUsageMetrics = new ChangeTrackingList(); - } - - /// Initializes a new instance of ServiceTierAdvisor. - /// Resource ID. - /// Resource name. - /// Resource type. - /// The observation period start (ISO8601 format). - /// The observation period start (ISO8601 format). - /// The activeTimeRatio for service tier advisor. - /// Gets or sets minDtu for service tier advisor. - /// Gets or sets avgDtu for service tier advisor. - /// Gets or sets maxDtu for service tier advisor. - /// Gets or sets maxSizeInGB for service tier advisor. - /// Gets or sets serviceLevelObjectiveUsageMetrics for the service tier advisor. - /// Gets or sets currentServiceLevelObjective for service tier advisor. - /// Gets or sets currentServiceLevelObjectiveId for service tier advisor. - /// Gets or sets usageBasedRecommendationServiceLevelObjective for service tier advisor. - /// Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. - /// Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. - /// Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. - /// Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. - /// Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. - /// Gets or sets overallRecommendationServiceLevelObjective for service tier advisor. - /// Gets or sets overallRecommendationServiceLevelObjectiveId for service tier advisor. - /// Gets or sets confidence for service tier advisor. - internal ServiceTierAdvisor(string id, string name, string type, DateTimeOffset? observationPeriodStart, DateTimeOffset? observationPeriodEnd, double? activeTimeRatio, double? minDtu, double? avgDtu, double? maxDtu, double? maxSizeInGB, IReadOnlyList serviceLevelObjectiveUsageMetrics, string currentServiceLevelObjective, Guid? currentServiceLevelObjectiveId, string usageBasedRecommendationServiceLevelObjective, Guid? usageBasedRecommendationServiceLevelObjectiveId, string databaseSizeBasedRecommendationServiceLevelObjective, Guid? databaseSizeBasedRecommendationServiceLevelObjectiveId, string disasterPlanBasedRecommendationServiceLevelObjective, Guid? disasterPlanBasedRecommendationServiceLevelObjectiveId, string overallRecommendationServiceLevelObjective, Guid? overallRecommendationServiceLevelObjectiveId, double? confidence) : base(id, name, type) - { - ObservationPeriodStart = observationPeriodStart; - ObservationPeriodEnd = observationPeriodEnd; - ActiveTimeRatio = activeTimeRatio; - MinDtu = minDtu; - AvgDtu = avgDtu; - MaxDtu = maxDtu; - MaxSizeInGB = maxSizeInGB; - ServiceLevelObjectiveUsageMetrics = serviceLevelObjectiveUsageMetrics; - CurrentServiceLevelObjective = currentServiceLevelObjective; - CurrentServiceLevelObjectiveId = currentServiceLevelObjectiveId; - UsageBasedRecommendationServiceLevelObjective = usageBasedRecommendationServiceLevelObjective; - UsageBasedRecommendationServiceLevelObjectiveId = usageBasedRecommendationServiceLevelObjectiveId; - DatabaseSizeBasedRecommendationServiceLevelObjective = databaseSizeBasedRecommendationServiceLevelObjective; - DatabaseSizeBasedRecommendationServiceLevelObjectiveId = databaseSizeBasedRecommendationServiceLevelObjectiveId; - DisasterPlanBasedRecommendationServiceLevelObjective = disasterPlanBasedRecommendationServiceLevelObjective; - DisasterPlanBasedRecommendationServiceLevelObjectiveId = disasterPlanBasedRecommendationServiceLevelObjectiveId; - OverallRecommendationServiceLevelObjective = overallRecommendationServiceLevelObjective; - OverallRecommendationServiceLevelObjectiveId = overallRecommendationServiceLevelObjectiveId; - Confidence = confidence; - } - - /// The observation period start (ISO8601 format). - public DateTimeOffset? ObservationPeriodStart { get; } - /// The observation period start (ISO8601 format). - public DateTimeOffset? ObservationPeriodEnd { get; } - /// The activeTimeRatio for service tier advisor. - public double? ActiveTimeRatio { get; } - /// Gets or sets minDtu for service tier advisor. - public double? MinDtu { get; } - /// Gets or sets avgDtu for service tier advisor. - public double? AvgDtu { get; } - /// Gets or sets maxDtu for service tier advisor. - public double? MaxDtu { get; } - /// Gets or sets maxSizeInGB for service tier advisor. - public double? MaxSizeInGB { get; } - /// Gets or sets serviceLevelObjectiveUsageMetrics for the service tier advisor. - public IReadOnlyList ServiceLevelObjectiveUsageMetrics { get; } - /// Gets or sets currentServiceLevelObjective for service tier advisor. - public string CurrentServiceLevelObjective { get; } - /// Gets or sets currentServiceLevelObjectiveId for service tier advisor. - public Guid? CurrentServiceLevelObjectiveId { get; } - /// Gets or sets usageBasedRecommendationServiceLevelObjective for service tier advisor. - public string UsageBasedRecommendationServiceLevelObjective { get; } - /// Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. - public Guid? UsageBasedRecommendationServiceLevelObjectiveId { get; } - /// Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. - public string DatabaseSizeBasedRecommendationServiceLevelObjective { get; } - /// Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. - public Guid? DatabaseSizeBasedRecommendationServiceLevelObjectiveId { get; } - /// Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. - public string DisasterPlanBasedRecommendationServiceLevelObjective { get; } - /// Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. - public Guid? DisasterPlanBasedRecommendationServiceLevelObjectiveId { get; } - /// Gets or sets overallRecommendationServiceLevelObjective for service tier advisor. - public string OverallRecommendationServiceLevelObjective { get; } - /// Gets or sets overallRecommendationServiceLevelObjectiveId for service tier advisor. - public Guid? OverallRecommendationServiceLevelObjectiveId { get; } - /// Gets or sets confidence for service tier advisor. - public double? Confidence { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisorListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisorListResult.Serialization.cs deleted file mode 100644 index 454e4cb19e05b..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisorListResult.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - internal partial class ServiceTierAdvisorListResult - { - internal static ServiceTierAdvisorListResult DeserializeServiceTierAdvisorListResult(JsonElement element) - { - IReadOnlyList value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ServiceTierAdvisor.DeserializeServiceTierAdvisor(item)); - } - value = array; - continue; - } - } - return new ServiceTierAdvisorListResult(value); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisorListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisorListResult.cs deleted file mode 100644 index f1bb8cb523ae0..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ServiceTierAdvisorListResult.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents the response to a list service tier advisor request. - internal partial class ServiceTierAdvisorListResult - { - /// Initializes a new instance of ServiceTierAdvisorListResult. - /// The list of service tier advisors for specified database. - /// is null. - internal ServiceTierAdvisorListResult(IEnumerable value) - { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - - Value = value.ToList(); - } - - /// Initializes a new instance of ServiceTierAdvisorListResult. - /// The list of service tier advisors for specified database. - internal ServiceTierAdvisorListResult(IReadOnlyList value) - { - Value = value; - } - - /// The list of service tier advisors for specified database. - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SloUsageMetric.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SloUsageMetric.Serialization.cs deleted file mode 100644 index 370a10dec082f..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SloUsageMetric.Serialization.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - public partial class SloUsageMetric - { - internal static SloUsageMetric DeserializeSloUsageMetric(JsonElement element) - { - Optional serviceLevelObjective = default; - Optional serviceLevelObjectiveId = default; - Optional inRangeTimeRatio = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("serviceLevelObjective")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - serviceLevelObjective = new ServiceObjectiveName(property.Value.GetString()); - continue; - } - if (property.NameEquals("serviceLevelObjectiveId")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - serviceLevelObjectiveId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("inRangeTimeRatio")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - inRangeTimeRatio = property.Value.GetDouble(); - continue; - } - } - return new SloUsageMetric(Optional.ToNullable(serviceLevelObjective), Optional.ToNullable(serviceLevelObjectiveId), Optional.ToNullable(inRangeTimeRatio)); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SloUsageMetric.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SloUsageMetric.cs index 55472cc823654..69d47da12f04d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SloUsageMetric.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SloUsageMetric.cs @@ -10,24 +10,13 @@ namespace Azure.ResourceManager.Sql.Models { /// A Slo Usage Metric. - public partial class SloUsageMetric + internal partial class SloUsageMetric { /// Initializes a new instance of SloUsageMetric. internal SloUsageMetric() { } - /// Initializes a new instance of SloUsageMetric. - /// The serviceLevelObjective for SLO usage metric. - /// The serviceLevelObjectiveId for SLO usage metric. - /// Gets or sets inRangeTimeRatio for SLO usage metric. - internal SloUsageMetric(ServiceObjectiveName? serviceLevelObjective, Guid? serviceLevelObjectiveId, double? inRangeTimeRatio) - { - ServiceLevelObjective = serviceLevelObjective; - ServiceLevelObjectiveId = serviceLevelObjectiveId; - InRangeTimeRatio = inRangeTimeRatio; - } - /// The serviceLevelObjective for SLO usage metric. public ServiceObjectiveName? ServiceLevelObjective { get; } /// The serviceLevelObjectiveId for SLO usage metric. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfiguration.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfiguration.Serialization.cs new file mode 100644 index 0000000000000..76fc41ea91928 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfiguration.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class SqlAgentConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SqlAgentConfiguration DeserializeSqlAgentConfiguration(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional state = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("state")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + state = new SqlAgentConfigurationPropertiesState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new SqlAgentConfiguration(id.Value, name.Value, type.Value, Optional.ToNullable(state)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfiguration.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfiguration.cs new file mode 100644 index 0000000000000..46dc64d03f7a5 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfiguration.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A recoverable managed database resource. + public partial class SqlAgentConfiguration : ProxyResource + { + /// Initializes a new instance of SqlAgentConfiguration. + public SqlAgentConfiguration() + { + } + + /// Initializes a new instance of SqlAgentConfiguration. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The state of Sql Agent. + internal SqlAgentConfiguration(string id, string name, string type, SqlAgentConfigurationPropertiesState? state) : base(id, name, type) + { + State = state; + } + + /// The state of Sql Agent. + public SqlAgentConfigurationPropertiesState? State { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfigurationPropertiesState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfigurationPropertiesState.cs new file mode 100644 index 0000000000000..ebd336c1ea8ec --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SqlAgentConfigurationPropertiesState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The state of Sql Agent. + public readonly partial struct SqlAgentConfigurationPropertiesState : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public SqlAgentConfigurationPropertiesState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static SqlAgentConfigurationPropertiesState Enabled { get; } = new SqlAgentConfigurationPropertiesState(EnabledValue); + /// Disabled. + public static SqlAgentConfigurationPropertiesState Disabled { get; } = new SqlAgentConfigurationPropertiesState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(SqlAgentConfigurationPropertiesState left, SqlAgentConfigurationPropertiesState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SqlAgentConfigurationPropertiesState left, SqlAgentConfigurationPropertiesState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SqlAgentConfigurationPropertiesState(string value) => new SqlAgentConfigurationPropertiesState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SqlAgentConfigurationPropertiesState other && Equals(other); + /// + public bool Equals(SqlAgentConfigurationPropertiesState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageKeyType.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageKeyType.Serialization.cs deleted file mode 100644 index 18b0f9a39c1e7..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageKeyType.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Sql.Models -{ - internal static partial class StorageKeyTypeExtensions - { - public static string ToSerialString(this StorageKeyType value) => value switch - { - StorageKeyType.StorageAccessKey => "StorageAccessKey", - StorageKeyType.SharedAccessKey => "SharedAccessKey", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown StorageKeyType value.") - }; - - public static StorageKeyType ToStorageKeyType(this string value) - { - if (string.Equals(value, "StorageAccessKey", StringComparison.InvariantCultureIgnoreCase)) return StorageKeyType.StorageAccessKey; - if (string.Equals(value, "SharedAccessKey", StringComparison.InvariantCultureIgnoreCase)) return StorageKeyType.SharedAccessKey; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown StorageKeyType value."); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageKeyType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageKeyType.cs index 601f400318e95..86d0a7541dd63 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageKeyType.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/StorageKeyType.cs @@ -5,14 +5,47 @@ #nullable disable +using System; +using System.ComponentModel; + namespace Azure.ResourceManager.Sql.Models { - /// The type of the storage key to use. - public enum StorageKeyType + /// Storage key type. + public readonly partial struct StorageKeyType : IEquatable { - /// StorageAccessKey. - StorageAccessKey, + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public StorageKeyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SharedAccessKeyValue = "SharedAccessKey"; + private const string StorageAccessKeyValue = "StorageAccessKey"; + /// SharedAccessKey. - SharedAccessKey + public static StorageKeyType SharedAccessKey { get; } = new StorageKeyType(SharedAccessKeyValue); + /// StorageAccessKey. + public static StorageKeyType StorageAccessKey { get; } = new StorageKeyType(StorageAccessKeyValue); + /// Determines if two values are the same. + public static bool operator ==(StorageKeyType left, StorageKeyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StorageKeyType left, StorageKeyType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator StorageKeyType(string value) => new StorageKeyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StorageKeyType other && Equals(other); + /// + public bool Equals(StorageKeyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncGroup.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncGroup.Serialization.cs index 5302af15dbfd6..f98e75f9713f6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncGroup.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncGroup.Serialization.cs @@ -16,6 +16,11 @@ public partial class SyncGroup : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Interval)) @@ -48,6 +53,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("schema"); writer.WriteObjectValue(Schema); } + if (Optional.IsDefined(EnableConflictLogging)) + { + writer.WritePropertyName("enableConflictLogging"); + writer.WriteBooleanValue(EnableConflictLogging.Value); + } + if (Optional.IsDefined(ConflictLoggingRetentionInDays)) + { + writer.WritePropertyName("conflictLoggingRetentionInDays"); + writer.WriteNumberValue(ConflictLoggingRetentionInDays.Value); + } if (Optional.IsDefined(UsePrivateLinkConnection)) { writer.WritePropertyName("usePrivateLinkConnection"); @@ -59,6 +74,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static SyncGroup DeserializeSyncGroup(JsonElement element) { + Optional sku = default; Optional id = default; Optional name = default; Optional type = default; @@ -70,9 +86,22 @@ internal static SyncGroup DeserializeSyncGroup(JsonElement element) Optional hubDatabasePassword = default; Optional syncState = default; Optional schema = default; + Optional enableConflictLogging = default; + Optional conflictLoggingRetentionInDays = default; Optional usePrivateLinkConnection = default; + Optional privateEndpointName = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("sku")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + sku = Sku.DeserializeSku(property.Value); + continue; + } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -162,6 +191,26 @@ internal static SyncGroup DeserializeSyncGroup(JsonElement element) schema = SyncGroupSchema.DeserializeSyncGroupSchema(property0.Value); continue; } + if (property0.NameEquals("enableConflictLogging")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + enableConflictLogging = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("conflictLoggingRetentionInDays")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + conflictLoggingRetentionInDays = property0.Value.GetInt32(); + continue; + } if (property0.NameEquals("usePrivateLinkConnection")) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -172,11 +221,16 @@ internal static SyncGroup DeserializeSyncGroup(JsonElement element) usePrivateLinkConnection = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("privateEndpointName")) + { + privateEndpointName = property0.Value.GetString(); + continue; + } } continue; } } - return new SyncGroup(id.Value, name.Value, type.Value, Optional.ToNullable(interval), Optional.ToNullable(lastSyncTime), Optional.ToNullable(conflictResolutionPolicy), syncDatabaseId.Value, hubDatabaseUserName.Value, hubDatabasePassword.Value, Optional.ToNullable(syncState), schema.Value, Optional.ToNullable(usePrivateLinkConnection)); + return new SyncGroup(id.Value, name.Value, type.Value, sku.Value, Optional.ToNullable(interval), Optional.ToNullable(lastSyncTime), Optional.ToNullable(conflictResolutionPolicy), syncDatabaseId.Value, hubDatabaseUserName.Value, hubDatabasePassword.Value, Optional.ToNullable(syncState), schema.Value, Optional.ToNullable(enableConflictLogging), Optional.ToNullable(conflictLoggingRetentionInDays), Optional.ToNullable(usePrivateLinkConnection), privateEndpointName.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncGroup.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncGroup.cs index 6e8d11569bd17..2dc4849e737f0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncGroup.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncGroup.cs @@ -21,6 +21,7 @@ public SyncGroup() /// Resource ID. /// Resource name. /// Resource type. + /// The name and capacity of the SKU. /// Sync interval of the sync group. /// Last sync time of the sync group. /// Conflict resolution policy of the sync group. @@ -29,9 +30,13 @@ public SyncGroup() /// Password for the sync group hub database credential. /// Sync state of the sync group. /// Sync schema of the sync group. + /// If conflict logging is enabled. + /// Conflict logging retention period. /// If use private link connection is enabled. - internal SyncGroup(string id, string name, string type, int? interval, DateTimeOffset? lastSyncTime, SyncConflictResolutionPolicy? conflictResolutionPolicy, string syncDatabaseId, string hubDatabaseUserName, string hubDatabasePassword, SyncGroupState? syncState, SyncGroupSchema schema, bool? usePrivateLinkConnection) : base(id, name, type) + /// Private endpoint name of the sync group if use private link connection is enabled. + internal SyncGroup(string id, string name, string type, Sku sku, int? interval, DateTimeOffset? lastSyncTime, SyncConflictResolutionPolicy? conflictResolutionPolicy, string syncDatabaseId, string hubDatabaseUserName, string hubDatabasePassword, SyncGroupState? syncState, SyncGroupSchema schema, bool? enableConflictLogging, int? conflictLoggingRetentionInDays, bool? usePrivateLinkConnection, string privateEndpointName) : base(id, name, type) { + Sku = sku; Interval = interval; LastSyncTime = lastSyncTime; ConflictResolutionPolicy = conflictResolutionPolicy; @@ -40,9 +45,14 @@ internal SyncGroup(string id, string name, string type, int? interval, DateTimeO HubDatabasePassword = hubDatabasePassword; SyncState = syncState; Schema = schema; + EnableConflictLogging = enableConflictLogging; + ConflictLoggingRetentionInDays = conflictLoggingRetentionInDays; UsePrivateLinkConnection = usePrivateLinkConnection; + PrivateEndpointName = privateEndpointName; } + /// The name and capacity of the SKU. + public Sku Sku { get; set; } /// Sync interval of the sync group. public int? Interval { get; set; } /// Last sync time of the sync group. @@ -59,7 +69,13 @@ internal SyncGroup(string id, string name, string type, int? interval, DateTimeO public SyncGroupState? SyncState { get; } /// Sync schema of the sync group. public SyncGroupSchema Schema { get; set; } + /// If conflict logging is enabled. + public bool? EnableConflictLogging { get; set; } + /// Conflict logging retention period. + public int? ConflictLoggingRetentionInDays { get; set; } /// If use private link connection is enabled. public bool? UsePrivateLinkConnection { get; set; } + /// Private endpoint name of the sync group if use private link connection is enabled. + public string PrivateEndpointName { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncMember.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncMember.Serialization.cs index a6afcd15a9abe..ea84f456d170e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncMember.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncMember.Serialization.cs @@ -82,6 +82,7 @@ internal static SyncMember DeserializeSyncMember(JsonElement element) Optional sqlServerDatabaseId = default; Optional syncMemberAzureDatabaseResourceId = default; Optional usePrivateLinkConnection = default; + Optional privateEndpointName = default; Optional serverName = default; Optional databaseName = default; Optional userName = default; @@ -154,6 +155,11 @@ internal static SyncMember DeserializeSyncMember(JsonElement element) usePrivateLinkConnection = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("privateEndpointName")) + { + privateEndpointName = property0.Value.GetString(); + continue; + } if (property0.NameEquals("serverName")) { serverName = property0.Value.GetString(); @@ -198,7 +204,7 @@ internal static SyncMember DeserializeSyncMember(JsonElement element) continue; } } - return new SyncMember(id.Value, name.Value, type.Value, Optional.ToNullable(databaseType), syncAgentId.Value, Optional.ToNullable(sqlServerDatabaseId), syncMemberAzureDatabaseResourceId.Value, Optional.ToNullable(usePrivateLinkConnection), serverName.Value, databaseName.Value, userName.Value, password.Value, Optional.ToNullable(syncDirection), Optional.ToNullable(syncState)); + return new SyncMember(id.Value, name.Value, type.Value, Optional.ToNullable(databaseType), syncAgentId.Value, Optional.ToNullable(sqlServerDatabaseId), syncMemberAzureDatabaseResourceId.Value, Optional.ToNullable(usePrivateLinkConnection), privateEndpointName.Value, serverName.Value, databaseName.Value, userName.Value, password.Value, Optional.ToNullable(syncDirection), Optional.ToNullable(syncState)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncMember.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncMember.cs index 1c3b7554b437d..d0e249a5427d3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncMember.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SyncMember.cs @@ -26,19 +26,21 @@ public SyncMember() /// SQL Server database id of the sync member. /// ARM resource id of the sync member logical database, for sync members in Azure. /// Whether to use private link connection. + /// Private endpoint name of the sync member if use private link connection is enabled, for sync members in Azure. /// Server name of the member database in the sync member. /// Database name of the member database in the sync member. /// User name of the member database in the sync member. /// Password of the member database in the sync member. /// Sync direction of the sync member. /// Sync state of the sync member. - internal SyncMember(string id, string name, string type, SyncMemberDbType? databaseType, string syncAgentId, Guid? sqlServerDatabaseId, string syncMemberAzureDatabaseResourceId, bool? usePrivateLinkConnection, string serverName, string databaseName, string userName, string password, SyncDirection? syncDirection, SyncMemberState? syncState) : base(id, name, type) + internal SyncMember(string id, string name, string type, SyncMemberDbType? databaseType, string syncAgentId, Guid? sqlServerDatabaseId, string syncMemberAzureDatabaseResourceId, bool? usePrivateLinkConnection, string privateEndpointName, string serverName, string databaseName, string userName, string password, SyncDirection? syncDirection, SyncMemberState? syncState) : base(id, name, type) { DatabaseType = databaseType; SyncAgentId = syncAgentId; SqlServerDatabaseId = sqlServerDatabaseId; SyncMemberAzureDatabaseResourceId = syncMemberAzureDatabaseResourceId; UsePrivateLinkConnection = usePrivateLinkConnection; + PrivateEndpointName = privateEndpointName; ServerName = serverName; DatabaseName = databaseName; UserName = userName; @@ -57,6 +59,8 @@ internal SyncMember(string id, string name, string type, SyncMemberDbType? datab public string SyncMemberAzureDatabaseResourceId { get; set; } /// Whether to use private link connection. public bool? UsePrivateLinkConnection { get; set; } + /// Private endpoint name of the sync member if use private link connection is enabled, for sync members in Azure. + public string PrivateEndpointName { get; } /// Server name of the member database in the sync member. public string ServerName { get; set; } /// Database name of the member database in the sync member. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SystemData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SystemData.Serialization.cs new file mode 100644 index 0000000000000..94e86a4066a73 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SystemData.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class SystemData + { + internal static SystemData DeserializeSystemData(JsonElement element) + { + Optional createdBy = default; + Optional createdByType = default; + Optional createdAt = default; + Optional lastModifiedBy = default; + Optional lastModifiedByType = default; + Optional lastModifiedAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("createdBy")) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdByType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + createdByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdAt")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + createdAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy")) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedByType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastModifiedByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("lastModifiedAt")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastModifiedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new SystemData(createdBy.Value, Optional.ToNullable(createdByType), Optional.ToNullable(createdAt), lastModifiedBy.Value, Optional.ToNullable(lastModifiedByType), Optional.ToNullable(lastModifiedAt)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SystemData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..2fee3dea82b8e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SystemData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Metadata pertaining to creation and last modification of the resource. + public partial class SystemData + { + /// Initializes a new instance of SystemData. + internal SystemData() + { + } + + /// Initializes a new instance of SystemData. + /// The identity that created the resource. + /// The type of identity that created the resource. + /// The timestamp of resource creation (UTC). + /// The identity that last modified the resource. + /// The type of identity that last modified the resource. + /// The timestamp of resource last modification (UTC). + internal SystemData(string createdBy, CreatedByType? createdByType, DateTimeOffset? createdAt, string lastModifiedBy, CreatedByType? lastModifiedByType, DateTimeOffset? lastModifiedAt) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + } + + /// The identity that created the resource. + public string CreatedBy { get; } + /// The type of identity that created the resource. + public CreatedByType? CreatedByType { get; } + /// The timestamp of resource creation (UTC). + public DateTimeOffset? CreatedAt { get; } + /// The identity that last modified the resource. + public string LastModifiedBy { get; } + /// The type of identity that last modified the resource. + public CreatedByType? LastModifiedByType { get; } + /// The timestamp of resource last modification (UTC). + public DateTimeOffset? LastModifiedAt { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TableTemporalType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TableTemporalType.cs new file mode 100644 index 0000000000000..d6121a72b8b01 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TableTemporalType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The table temporal type. + public readonly partial struct TableTemporalType : IEquatable + { + private readonly string _value; + + /// Determines if two values are the same. + /// is null. + public TableTemporalType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NonTemporalTableValue = "NonTemporalTable"; + private const string HistoryTableValue = "HistoryTable"; + private const string SystemVersionedTemporalTableValue = "SystemVersionedTemporalTable"; + + /// NonTemporalTable. + public static TableTemporalType NonTemporalTable { get; } = new TableTemporalType(NonTemporalTableValue); + /// HistoryTable. + public static TableTemporalType HistoryTable { get; } = new TableTemporalType(HistoryTableValue); + /// SystemVersionedTemporalTable. + public static TableTemporalType SystemVersionedTemporalTable { get; } = new TableTemporalType(SystemVersionedTemporalTableValue); + /// Determines if two values are the same. + public static bool operator ==(TableTemporalType left, TableTemporalType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TableTemporalType left, TableTemporalType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TableTemporalType(string value) => new TableTemporalType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TableTemporalType other && Equals(other); + /// + public bool Equals(TableTemporalType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZone.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZone.Serialization.cs new file mode 100644 index 0000000000000..97c024cafdd8e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZone.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class TimeZone : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static TimeZone DeserializeTimeZone(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional type = default; + Optional timeZoneId = default; + Optional displayName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("timeZoneId")) + { + timeZoneId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new TimeZone(id.Value, name.Value, type.Value, timeZoneId.Value, displayName.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZone.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZone.cs new file mode 100644 index 0000000000000..f1d9c949395f3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZone.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Time Zone. + public partial class TimeZone : ProxyResource + { + /// Initializes a new instance of TimeZone. + public TimeZone() + { + } + + /// Initializes a new instance of TimeZone. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The time zone id. + /// The time zone display name. + internal TimeZone(string id, string name, string type, string timeZoneId, string displayName) : base(id, name, type) + { + TimeZoneId = timeZoneId; + DisplayName = displayName; + } + + /// The time zone id. + public string TimeZoneId { get; } + /// The time zone display name. + public string DisplayName { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZoneListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZoneListResult.Serialization.cs new file mode 100644 index 0000000000000..16f12a09fedda --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZoneListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class TimeZoneListResult + { + internal static TimeZoneListResult DeserializeTimeZoneListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TimeZone.DeserializeTimeZone(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TimeZoneListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZoneListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZoneListResult.cs new file mode 100644 index 0000000000000..1aed8ea2b56d7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TimeZoneListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of time zones. + internal partial class TimeZoneListResult + { + /// Initializes a new instance of TimeZoneListResult. + internal TimeZoneListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of TimeZoneListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal TimeZoneListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueries.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueries.Serialization.cs new file mode 100644 index 0000000000000..df06d97c9a81e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueries.Serialization.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class TopQueries + { + internal static TopQueries DeserializeTopQueries(JsonElement element) + { + Optional numberOfQueries = default; + Optional aggregationFunction = default; + Optional observationMetric = default; + Optional intervalType = default; + Optional startTime = default; + Optional endTime = default; + Optional> queries = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("numberOfQueries")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + numberOfQueries = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("aggregationFunction")) + { + aggregationFunction = property.Value.GetString(); + continue; + } + if (property.NameEquals("observationMetric")) + { + observationMetric = property.Value.GetString(); + continue; + } + if (property.NameEquals("intervalType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + intervalType = new QueryTimeGrainType(property.Value.GetString()); + continue; + } + if (property.NameEquals("startTime")) + { + startTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("endTime")) + { + endTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("queries")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QueryStatisticsProperties.DeserializeQueryStatisticsProperties(item)); + } + queries = array; + continue; + } + } + return new TopQueries(Optional.ToNullable(numberOfQueries), aggregationFunction.Value, observationMetric.Value, Optional.ToNullable(intervalType), startTime.Value, endTime.Value, Optional.ToList(queries)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueries.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueries.cs new file mode 100644 index 0000000000000..423121e2aacaf --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueries.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// The TopQueries. + public partial class TopQueries + { + /// Initializes a new instance of TopQueries. + internal TopQueries() + { + Queries = new ChangeTrackingList(); + } + + /// Initializes a new instance of TopQueries. + /// Requested number of top queries. + /// Aggregation function used to calculate query metrics. + /// Metric used to rank queries. + /// Interval type (length). + /// The start time for the metric (ISO-8601 format). + /// The end time for the metric (ISO-8601 format). + /// List of top resource consuming queries with appropriate metric data. + internal TopQueries(int? numberOfQueries, string aggregationFunction, string observationMetric, QueryTimeGrainType? intervalType, string startTime, string endTime, IReadOnlyList queries) + { + NumberOfQueries = numberOfQueries; + AggregationFunction = aggregationFunction; + ObservationMetric = observationMetric; + IntervalType = intervalType; + StartTime = startTime; + EndTime = endTime; + Queries = queries; + } + + /// Requested number of top queries. + public int? NumberOfQueries { get; } + /// Aggregation function used to calculate query metrics. + public string AggregationFunction { get; } + /// Metric used to rank queries. + public string ObservationMetric { get; } + /// Interval type (length). + public QueryTimeGrainType? IntervalType { get; } + /// The start time for the metric (ISO-8601 format). + public string StartTime { get; } + /// The end time for the metric (ISO-8601 format). + public string EndTime { get; } + /// List of top resource consuming queries with appropriate metric data. + public IReadOnlyList Queries { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueriesListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueriesListResult.Serialization.cs new file mode 100644 index 0000000000000..2010c4ed79efd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueriesListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + internal partial class TopQueriesListResult + { + internal static TopQueriesListResult DeserializeTopQueriesListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TopQueries.DeserializeTopQueries(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TopQueriesListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueriesListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueriesListResult.cs new file mode 100644 index 0000000000000..768a70c136235 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TopQueriesListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + /// A list of top resource consuming queries on managed instance. + internal partial class TopQueriesListResult + { + /// Initializes a new instance of TopQueriesListResult. + internal TopQueriesListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of TopQueriesListResult. + /// Array of results. + /// Link to retrieve next page of results. + internal TopQueriesListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of results. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryption.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryption.cs deleted file mode 100644 index 924f636f86a6d..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryption.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents a database transparent data encryption configuration. - public partial class TransparentDataEncryption : ProxyResource - { - /// Initializes a new instance of TransparentDataEncryption. - public TransparentDataEncryption() - { - } - - /// Initializes a new instance of TransparentDataEncryption. - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource location. - /// The status of the database transparent data encryption. - internal TransparentDataEncryption(string id, string name, string type, string location, TransparentDataEncryptionStatus? status) : base(id, name, type) - { - Location = location; - Status = status; - } - - /// Resource location. - public string Location { get; } - /// The status of the database transparent data encryption. - public TransparentDataEncryptionStatus? Status { get; set; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs deleted file mode 100644 index bf9ec6233a2ba..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivity.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents a database transparent data encryption Scan. - public partial class TransparentDataEncryptionActivity : ProxyResource - { - /// Initializes a new instance of TransparentDataEncryptionActivity. - public TransparentDataEncryptionActivity() - { - } - - /// Initializes a new instance of TransparentDataEncryptionActivity. - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource location. - /// The status of the database. - /// The percent complete of the transparent data encryption scan for a database. - internal TransparentDataEncryptionActivity(string id, string name, string type, string location, TransparentDataEncryptionActivityStatus? status, float? percentComplete) : base(id, name, type) - { - Location = location; - Status = status; - PercentComplete = percentComplete; - } - - /// Resource location. - public string Location { get; } - /// The status of the database. - public TransparentDataEncryptionActivityStatus? Status { get; } - /// The percent complete of the transparent data encryption scan for a database. - public float? PercentComplete { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityListResult.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityListResult.Serialization.cs deleted file mode 100644 index fa8c6d9fb5599..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityListResult.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Sql.Models -{ - internal partial class TransparentDataEncryptionActivityListResult - { - internal static TransparentDataEncryptionActivityListResult DeserializeTransparentDataEncryptionActivityListResult(JsonElement element) - { - IReadOnlyList value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(TransparentDataEncryptionActivity.DeserializeTransparentDataEncryptionActivity(item)); - } - value = array; - continue; - } - } - return new TransparentDataEncryptionActivityListResult(value); - } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityListResult.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityListResult.cs deleted file mode 100644 index 625962934f92e..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityListResult.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.Sql.Models -{ - /// Represents the response to a list database transparent data encryption activity request. - internal partial class TransparentDataEncryptionActivityListResult - { - /// Initializes a new instance of TransparentDataEncryptionActivityListResult. - /// The list of database transparent data encryption activities. - /// is null. - internal TransparentDataEncryptionActivityListResult(IEnumerable value) - { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - - Value = value.ToList(); - } - - /// Initializes a new instance of TransparentDataEncryptionActivityListResult. - /// The list of database transparent data encryption activities. - internal TransparentDataEncryptionActivityListResult(IReadOnlyList value) - { - Value = value; - } - - /// The list of database transparent data encryption activities. - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs deleted file mode 100644 index e00953804b10f..0000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionActivityStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The status of the database. - public readonly partial struct TransparentDataEncryptionActivityStatus : IEquatable - { - private readonly string _value; - - /// Determines if two values are the same. - /// is null. - public TransparentDataEncryptionActivityStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EncryptingValue = "Encrypting"; - private const string DecryptingValue = "Decrypting"; - - /// Encrypting. - public static TransparentDataEncryptionActivityStatus Encrypting { get; } = new TransparentDataEncryptionActivityStatus(EncryptingValue); - /// Decrypting. - public static TransparentDataEncryptionActivityStatus Decrypting { get; } = new TransparentDataEncryptionActivityStatus(DecryptingValue); - /// Determines if two values are the same. - public static bool operator ==(TransparentDataEncryptionActivityStatus left, TransparentDataEncryptionActivityStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(TransparentDataEncryptionActivityStatus left, TransparentDataEncryptionActivityStatus right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator TransparentDataEncryptionActivityStatus(string value) => new TransparentDataEncryptionActivityStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is TransparentDataEncryptionActivityStatus other && Equals(other); - /// - public bool Equals(TransparentDataEncryptionActivityStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionStatus.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionState.Serialization.cs similarity index 57% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionStatus.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionState.Serialization.cs index b13398ed8adec..63083038bfb12 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionStatus.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionState.Serialization.cs @@ -9,20 +9,20 @@ namespace Azure.ResourceManager.Sql.Models { - internal static partial class TransparentDataEncryptionStatusExtensions + internal static partial class TransparentDataEncryptionStateExtensions { - public static string ToSerialString(this TransparentDataEncryptionStatus value) => value switch + public static string ToSerialString(this TransparentDataEncryptionState value) => value switch { - TransparentDataEncryptionStatus.Enabled => "Enabled", - TransparentDataEncryptionStatus.Disabled => "Disabled", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TransparentDataEncryptionStatus value.") + TransparentDataEncryptionState.Enabled => "Enabled", + TransparentDataEncryptionState.Disabled => "Disabled", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TransparentDataEncryptionState value.") }; - public static TransparentDataEncryptionStatus ToTransparentDataEncryptionStatus(this string value) + public static TransparentDataEncryptionState ToTransparentDataEncryptionState(this string value) { - if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return TransparentDataEncryptionStatus.Enabled; - if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return TransparentDataEncryptionStatus.Disabled; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TransparentDataEncryptionStatus value."); + if (string.Equals(value, "Enabled", StringComparison.InvariantCultureIgnoreCase)) return TransparentDataEncryptionState.Enabled; + if (string.Equals(value, "Disabled", StringComparison.InvariantCultureIgnoreCase)) return TransparentDataEncryptionState.Disabled; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TransparentDataEncryptionState value."); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionState.cs similarity index 75% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionState.cs index 23f2c06be25e8..ea920c45f5cc5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionStatus.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryptionState.cs @@ -7,8 +7,8 @@ namespace Azure.ResourceManager.Sql.Models { - /// The status of the database transparent data encryption. - public enum TransparentDataEncryptionStatus + /// Specifies the state of the transparent data encryption. + public enum TransparentDataEncryptionState { /// Enabled. Enabled, diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.Serialization.cs new file mode 100644 index 0000000000000..1a7f717fd03e7 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class UpdateLongTermRetentionBackupParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(RequestedBackupStorageRedundancy)) + { + writer.WritePropertyName("requestedBackupStorageRedundancy"); + writer.WriteStringValue(RequestedBackupStorageRedundancy.Value.ToString()); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.cs new file mode 100644 index 0000000000000..dbec88d54d516 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateLongTermRetentionBackupParameters.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// Contains the information necessary to perform long term retention backup update operation. + public partial class UpdateLongTermRetentionBackupParameters + { + /// Initializes a new instance of UpdateLongTermRetentionBackupParameters. + public UpdateLongTermRetentionBackupParameters() + { + } + + /// The storage redundancy type of the copied backup. + public BackupStorageRedundancy? RequestedBackupStorageRedundancy { get; set; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryption.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.Serialization.cs similarity index 70% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryption.Serialization.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.Serialization.cs index 3c1a066384c6b..a763f168cc5a1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/TransparentDataEncryption.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.Serialization.cs @@ -10,36 +10,25 @@ namespace Azure.ResourceManager.Sql.Models { - public partial class TransparentDataEncryption : IUtf8JsonSerializable + public partial class UpdateManagedInstanceDnsServersOperation : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("properties"); writer.WriteStartObject(); - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"); - writer.WriteStringValue(Status.Value.ToSerialString()); - } writer.WriteEndObject(); writer.WriteEndObject(); } - internal static TransparentDataEncryption DeserializeTransparentDataEncryption(JsonElement element) + internal static UpdateManagedInstanceDnsServersOperation DeserializeUpdateManagedInstanceDnsServersOperation(JsonElement element) { - Optional location = default; Optional id = default; Optional name = default; Optional type = default; - Optional status = default; + Optional status = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("location")) - { - location = property.Value.GetString(); - continue; - } if (property.NameEquals("id")) { id = property.Value.GetString(); @@ -71,14 +60,14 @@ internal static TransparentDataEncryption DeserializeTransparentDataEncryption(J property0.ThrowNonNullablePropertyIsNull(); continue; } - status = property0.Value.GetString().ToTransparentDataEncryptionStatus(); + status = new DnsRefreshConfigurationPropertiesStatus(property0.Value.GetString()); continue; } } continue; } } - return new TransparentDataEncryption(id.Value, name.Value, type.Value, location.Value, Optional.ToNullable(status)); + return new UpdateManagedInstanceDnsServersOperation(id.Value, name.Value, type.Value, Optional.ToNullable(status)); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs new file mode 100644 index 0000000000000..b974314d64e45 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Sql.Models +{ + /// A recoverable managed database resource. + public partial class UpdateManagedInstanceDnsServersOperation : ProxyResource + { + /// Initializes a new instance of UpdateManagedInstanceDnsServersOperation. + public UpdateManagedInstanceDnsServersOperation() + { + } + + /// Initializes a new instance of UpdateManagedInstanceDnsServersOperation. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The status of the DNS refresh operation. + internal UpdateManagedInstanceDnsServersOperation(string id, string name, string type, DnsRefreshConfigurationPropertiesStatus? status) : base(id, name, type) + { + Status = status; + } + + /// The status of the DNS refresh operation. + public DnsRefreshConfigurationPropertiesStatus? Status { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UserIdentity.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UserIdentity.Serialization.cs new file mode 100644 index 0000000000000..c696e6153a4f6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UserIdentity.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class UserIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static UserIdentity DeserializeUserIdentity(JsonElement element) + { + Optional principalId = default; + Optional clientId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + principalId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("clientId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clientId = property.Value.GetGuid(); + continue; + } + } + return new UserIdentity(Optional.ToNullable(principalId), Optional.ToNullable(clientId)); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UserIdentity.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UserIdentity.cs new file mode 100644 index 0000000000000..4c5a4588ae028 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/UserIdentity.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Azure Active Directory identity configuration for a resource. + public partial class UserIdentity + { + /// Initializes a new instance of UserIdentity. + public UserIdentity() + { + } + + /// Initializes a new instance of UserIdentity. + /// The Azure Active Directory principal id. + /// The Azure Active Directory client id. + internal UserIdentity(Guid? principalId, Guid? clientId) + { + PrincipalId = principalId; + ClientId = clientId; + } + + /// The Azure Active Directory principal id. + public Guid? PrincipalId { get; } + /// The Azure Active Directory client id. + public Guid? ClientId { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualCluster.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualCluster.Serialization.cs index e3b9657d2abd4..982ce404006a0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualCluster.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualCluster.Serialization.cs @@ -36,6 +36,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("family"); writer.WriteStringValue(Family); } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"); + writer.WriteStringValue(MaintenanceConfigurationId); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -50,6 +55,7 @@ internal static VirtualCluster DeserializeVirtualCluster(JsonElement element) Optional subnetId = default; Optional family = default; Optional> childResources = default; + Optional maintenanceConfigurationId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location")) @@ -121,11 +127,16 @@ internal static VirtualCluster DeserializeVirtualCluster(JsonElement element) childResources = array; continue; } + if (property0.NameEquals("maintenanceConfigurationId")) + { + maintenanceConfigurationId = property0.Value.GetString(); + continue; + } } continue; } } - return new VirtualCluster(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), subnetId.Value, family.Value, Optional.ToList(childResources)); + return new VirtualCluster(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), subnetId.Value, family.Value, Optional.ToList(childResources), maintenanceConfigurationId.Value); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualCluster.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualCluster.cs index 15e0c398ffacc..578a93c2f6a71 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualCluster.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualCluster.cs @@ -36,11 +36,13 @@ public VirtualCluster(string location) : base(location) /// Subnet resource ID for the virtual cluster. /// If the service has different generations of hardware, for the same SKU, then that can be captured here. /// List of resources in this virtual cluster. - internal VirtualCluster(string id, string name, string type, string location, IDictionary tags, string subnetId, string family, IReadOnlyList childResources) : base(id, name, type, location, tags) + /// Specifies maintenance configuration id to apply to this virtual cluster. + internal VirtualCluster(string id, string name, string type, string location, IDictionary tags, string subnetId, string family, IReadOnlyList childResources, string maintenanceConfigurationId) : base(id, name, type, location, tags) { SubnetId = subnetId; Family = family; ChildResources = childResources; + MaintenanceConfigurationId = maintenanceConfigurationId; } /// Subnet resource ID for the virtual cluster. @@ -49,5 +51,7 @@ internal VirtualCluster(string id, string name, string type, string location, ID public string Family { get; set; } /// List of resources in this virtual cluster. public IReadOnlyList ChildResources { get; } + /// Specifies maintenance configuration id to apply to this virtual cluster. + public string MaintenanceConfigurationId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualClusterUpdate.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualClusterUpdate.Serialization.cs index fd7a464a86e9c..29fe3add9363d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualClusterUpdate.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualClusterUpdate.Serialization.cs @@ -33,6 +33,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("family"); writer.WriteStringValue(Family); } + if (Optional.IsDefined(MaintenanceConfigurationId)) + { + writer.WritePropertyName("maintenanceConfigurationId"); + writer.WriteStringValue(MaintenanceConfigurationId); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualClusterUpdate.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualClusterUpdate.cs index f2aa47cfe6da5..0af9b5b365c37 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualClusterUpdate.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualClusterUpdate.cs @@ -28,5 +28,7 @@ public VirtualClusterUpdate() public string Family { get; set; } /// List of resources in this virtual cluster. public IReadOnlyList ChildResources { get; } + /// Specifies maintenance configuration id to apply to this virtual cluster. + public string MaintenanceConfigurationId { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualNetworkRuleState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualNetworkRuleState.cs index b7708028b0ada..4e300ce40f5a5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualNetworkRuleState.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/VirtualNetworkRuleState.cs @@ -25,6 +25,7 @@ public VirtualNetworkRuleState(string value) private const string InitializingValue = "Initializing"; private const string InProgressValue = "InProgress"; private const string ReadyValue = "Ready"; + private const string FailedValue = "Failed"; private const string DeletingValue = "Deleting"; private const string UnknownValue = "Unknown"; @@ -34,6 +35,8 @@ public VirtualNetworkRuleState(string value) public static VirtualNetworkRuleState InProgress { get; } = new VirtualNetworkRuleState(InProgressValue); /// Ready. public static VirtualNetworkRuleState Ready { get; } = new VirtualNetworkRuleState(ReadyValue); + /// Failed. + public static VirtualNetworkRuleState Failed { get; } = new VirtualNetworkRuleState(FailedValue); /// Deleting. public static VirtualNetworkRuleState Deleting { get; } = new VirtualNetworkRuleState(DeletingValue); /// Unknown. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesCreateImportOperationOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesCreateOrUpdateOperation.cs similarity index 55% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesCreateImportOperationOperation.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesCreateOrUpdateOperation.cs index 326cde429eea2..550127cef0a27 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DatabasesCreateImportOperationOperation.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesCreateOrUpdateOperation.cs @@ -16,25 +16,25 @@ namespace Azure.ResourceManager.Sql { - /// Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. - public partial class DatabasesCreateImportOperationOperation : Operation, IOperationSource + /// Create a outbound firewall rule with a given name. + public partial class OutboundFirewallRulesCreateOrUpdateOperation : Operation, IOperationSource { - private readonly ArmOperationHelpers _operation; + private readonly ArmOperationHelpers _operation; - /// Initializes a new instance of DatabasesCreateImportOperationOperation for mocking. - protected DatabasesCreateImportOperationOperation() + /// Initializes a new instance of OutboundFirewallRulesCreateOrUpdateOperation for mocking. + protected OutboundFirewallRulesCreateOrUpdateOperation() { } - internal DatabasesCreateImportOperationOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal OutboundFirewallRulesCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatabasesCreateImportOperationOperation"); + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "OutboundFirewallRulesCreateOrUpdateOperation"); } /// public override string Id => _operation.Id; /// - public override ImportExportResponse Value => _operation.Value; + public override OutboundFirewallRule Value => _operation.Value; /// public override bool HasCompleted => _operation.HasCompleted; @@ -52,21 +52,21 @@ internal DatabasesCreateImportOperationOperation(ClientDiagnostics clientDiagnos public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - ImportExportResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + OutboundFirewallRule IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return ImportExportResponse.DeserializeImportExportResponse(document.RootElement); + return OutboundFirewallRule.DeserializeOutboundFirewallRule(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return ImportExportResponse.DeserializeImportExportResponse(document.RootElement); + return OutboundFirewallRule.DeserializeOutboundFirewallRule(document.RootElement); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesDeleteOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesDeleteOperation.cs new file mode 100644 index 0000000000000..8aa03d8e93bf4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesDeleteOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Sql +{ + /// Deletes a outbound firewall rule with a given name. + public partial class OutboundFirewallRulesDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of OutboundFirewallRulesDeleteOperation for mocking. + protected OutboundFirewallRulesDeleteOperation() + { + } + + internal OutboundFirewallRulesDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "OutboundFirewallRulesDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesOperations.cs new file mode 100644 index 0000000000000..557dec11e5581 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesOperations.cs @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The OutboundFirewallRules service client. + public partial class OutboundFirewallRulesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal OutboundFirewallRulesRestOperations RestClient { get; } + + /// Initializes a new instance of OutboundFirewallRulesOperations for mocking. + protected OutboundFirewallRulesOperations() + { + } + + /// Initializes a new instance of OutboundFirewallRulesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal OutboundFirewallRulesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new OutboundFirewallRulesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets an outbound firewall rule. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, outboundRuleFqdn, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets an outbound firewall rule. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, outboundRuleFqdn, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets all outbound firewall rules on a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets all outbound firewall rules on a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServer(resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Create a outbound firewall rule with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The OutboundFirewallRule to use. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, OutboundFirewallRule parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, cancellationToken).ConfigureAwait(false); + return new OutboundFirewallRulesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, outboundRuleFqdn, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a outbound firewall rule with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The OutboundFirewallRule to use. + /// The cancellation token to use. + /// , , , or is null. + public virtual OutboundFirewallRulesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string outboundRuleFqdn, OutboundFirewallRule parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, parameters, cancellationToken); + return new OutboundFirewallRulesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, outboundRuleFqdn, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a outbound firewall rule with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, serverName, outboundRuleFqdn, cancellationToken).ConfigureAwait(false); + return new OutboundFirewallRulesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, serverName, outboundRuleFqdn).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a outbound firewall rule with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public virtual OutboundFirewallRulesDeleteOperation StartDelete(string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + + using var scope = _clientDiagnostics.CreateScope("OutboundFirewallRulesOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, serverName, outboundRuleFqdn, cancellationToken); + return new OutboundFirewallRulesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, serverName, outboundRuleFqdn).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesRestOperations.cs new file mode 100644 index 0000000000000..cee98e00b9254 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/OutboundFirewallRulesRestOperations.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class OutboundFirewallRulesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of OutboundFirewallRulesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public OutboundFirewallRulesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string outboundRuleFqdn) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/outboundFirewallRules/", false); + uri.AppendPath(outboundRuleFqdn, true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets an outbound firewall rule. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, outboundRuleFqdn); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OutboundFirewallRule value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OutboundFirewallRule.DeserializeOutboundFirewallRule(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets an outbound firewall rule. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, outboundRuleFqdn); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OutboundFirewallRule value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OutboundFirewallRule.DeserializeOutboundFirewallRule(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string outboundRuleFqdn, OutboundFirewallRule parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/outboundFirewallRules/", false); + uri.AppendPath(outboundRuleFqdn, true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Create a outbound firewall rule with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The OutboundFirewallRule to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, OutboundFirewallRule parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, outboundRuleFqdn, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create a outbound firewall rule with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The OutboundFirewallRule to use. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string serverName, string outboundRuleFqdn, OutboundFirewallRule parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, outboundRuleFqdn, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string serverName, string outboundRuleFqdn) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/outboundFirewallRules/", false); + uri.AppendPath(outboundRuleFqdn, true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + return message; + } + + /// Deletes a outbound firewall rule with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + + using var message = CreateDeleteRequest(resourceGroupName, serverName, outboundRuleFqdn); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes a outbound firewall rule with a given name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string serverName, string outboundRuleFqdn, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (outboundRuleFqdn == null) + { + throw new ArgumentNullException(nameof(outboundRuleFqdn)); + } + + using var message = CreateDeleteRequest(resourceGroupName, serverName, outboundRuleFqdn); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/outboundFirewallRules", false); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets all outbound firewall rules on a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OutboundFirewallRuleListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OutboundFirewallRuleListResult.DeserializeOutboundFirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all outbound firewall rules on a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OutboundFirewallRuleListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OutboundFirewallRuleListResult.DeserializeOutboundFirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets all outbound firewall rules on a server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OutboundFirewallRuleListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OutboundFirewallRuleListResult.DeserializeOutboundFirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets all outbound firewall rules on a server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OutboundFirewallRuleListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OutboundFirewallRuleListResult.DeserializeOutboundFirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/PrivateEndpointConnectionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/PrivateEndpointConnectionsRestOperations.cs index a574183a48b9a..bbcaddafe21cf 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/PrivateEndpointConnectionsRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -153,7 +153,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -254,7 +254,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -341,7 +341,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/privateEndpointConnections", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/PrivateLinkResourcesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/PrivateLinkResourcesRestOperations.cs index e6dd795291d56..c123ed29f6f99 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/PrivateLinkResourcesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/PrivateLinkResourcesRestOperations.cs @@ -57,7 +57,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +142,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/privateLinkResources/", false); uri.AppendPath(groupName, true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs new file mode 100644 index 0000000000000..7c24abaf7151f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The RecommendedSensitivityLabels service client. + public partial class RecommendedSensitivityLabelsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal RecommendedSensitivityLabelsRestOperations RestClient { get; } + + /// Initializes a new instance of RecommendedSensitivityLabelsOperations for mocking. + protected RecommendedSensitivityLabelsOperations() + { + } + + /// Initializes a new instance of RecommendedSensitivityLabelsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal RecommendedSensitivityLabelsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new RecommendedSensitivityLabelsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + public virtual async Task UpdateAsync(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("RecommendedSensitivityLabelsOperations.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("RecommendedSensitivityLabelsOperations.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, serverName, databaseName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedSensitivityLabelsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedSensitivityLabelsRestOperations.cs new file mode 100644 index 0000000000000..77aca8604e739 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedSensitivityLabelsRestOperations.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class RecommendedSensitivityLabelsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of RecommendedSensitivityLabelsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public RecommendedSensitivityLabelsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/recommendedSensitivityLabels", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateAsync(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update recommended sensitivity labels states of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The RecommendedSensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + public Response Update(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabasesRestOperations.cs index 95a4dcb985c0e..5c6df692867a0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecoverableManagedDatabasesRestOperations.cs @@ -57,7 +57,7 @@ internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/recoverableDatabases", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +142,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(managedInstanceName, true); uri.AppendPath("/recoverableDatabases/", false); uri.AppendPath(recoverableDatabaseName, true); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinksOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinksOperations.cs index 56a4c88b0205f..84d5bdc1c956b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinksOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinksOperations.cs @@ -81,11 +81,11 @@ public virtual Response Delete(string resourceGroupName, string serverName, stri } } - /// Gets a database replication link. + /// Gets a replication link. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to get the link for. - /// The replication link ID to be retrieved. + /// The name of the database. + /// The name of the replication link. /// The cancellation token to use. public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { @@ -102,11 +102,11 @@ public virtual async Task> GetAsync(string resourceGro } } - /// Gets a database replication link. + /// Gets a replication link. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to get the link for. - /// The replication link ID to be retrieved. + /// The name of the database. + /// The name of the replication link. /// The cancellation token to use. public virtual Response Get(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { @@ -123,10 +123,10 @@ public virtual Response Get(string resourceGroupName, string se } } - /// Lists a database's replication links. + /// Gets a list of replication links on database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to retrieve links for. + /// The name of the database. /// The cancellation token to use. /// , , or is null. public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) @@ -151,7 +151,7 @@ async Task> FirstPageFunc(int? pageSizeHint) try { var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -159,13 +159,28 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ReplicationLinksOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Lists a database's replication links. + /// Gets a list of replication links on database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to retrieve links for. + /// The name of the database. /// The cancellation token to use. /// , , or is null. public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) @@ -190,7 +205,120 @@ Page FirstPageFunc(int? pageSizeHint) try { var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ReplicationLinksOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of replication links. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ReplicationLinksOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ReplicationLinksOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of replication links. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ReplicationLinksOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServer(resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ReplicationLinksOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -198,7 +326,7 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// Sets which replica database is primary by failing over from the current primary replica database. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinksRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinksRestOperations.cs index e93b99ccc5550..24fb7f45ba39d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinksRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ReplicationLinksRestOperations.cs @@ -141,11 +141,11 @@ public Response Delete(string resourceGroupName, string serverName, string datab } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string linkId) + internal HttpMessage CreateFailoverRequest(string resourceGroupName, string serverName, string databaseName, string linkId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -158,20 +158,20 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks/", false); uri.AppendPath(linkId, true); + uri.AppendPath("/failover", false); uri.AppendQuery("api-version", "2014-04-01", true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a database replication link. + /// Sets which replica database is primary by failing over from the current primary replica database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to get the link for. - /// The replication link ID to be retrieved. + /// The name of the database that has the replication link to be failed over. + /// The ID of the replication link to be failed over. /// The cancellation token to use. /// , , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public async Task FailoverAsync(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -190,30 +190,26 @@ public async Task> GetAsync(string resourceGroupName, throw new ArgumentNullException(nameof(linkId)); } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, linkId); + using var message = CreateFailoverRequest(resourceGroupName, serverName, databaseName, linkId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: - { - ReplicationLink value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ReplicationLink.DeserializeReplicationLink(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + case 204: + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Gets a database replication link. + /// Sets which replica database is primary by failing over from the current primary replica database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to get the link for. - /// The replication link ID to be retrieved. + /// The name of the database that has the replication link to be failed over. + /// The ID of the replication link to be failed over. /// The cancellation token to use. /// , , , or is null. - public Response Get(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public Response Failover(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -232,23 +228,19 @@ public Response Get(string resourceGroupName, string serverName throw new ArgumentNullException(nameof(linkId)); } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, linkId); + using var message = CreateFailoverRequest(resourceGroupName, serverName, databaseName, linkId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: - { - ReplicationLink value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ReplicationLink.DeserializeReplicationLink(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + case 204: + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateFailoverRequest(string resourceGroupName, string serverName, string databaseName, string linkId) + internal HttpMessage CreateFailoverAllowDataLossRequest(string resourceGroupName, string serverName, string databaseName, string linkId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -265,20 +257,20 @@ internal HttpMessage CreateFailoverRequest(string resourceGroupName, string serv uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks/", false); uri.AppendPath(linkId, true); - uri.AppendPath("/failover", false); + uri.AppendPath("/forceFailoverAllowDataLoss", false); uri.AppendQuery("api-version", "2014-04-01", true); request.Uri = uri; return message; } - /// Sets which replica database is primary by failing over from the current primary replica database. + /// Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database that has the replication link to be failed over. /// The ID of the replication link to be failed over. /// The cancellation token to use. /// , , , or is null. - public async Task FailoverAsync(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public async Task FailoverAllowDataLossAsync(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -297,7 +289,7 @@ public async Task FailoverAsync(string resourceGroupName, string serve throw new ArgumentNullException(nameof(linkId)); } - using var message = CreateFailoverRequest(resourceGroupName, serverName, databaseName, linkId); + using var message = CreateFailoverAllowDataLossRequest(resourceGroupName, serverName, databaseName, linkId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -309,14 +301,14 @@ public async Task FailoverAsync(string resourceGroupName, string serve } } - /// Sets which replica database is primary by failing over from the current primary replica database. + /// Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database that has the replication link to be failed over. /// The ID of the replication link to be failed over. /// The cancellation token to use. /// , , , or is null. - public Response Failover(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + public Response FailoverAllowDataLoss(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -335,7 +327,7 @@ public Response Failover(string resourceGroupName, string serverName, string dat throw new ArgumentNullException(nameof(linkId)); } - using var message = CreateFailoverRequest(resourceGroupName, serverName, databaseName, linkId); + using var message = CreateFailoverAllowDataLossRequest(resourceGroupName, serverName, databaseName, linkId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -347,7 +339,7 @@ public Response Failover(string resourceGroupName, string serverName, string dat } } - internal HttpMessage CreateFailoverAllowDataLossRequest(string resourceGroupName, string serverName, string databaseName, string linkId) + internal HttpMessage CreateUnlinkRequest(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -364,20 +356,25 @@ internal HttpMessage CreateFailoverAllowDataLossRequest(string resourceGroupName uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks/", false); uri.AppendPath(linkId, true); - uri.AppendPath("/forceFailoverAllowDataLoss", false); + uri.AppendPath("/unlink", false); uri.AppendQuery("api-version", "2014-04-01", true); request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; return message; } - /// Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + /// Deletes a database replication link in forced or friendly way. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database that has the replication link to be failed over. /// The ID of the replication link to be failed over. + /// The required parameters for unlinking replication link. /// The cancellation token to use. - /// , , , or is null. - public async Task FailoverAllowDataLossAsync(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task UnlinkAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -395,8 +392,12 @@ public async Task FailoverAllowDataLossAsync(string resourceGroupName, { throw new ArgumentNullException(nameof(linkId)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateFailoverAllowDataLossRequest(resourceGroupName, serverName, databaseName, linkId); + using var message = CreateUnlinkRequest(resourceGroupName, serverName, databaseName, linkId, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -408,14 +409,15 @@ public async Task FailoverAllowDataLossAsync(string resourceGroupName, } } - /// Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + /// Deletes a database replication link in forced or friendly way. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database that has the replication link to be failed over. /// The ID of the replication link to be failed over. + /// The required parameters for unlinking replication link. /// The cancellation token to use. - /// , , , or is null. - public Response FailoverAllowDataLoss(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response Unlink(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -433,8 +435,12 @@ public Response FailoverAllowDataLoss(string resourceGroupName, string serverNam { throw new ArgumentNullException(nameof(linkId)); } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } - using var message = CreateFailoverAllowDataLossRequest(resourceGroupName, serverName, databaseName, linkId); + using var message = CreateUnlinkRequest(resourceGroupName, serverName, databaseName, linkId, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -446,11 +452,107 @@ public Response FailoverAllowDataLoss(string resourceGroupName, string serverNam } } - internal HttpMessage CreateUnlinkRequest(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters) + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/replicationLinks", false); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of replication links on database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ReplicationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of replication links on database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , or is null. + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ReplicationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string linkId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -463,25 +565,20 @@ internal HttpMessage CreateUnlinkRequest(string resourceGroupName, string server uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks/", false); uri.AppendPath(linkId, true); - uri.AppendPath("/unlink", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(parameters); - request.Content = content; + request.Headers.Add("Accept", "application/json"); return message; } - /// Deletes a database replication link in forced or friendly way. + /// Gets a replication link. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be failed over. - /// The ID of the replication link to be failed over. - /// The required parameters for unlinking replication link. + /// The name of the database. + /// The name of the replication link. /// The cancellation token to use. - /// , , , , or is null. - public async Task UnlinkAsync(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -499,32 +596,31 @@ public async Task UnlinkAsync(string resourceGroupName, string serverN { throw new ArgumentNullException(nameof(linkId)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateUnlinkRequest(resourceGroupName, serverName, databaseName, linkId, parameters); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, linkId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 202: - case 204: - return message.Response; + case 200: + { + ReplicationLink value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ReplicationLink.DeserializeReplicationLink(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Deletes a database replication link in forced or friendly way. + /// Gets a replication link. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database that has the replication link to be failed over. - /// The ID of the replication link to be failed over. - /// The required parameters for unlinking replication link. + /// The name of the database. + /// The name of the replication link. /// The cancellation token to use. - /// , , , , or is null. - public Response Unlink(string resourceGroupName, string serverName, string databaseName, string linkId, UnlinkParameters parameters, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -542,24 +638,24 @@ public Response Unlink(string resourceGroupName, string serverName, string datab { throw new ArgumentNullException(nameof(linkId)); } - if (parameters == null) - { - throw new ArgumentNullException(nameof(parameters)); - } - using var message = CreateUnlinkRequest(resourceGroupName, serverName, databaseName, linkId, parameters); + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, linkId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 202: - case 204: - return message.Response; + case 200: + { + ReplicationLink value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ReplicationLink.DeserializeReplicationLink(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -572,23 +668,103 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); uri.AppendPath("/replicationLinks", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Lists a database's replication links. + /// Gets a list of replication links. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to retrieve links for. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ReplicationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of replication links. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ReplicationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of replication links on database. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -602,7 +778,7 @@ public async Task> ListByDatabaseAsync(strin throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -618,14 +794,19 @@ public async Task> ListByDatabaseAsync(strin } } - /// Lists a database's replication links. + /// Gets a list of replication links on database. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database to retrieve links for. + /// The name of the database. /// The cancellation token to use. - /// , , or is null. - public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -639,7 +820,94 @@ public Response ListByDatabase(string resourceGroupNa throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ReplicationLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of replication links. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ReplicationLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ReplicationLinkListResult.DeserializeReplicationLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of replication links. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations.cs index bc4063b45bb9b..58a1e69d5e822 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations.cs @@ -43,7 +43,7 @@ internal HttpMessage CreateListRequest() var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/providers/Microsoft.Sql/operations", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs index fb97cf67019be..74b5a94eada52 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs @@ -39,18 +39,18 @@ internal RestorableDroppedDatabasesOperations(ClientDiagnostics clientDiagnostic _pipeline = pipeline; } - /// Gets a deleted database that can be restored. + /// Gets a restorable dropped database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat. + /// The String to use. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, string restorableDroppededDatabaseId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string restorableDroppedDatabaseId, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("RestorableDroppedDatabasesOperations.Get"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, serverName, restorableDroppededDatabaseId, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, serverName, restorableDroppedDatabaseId, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -59,18 +59,18 @@ public virtual async Task> GetAsync(string r } } - /// Gets a deleted database that can be restored. + /// Gets a restorable dropped database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat. + /// The String to use. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, string restorableDroppededDatabaseId, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string serverName, string restorableDroppedDatabaseId, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("RestorableDroppedDatabasesOperations.Get"); scope.Start(); try { - return RestClient.Get(resourceGroupName, serverName, restorableDroppededDatabaseId, cancellationToken); + return RestClient.Get(resourceGroupName, serverName, restorableDroppedDatabaseId, cancellationToken); } catch (Exception e) { @@ -79,7 +79,7 @@ public virtual Response Get(string resourceGroupName, } } - /// Gets a list of deleted databases that can be restored. + /// Gets a list of restorable dropped databases. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. @@ -102,7 +102,7 @@ async Task> FirstPageFunc(int? pageSizeHint) try { var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -110,10 +110,25 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableDroppedDatabasesOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Gets a list of deleted databases that can be restored. + /// Gets a list of restorable dropped databases. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. @@ -136,7 +151,22 @@ Page FirstPageFunc(int? pageSizeHint) try { var response = RestClient.ListByServer(resourceGroupName, serverName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorableDroppedDatabasesOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -144,7 +174,7 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabasesRestOperations.cs index 37e8e986ab3e1..a465874adcf76 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedDatabasesRestOperations.cs @@ -43,7 +43,91 @@ public RestorableDroppedDatabasesRestOperations(ClientDiagnostics clientDiagnost _pipeline = pipeline; } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string restorableDroppededDatabaseId) + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/restorableDroppedDatabases", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of restorable dropped databases. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorableDroppedDatabaseListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorableDroppedDatabaseListResult.DeserializeRestorableDroppedDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of restorable dropped databases. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorableDroppedDatabaseListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorableDroppedDatabaseListResult.DeserializeRestorableDroppedDatabaseListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string restorableDroppedDatabaseId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -57,20 +141,20 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/restorableDroppedDatabases/", false); - uri.AppendPath(restorableDroppededDatabaseId, true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath(restorableDroppedDatabaseId, true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a deleted database that can be restored. + /// Gets a restorable dropped database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat. + /// The String to use. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string restorableDroppededDatabaseId, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string restorableDroppedDatabaseId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -80,12 +164,12 @@ public async Task> GetAsync(string resourceG { throw new ArgumentNullException(nameof(serverName)); } - if (restorableDroppededDatabaseId == null) + if (restorableDroppedDatabaseId == null) { - throw new ArgumentNullException(nameof(restorableDroppededDatabaseId)); + throw new ArgumentNullException(nameof(restorableDroppedDatabaseId)); } - using var message = CreateGetRequest(resourceGroupName, serverName, restorableDroppededDatabaseId); + using var message = CreateGetRequest(resourceGroupName, serverName, restorableDroppedDatabaseId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -101,13 +185,13 @@ public async Task> GetAsync(string resourceG } } - /// Gets a deleted database that can be restored. + /// Gets a restorable dropped database. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The id of the deleted database in the form of databaseName,deletionTimeInFileTimeFormat. + /// The String to use. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string serverName, string restorableDroppededDatabaseId, CancellationToken cancellationToken = default) + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string restorableDroppedDatabaseId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -117,12 +201,12 @@ public Response Get(string resourceGroupName, string { throw new ArgumentNullException(nameof(serverName)); } - if (restorableDroppededDatabaseId == null) + if (restorableDroppedDatabaseId == null) { - throw new ArgumentNullException(nameof(restorableDroppededDatabaseId)); + throw new ArgumentNullException(nameof(restorableDroppedDatabaseId)); } - using var message = CreateGetRequest(resourceGroupName, serverName, restorableDroppededDatabaseId); + using var message = CreateGetRequest(resourceGroupName, serverName, restorableDroppedDatabaseId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -138,33 +222,31 @@ public Response Get(string resourceGroupName, string } } - internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/servers/", false); - uri.AppendPath(serverName, true); - uri.AppendPath("/restorableDroppedDatabases", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a list of deleted databases that can be restored. + /// Gets a list of restorable dropped databases. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. - /// or is null. - public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -174,7 +256,7 @@ public async Task> ListByServerAsy throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateListByServerRequest(resourceGroupName, serverName); + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -190,13 +272,18 @@ public async Task> ListByServerAsy } } - /// Gets a list of deleted databases that can be restored. + /// Gets a list of restorable dropped databases. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. - /// or is null. - public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -206,7 +293,7 @@ public Response ListByServer(string resourc throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateListByServerRequest(resourceGroupName, serverName); + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabasesRestOperations.cs index 284ba6b1c5b54..d0746c50443ee 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabasesRestOperations.cs @@ -57,7 +57,7 @@ internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, strin uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); uri.AppendPath(managedInstanceName, true); uri.AppendPath("/restorableDroppedDatabases", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +142,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string managedIn uri.AppendPath(managedInstanceName, true); uri.AppendPath("/restorableDroppedDatabases/", false); uri.AppendPath(restorableDroppedDatabaseId, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorePointsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorePointsOperations.cs index a8b56f4b90114..8efdc47c5c12f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorePointsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorePointsOperations.cs @@ -151,7 +151,7 @@ async Task> FirstPageFunc(int? pageSizeHint) try { var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -159,7 +159,22 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorePointsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// Gets a list of database restore points. @@ -190,7 +205,22 @@ Page FirstPageFunc(int? pageSizeHint) try { var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("RestorePointsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -198,7 +228,7 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// Creates a restore point for a data warehouse. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorePointsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorePointsRestOperations.cs index 4d3aa2fef7182..6119d991f2a76 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorePointsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorePointsRestOperations.cs @@ -59,7 +59,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/restorePoints", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -155,7 +155,7 @@ internal HttpMessage CreateCreateRequest(string resourceGroupName, string server uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/restorePoints", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -260,7 +260,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/restorePoints/", false); uri.AppendPath(restorePointName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -367,7 +367,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(databaseName, true); uri.AppendPath("/restorePoints/", false); uri.AppendPath(restorePointName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -445,5 +445,102 @@ public Response Delete(string resourceGroupName, string serverName, string datab throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of database restore points. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RestorePointListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RestorePointListResult.DeserializeRestorePointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of database restore points. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RestorePointListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RestorePointListResult.DeserializeRestorePointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SensitivityLabelsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SensitivityLabelsOperations.cs index e0749819b86d3..d094a530dddd6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SensitivityLabelsOperations.cs @@ -39,6 +39,48 @@ internal SensitivityLabelsOperations(ClientDiagnostics clientDiagnostics, HttpPi _pipeline = pipeline; } + /// Update sensitivity labels of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + public virtual async Task UpdateAsync(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SensitivityLabelsOperations.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update sensitivity labels of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SensitivityLabelsOperations.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, serverName, databaseName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. @@ -277,10 +319,12 @@ public virtual Response Delete(string resourceGroupName, string serverName, stri /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual AsyncPageable ListCurrentByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListCurrentByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -301,7 +345,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, filter, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, skipToken, count, filter, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -316,7 +360,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi scope.Start(); try { - var response = await RestClient.ListCurrentByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, filter, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListCurrentByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, skipToken, count, filter, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -332,10 +376,12 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual Pageable ListCurrentByDatabase(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public virtual Pageable ListCurrentByDatabase(string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -356,7 +402,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListCurrentByDatabase(resourceGroupName, serverName, databaseName, filter, cancellationToken); + var response = RestClient.ListCurrentByDatabase(resourceGroupName, serverName, databaseName, skipToken, count, filter, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -371,7 +417,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListCurrentByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, filter, cancellationToken); + var response = RestClient.ListCurrentByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, skipToken, count, filter, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -387,12 +433,12 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual AsyncPageable ListRecommendedByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListRecommendedByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -413,7 +459,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListRecommendedByDatabaseAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListRecommendedByDatabaseAsync(resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -428,7 +474,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi scope.Start(); try { - var response = await RestClient.ListRecommendedByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListRecommendedByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -444,12 +490,12 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHi /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public virtual Pageable ListRecommendedByDatabase(string resourceGroupName, string serverName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public virtual Pageable ListRecommendedByDatabase(string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -470,7 +516,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListRecommendedByDatabase(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter, cancellationToken); + var response = RestClient.ListRecommendedByDatabase(resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -485,7 +531,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListRecommendedByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter, cancellationToken); + var response = RestClient.ListRecommendedByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SensitivityLabelsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SensitivityLabelsRestOperations.cs index 667a77b181b54..a809c8a64592d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SensitivityLabelsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SensitivityLabelsRestOperations.cs @@ -43,7 +43,7 @@ public SensitivityLabelsRestOperations(ClientDiagnostics clientDiagnostics, Http _pipeline = pipeline; } - internal HttpMessage CreateListCurrentByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, string filter) + internal HttpMessage CreateListCurrentByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, string skipToken, bool? count, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -59,11 +59,19 @@ internal HttpMessage CreateListCurrentByDatabaseRequest(string resourceGroupName uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/currentSensitivityLabels", false); + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + if (count != null) + { + uri.AppendQuery("$count", count.Value, true); + } if (filter != null) { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -73,10 +81,12 @@ internal HttpMessage CreateListCurrentByDatabaseRequest(string resourceGroupName /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public async Task> ListCurrentByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListCurrentByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -91,7 +101,7 @@ public async Task> ListCurrentByDatabaseAsy throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListCurrentByDatabaseRequest(resourceGroupName, serverName, databaseName, filter); + using var message = CreateListCurrentByDatabaseRequest(resourceGroupName, serverName, databaseName, skipToken, count, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -111,10 +121,12 @@ public async Task> ListCurrentByDatabaseAsy /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public Response ListCurrentByDatabase(string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public Response ListCurrentByDatabase(string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -129,7 +141,7 @@ public Response ListCurrentByDatabase(string resourc throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListCurrentByDatabaseRequest(resourceGroupName, serverName, databaseName, filter); + using var message = CreateListCurrentByDatabaseRequest(resourceGroupName, serverName, databaseName, skipToken, count, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -145,11 +157,11 @@ public Response ListCurrentByDatabase(string resourc } } - internal HttpMessage CreateListRecommendedByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, bool? includeDisabledRecommendations, string skipToken, string filter) + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -160,20 +172,119 @@ internal HttpMessage CreateListRecommendedByDatabaseRequest(string resourceGroup uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/recommendedSensitivityLabels", false); - if (includeDisabledRecommendations != null) + uri.AppendPath("/currentSensitivityLabels", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Update sensitivity labels of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateAsync(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) { - uri.AppendQuery("includeDisabledRecommendations", includeDisabledRecommendations.Value, true); + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update sensitivity labels of a given database using an operations batch. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the database. + /// The SensitivityLabelUpdateList to use. + /// The cancellation token to use. + /// , , , or is null. + public Response Update(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateUpdateRequest(resourceGroupName, serverName, databaseName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); } + } + + internal HttpMessage CreateListRecommendedByDatabaseRequest(string resourceGroupName, string serverName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/recommendedSensitivityLabels", false); if (skipToken != null) { uri.AppendQuery("$skipToken", skipToken, true); } + if (includeDisabledRecommendations != null) + { + uri.AppendQuery("includeDisabledRecommendations", includeDisabledRecommendations.Value, true); + } if (filter != null) { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -183,12 +294,12 @@ internal HttpMessage CreateListRecommendedByDatabaseRequest(string resourceGroup /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public async Task> ListRecommendedByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListRecommendedByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -203,7 +314,7 @@ public async Task> ListRecommendedByDatabas throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListRecommendedByDatabaseRequest(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter); + using var message = CreateListRecommendedByDatabaseRequest(resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -223,12 +334,12 @@ public async Task> ListRecommendedByDatabas /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , or is null. - public Response ListRecommendedByDatabase(string resourceGroupName, string serverName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListRecommendedByDatabase(string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -243,7 +354,7 @@ public Response ListRecommendedByDatabase(string res throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListRecommendedByDatabaseRequest(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter); + using var message = CreateListRecommendedByDatabaseRequest(resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -283,7 +394,7 @@ internal HttpMessage CreateEnableRecommendationRequest(string resourceGroupName, uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath("recommended", true); uri.AppendPath("/enable", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -406,7 +517,7 @@ internal HttpMessage CreateDisableRecommendationRequest(string resourceGroupName uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath("recommended", true); uri.AppendPath("/disable", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -528,7 +639,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath(sensitivityLabelSource.ToSerialString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -663,7 +774,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath("current", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -812,7 +923,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(columnName, true); uri.AppendPath("/sensitivityLabels/", false); uri.AppendPath("current", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -911,7 +1022,7 @@ public Response Delete(string resourceGroupName, string serverName, string datab } } - internal HttpMessage CreateListCurrentByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter) + internal HttpMessage CreateListCurrentByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string skipToken, bool? count, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -929,10 +1040,12 @@ internal HttpMessage CreateListCurrentByDatabaseNextPageRequest(string nextLink, /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. - public async Task> ListCurrentByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListCurrentByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -951,7 +1064,7 @@ public async Task> ListCurrentByDatabaseNex throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListCurrentByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, filter); + using var message = CreateListCurrentByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, skipToken, count, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -972,10 +1085,12 @@ public async Task> ListCurrentByDatabaseNex /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. + /// The String to use. + /// The Boolean to use. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. - public Response ListCurrentByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string filter = null, CancellationToken cancellationToken = default) + public Response ListCurrentByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? count = null, string filter = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -994,7 +1109,7 @@ public Response ListCurrentByDatabaseNextPage(string throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListCurrentByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, filter); + using var message = CreateListCurrentByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, skipToken, count, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1010,7 +1125,7 @@ public Response ListCurrentByDatabaseNextPage(string } } - internal HttpMessage CreateListRecommendedByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, bool? includeDisabledRecommendations, string skipToken, string filter) + internal HttpMessage CreateListRecommendedByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string skipToken, bool? includeDisabledRecommendations, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1028,12 +1143,12 @@ internal HttpMessage CreateListRecommendedByDatabaseNextPageRequest(string nextL /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. - public async Task> ListRecommendedByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListRecommendedByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -1052,7 +1167,7 @@ public async Task> ListRecommendedByDatabas throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListRecommendedByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter); + using var message = CreateListRecommendedByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1073,12 +1188,12 @@ public async Task> ListRecommendedByDatabas /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the database. - /// Specifies whether to include disabled recommendations or not. /// The String to use. + /// Specifies whether to include disabled recommendations or not. /// An OData filter expression that filters elements in the collection. /// The cancellation token to use. /// , , , or is null. - public Response ListRecommendedByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, bool? includeDisabledRecommendations = null, string skipToken = null, string filter = null, CancellationToken cancellationToken = default) + public Response ListRecommendedByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string skipToken = null, bool? includeDisabledRecommendations = null, string filter = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -1097,7 +1212,7 @@ public Response ListRecommendedByDatabaseNextPage(st throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateListRecommendedByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter); + using var message = CreateListRecommendedByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvisorsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvisorsOperations.cs new file mode 100644 index 0000000000000..c70c847a6eebd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvisorsOperations.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ServerAdvisors service client. + public partial class ServerAdvisorsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ServerAdvisorsRestOperations RestClient { get; } + + /// Initializes a new instance of ServerAdvisorsOperations for mocking. + protected ServerAdvisorsOperations() + { + } + + /// Initializes a new instance of ServerAdvisorsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ServerAdvisorsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ServerAdvisorsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a list of server advisors. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The child resources to include in the response. + /// The cancellation token to use. + public virtual async Task>> ListByServerAsync(string resourceGroupName, string serverName, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServerAdvisorsOperations.ListByServer"); + scope.Start(); + try + { + return await RestClient.ListByServerAsync(resourceGroupName, serverName, expand, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of server advisors. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The child resources to include in the response. + /// The cancellation token to use. + public virtual Response> ListByServer(string resourceGroupName, string serverName, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServerAdvisorsOperations.ListByServer"); + scope.Start(); + try + { + return RestClient.ListByServer(resourceGroupName, serverName, expand, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a server advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the Server Advisor. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string advisorName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServerAdvisorsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, serverName, advisorName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a server advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the Server Advisor. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string serverName, string advisorName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServerAdvisorsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, serverName, advisorName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a server advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the Server Advisor. + /// The requested advisor resource state. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(string resourceGroupName, string serverName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServerAdvisorsOperations.Update"); + scope.Start(); + try + { + return await RestClient.UpdateAsync(resourceGroupName, serverName, advisorName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Updates a server advisor. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the Server Advisor. + /// The requested advisor resource state. + /// The cancellation token to use. + public virtual Response Update(string resourceGroupName, string serverName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServerAdvisorsOperations.Update"); + scope.Start(); + try + { + return RestClient.Update(resourceGroupName, serverName, advisorName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedElasticPoolsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvisorsRestOperations.cs similarity index 65% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedElasticPoolsRestOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvisorsRestOperations.cs index 534a709442bbb..3041b17b6a616 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedElasticPoolsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAdvisorsRestOperations.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -16,20 +17,20 @@ namespace Azure.ResourceManager.Sql { - internal partial class RecommendedElasticPoolsRestOperations + internal partial class ServerAdvisorsRestOperations { private string subscriptionId; private Uri endpoint; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; - /// Initializes a new instance of RecommendedElasticPoolsRestOperations. + /// Initializes a new instance of ServerAdvisorsRestOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. /// is null. - public RecommendedElasticPoolsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + public ServerAdvisorsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { if (subscriptionId == null) { @@ -43,7 +44,7 @@ public RecommendedElasticPoolsRestOperations(ClientDiagnostics clientDiagnostics _pipeline = pipeline; } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string recommendedElasticPoolName) + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -56,21 +57,24 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/recommendedElasticPools/", false); - uri.AppendPath(recommendedElasticPoolName, true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/advisors", false); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the recommended elastic pool to be retrieved. + /// The child resources to include in the response. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default) + /// or is null. + public async Task>> ListByServerAsync(string resourceGroupName, string serverName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -80,20 +84,21 @@ public async Task> GetAsync(string resourceGrou { throw new ArgumentNullException(nameof(serverName)); } - if (recommendedElasticPoolName == null) - { - throw new ArgumentNullException(nameof(recommendedElasticPoolName)); - } - using var message = CreateGetRequest(resourceGroupName, serverName, recommendedElasticPoolName); + using var message = CreateListByServerRequest(resourceGroupName, serverName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RecommendedElasticPool value = default; + IReadOnlyList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RecommendedElasticPool.DeserializeRecommendedElasticPool(document.RootElement); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(Advisor.DeserializeAdvisor(item)); + } + value = array; return Response.FromValue(value, message.Response); } default: @@ -101,13 +106,13 @@ public async Task> GetAsync(string resourceGrou } } - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the recommended elastic pool to be retrieved. + /// The child resources to include in the response. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default) + /// or is null. + public Response> ListByServer(string resourceGroupName, string serverName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -117,20 +122,21 @@ public Response Get(string resourceGroupName, string ser { throw new ArgumentNullException(nameof(serverName)); } - if (recommendedElasticPoolName == null) - { - throw new ArgumentNullException(nameof(recommendedElasticPoolName)); - } - using var message = CreateGetRequest(resourceGroupName, serverName, recommendedElasticPoolName); + using var message = CreateListByServerRequest(resourceGroupName, serverName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RecommendedElasticPool value = default; + IReadOnlyList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RecommendedElasticPool.DeserializeRecommendedElasticPool(document.RootElement); + List array = new List(); + foreach (var item in document.RootElement.EnumerateArray()) + { + array.Add(Advisor.DeserializeAdvisor(item)); + } + value = array; return Response.FromValue(value, message.Response); } default: @@ -138,7 +144,7 @@ public Response Get(string resourceGroupName, string ser } } - internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string advisorName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -151,19 +157,21 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/recommendedElasticPools", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/advisors/", false); + uri.AppendPath(advisorName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Returns recommended elastic pools. + /// Gets a server advisor. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the Server Advisor. /// The cancellation token to use. - /// or is null. - public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string advisorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -173,16 +181,20 @@ public async Task> ListByServerAsync( { throw new ArgumentNullException(nameof(serverName)); } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } - using var message = CreateListByServerRequest(resourceGroupName, serverName); + using var message = CreateGetRequest(resourceGroupName, serverName, advisorName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RecommendedElasticPoolListResult value = default; + Advisor value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RecommendedElasticPoolListResult.DeserializeRecommendedElasticPoolListResult(document.RootElement); + value = Advisor.DeserializeAdvisor(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -190,12 +202,13 @@ public async Task> ListByServerAsync( } } - /// Returns recommended elastic pools. + /// Gets a server advisor. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The name of the Server Advisor. /// The cancellation token to use. - /// or is null. - public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string advisorName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -205,16 +218,20 @@ public Response ListByServer(string resourceGr { throw new ArgumentNullException(nameof(serverName)); } + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } - using var message = CreateListByServerRequest(resourceGroupName, serverName); + using var message = CreateGetRequest(resourceGroupName, serverName, advisorName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RecommendedElasticPoolListResult value = default; + Advisor value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RecommendedElasticPoolListResult.DeserializeRecommendedElasticPoolListResult(document.RootElement); + value = Advisor.DeserializeAdvisor(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -222,11 +239,11 @@ public Response ListByServer(string resourceGr } } - internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string serverName, string recommendedElasticPoolName) + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string serverName, string advisorName, Advisor parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); @@ -235,22 +252,26 @@ internal HttpMessage CreateListMetricsRequest(string resourceGroupName, string s uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/recommendedElasticPools/", false); - uri.AppendPath(recommendedElasticPoolName, true); - uri.AppendPath("/metrics", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/advisors/", false); + uri.AppendPath(advisorName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; return message; } - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the recommended elastic pool to be retrieved. + /// The name of the Server Advisor. + /// The requested advisor resource state. /// The cancellation token to use. - /// , , or is null. - public async Task> ListMetricsAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> UpdateAsync(string resourceGroupName, string serverName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -260,20 +281,24 @@ public async Task> ListMetrics { throw new ArgumentNullException(nameof(serverName)); } - if (recommendedElasticPoolName == null) + if (advisorName == null) { - throw new ArgumentNullException(nameof(recommendedElasticPoolName)); + throw new ArgumentNullException(nameof(advisorName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateListMetricsRequest(resourceGroupName, serverName, recommendedElasticPoolName); + using var message = CreateUpdateRequest(resourceGroupName, serverName, advisorName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RecommendedElasticPoolListMetricsResult value = default; + Advisor value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RecommendedElasticPoolListMetricsResult.DeserializeRecommendedElasticPoolListMetricsResult(document.RootElement); + value = Advisor.DeserializeAdvisor(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -281,13 +306,14 @@ public async Task> ListMetrics } } - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the recommended elastic pool to be retrieved. + /// The name of the Server Advisor. + /// The requested advisor resource state. /// The cancellation token to use. - /// , , or is null. - public Response ListMetrics(string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Update(string resourceGroupName, string serverName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -297,20 +323,24 @@ public Response ListMetrics(string reso { throw new ArgumentNullException(nameof(serverName)); } - if (recommendedElasticPoolName == null) + if (advisorName == null) + { + throw new ArgumentNullException(nameof(advisorName)); + } + if (parameters == null) { - throw new ArgumentNullException(nameof(recommendedElasticPoolName)); + throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateListMetricsRequest(resourceGroupName, serverName, recommendedElasticPoolName); + using var message = CreateUpdateRequest(resourceGroupName, serverName, advisorName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RecommendedElasticPoolListMetricsResult value = default; + Advisor value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RecommendedElasticPoolListMetricsResult.DeserializeRecommendedElasticPoolListMetricsResult(document.RootElement); + value = Advisor.DeserializeAdvisor(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAutomaticTuningRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAutomaticTuningRestOperations.cs index ff7cc04b4d803..4f16cab7d324e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAutomaticTuningRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAutomaticTuningRestOperations.cs @@ -57,7 +57,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/automaticTuning/current", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -141,7 +141,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/automaticTuning/current", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAzureADAdministratorsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAzureADAdministratorsRestOperations.cs index 7388982e3b10e..fd1c471fc6787 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAzureADAdministratorsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAzureADAdministratorsRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/administrators/", false); uri.AppendPath(administratorName.ToString(), true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -145,7 +145,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/administrators/", false); uri.AppendPath(administratorName.ToString(), true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -240,7 +240,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/administrators/", false); uri.AppendPath(administratorName.ToString(), true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -319,7 +319,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/administrators", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAzureADOnlyAuthenticationsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAzureADOnlyAuthenticationsRestOperations.cs index ddcf206164d4b..4465d65735539 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAzureADOnlyAuthenticationsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerAzureADOnlyAuthenticationsRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/azureADOnlyAuthentications/", false); uri.AppendPath(authenticationName.ToString(), true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -145,7 +145,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/azureADOnlyAuthentications/", false); uri.AppendPath(authenticationName.ToString(), true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -240,7 +240,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/azureADOnlyAuthentications/", false); uri.AppendPath(authenticationName.ToString(), true); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -319,7 +319,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/azureADOnlyAuthentications", false); - uri.AppendQuery("api-version", "2020-02-02-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerBlobAuditingPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerBlobAuditingPoliciesRestOperations.cs index 80e7fb2fcba58..f03c7eb129a1c 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerBlobAuditingPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerBlobAuditingPoliciesRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/auditingSettings/", false); uri.AppendPath("default", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -143,7 +143,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/auditingSettings/", false); uri.AppendPath("default", true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -233,7 +233,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/auditingSettings", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesCreateOrUpdateOperation.cs new file mode 100644 index 0000000000000..b99bfa9cf8e4e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesCreateOrUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Updates a server connection policy. + public partial class ServerConnectionPoliciesCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ServerConnectionPoliciesCreateOrUpdateOperation for mocking. + protected ServerConnectionPoliciesCreateOrUpdateOperation() + { + } + + internal ServerConnectionPoliciesCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServerConnectionPoliciesCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ServerConnectionPolicy Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ServerConnectionPolicy IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ServerConnectionPolicy.DeserializeServerConnectionPolicy(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ServerConnectionPolicy.DeserializeServerConnectionPolicy(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesOperations.cs index 755d9afc8dcae..86a83799aa876 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesOperations.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Azure; +using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager.Sql.Models; @@ -38,19 +39,18 @@ internal ServerConnectionPoliciesOperations(ClientDiagnostics clientDiagnostics, _pipeline = pipeline; } - /// Creates or updates the server's connection policy. + /// Gets a server connection policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the connection policy. - /// The required parameters for updating a secure connection policy. /// The cancellation token to use. - public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.Get"); scope.Start(); try { - return await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, serverName, connectionPolicyName, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -59,19 +59,18 @@ public virtual async Task> CreateOrUpdateAsync( } } - /// Creates or updates the server's connection policy. + /// Gets a server connection policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the connection policy. - /// The required parameters for updating a secure connection policy. /// The cancellation token to use. - public virtual Response CreateOrUpdate(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.Get"); scope.Start(); try { - return RestClient.CreateOrUpdate(resourceGroupName, serverName, connectionPolicyName, parameters, cancellationToken); + return RestClient.Get(resourceGroupName, serverName, connectionPolicyName, cancellationToken); } catch (Exception e) { @@ -80,18 +79,132 @@ public virtual Response CreateOrUpdate(string resourceGr } } - /// Gets the server's secure connection policy. + /// Lists connection policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Lists connection policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServer(resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Updates a server connection policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the connection policy. + /// The required parameters for updating a server connection policy. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.Get"); + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.StartCreateOrUpdate"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, serverName, connectionPolicyName, cancellationToken).ConfigureAwait(false); + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters, cancellationToken).ConfigureAwait(false); + return new ServerConnectionPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, connectionPolicyName, parameters).Request, originalResponse); } catch (Exception e) { @@ -100,18 +213,34 @@ public virtual async Task> GetAsync(string reso } } - /// Gets the server's secure connection policy. + /// Updates a server connection policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the connection policy. + /// The required parameters for updating a server connection policy. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + /// , , or is null. + public virtual ServerConnectionPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.Get"); + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ServerConnectionPoliciesOperations.StartCreateOrUpdate"); scope.Start(); try { - return RestClient.Get(resourceGroupName, serverName, connectionPolicyName, cancellationToken); + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, connectionPolicyName, parameters, cancellationToken); + return new ServerConnectionPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, connectionPolicyName, parameters).Request, originalResponse); } catch (Exception e) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesRestOperations.cs index ff683cbb66bd5..b21115e3f6da7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerConnectionPoliciesRestOperations.cs @@ -43,6 +43,93 @@ public ServerConnectionPoliciesRestOperations(ClientDiagnostics clientDiagnostic _pipeline = pipeline; } + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/connectionPolicies/", false); + uri.AppendPath(connectionPolicyName.ToString(), true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a server connection policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the connection policy. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, connectionPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerConnectionPolicy value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerConnectionPolicy.DeserializeServerConnectionPolicy(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a server connection policy. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the connection policy. + /// The cancellation token to use. + /// or is null. + public Response Get(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, connectionPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerConnectionPolicy value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerConnectionPolicy.DeserializeServerConnectionPolicy(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters) { var message = _pipeline.CreateMessage(); @@ -58,7 +145,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/connectionPolicies/", false); uri.AppendPath(connectionPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -68,14 +155,14 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin return message; } - /// Creates or updates the server's connection policy. + /// Updates a server connection policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the connection policy. - /// The required parameters for updating a secure connection policy. + /// The required parameters for updating a server connection policy. /// The cancellation token to use. /// , , or is null. - public async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -95,26 +182,21 @@ public async Task> CreateOrUpdateAsync(string r switch (message.Response.Status) { case 200: - case 201: - { - ServerConnectionPolicy value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ServerConnectionPolicy.DeserializeServerConnectionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Creates or updates the server's connection policy. + /// Updates a server connection policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The name of the connection policy. - /// The required parameters for updating a secure connection policy. + /// The required parameters for updating a server connection policy. /// The cancellation token to use. /// , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, ServerConnectionPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -134,19 +216,14 @@ public Response CreateOrUpdate(string resourceGroupName, switch (message.Response.Status) { case 200: - case 201: - { - ServerConnectionPolicy value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ServerConnectionPolicy.DeserializeServerConnectionPolicy(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName) + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -159,21 +236,19 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/connectionPolicies/", false); - uri.AppendPath(connectionPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/connectionPolicies", false); + uri.AppendQuery("api-version", "2021-05-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets the server's secure connection policy. + /// Lists connection policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the connection policy. /// The cancellation token to use. /// or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -184,15 +259,15 @@ public async Task> GetAsync(string resourceGrou throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateGetRequest(resourceGroupName, serverName, connectionPolicyName); + using var message = CreateListByServerRequest(resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ServerConnectionPolicy value = default; + ServerConnectionPolicyListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ServerConnectionPolicy.DeserializeServerConnectionPolicy(document.RootElement); + value = ServerConnectionPolicyListResult.DeserializeServerConnectionPolicyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -200,13 +275,12 @@ public async Task> GetAsync(string resourceGrou } } - /// Gets the server's secure connection policy. + /// Lists connection policy. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the connection policy. /// The cancellation token to use. /// or is null. - public Response Get(string resourceGroupName, string serverName, ConnectionPolicyName connectionPolicyName, CancellationToken cancellationToken = default) + public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -217,15 +291,102 @@ public Response Get(string resourceGroupName, string ser throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateGetRequest(resourceGroupName, serverName, connectionPolicyName); + using var message = CreateListByServerRequest(resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ServerConnectionPolicy value = default; + ServerConnectionPolicyListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ServerConnectionPolicy.DeserializeServerConnectionPolicy(document.RootElement); + value = ServerConnectionPolicyListResult.DeserializeServerConnectionPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists connection policy. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerConnectionPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerConnectionPolicyListResult.DeserializeServerConnectionPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists connection policy. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerConnectionPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerConnectionPolicyListResult.DeserializeServerConnectionPolicyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsCreateOrUpdateOperation.cs new file mode 100644 index 0000000000000..1e666dbfc5d24 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsCreateOrUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Creates or updates a server's DevOps audit settings. + public partial class ServerDevOpsAuditSettingsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ServerDevOpsAuditSettingsCreateOrUpdateOperation for mocking. + protected ServerDevOpsAuditSettingsCreateOrUpdateOperation() + { + } + + internal ServerDevOpsAuditSettingsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.AzureAsyncOperation, "ServerDevOpsAuditSettingsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ServerDevOpsAuditingSettings Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ServerDevOpsAuditingSettings IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ServerDevOpsAuditingSettings.DeserializeServerDevOpsAuditingSettings(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ServerDevOpsAuditingSettings.DeserializeServerDevOpsAuditingSettings(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedElasticPoolsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs similarity index 50% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedElasticPoolsOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs index 08c062ce76046..f1f9209e01fbb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RecommendedElasticPoolsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs @@ -15,42 +15,42 @@ namespace Azure.ResourceManager.Sql { - /// The RecommendedElasticPools service client. - public partial class RecommendedElasticPoolsOperations + /// The ServerDevOpsAuditSettings service client. + public partial class ServerDevOpsAuditSettingsOperations { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; - internal RecommendedElasticPoolsRestOperations RestClient { get; } + internal ServerDevOpsAuditSettingsRestOperations RestClient { get; } - /// Initializes a new instance of RecommendedElasticPoolsOperations for mocking. - protected RecommendedElasticPoolsOperations() + /// Initializes a new instance of ServerDevOpsAuditSettingsOperations for mocking. + protected ServerDevOpsAuditSettingsOperations() { } - /// Initializes a new instance of RecommendedElasticPoolsOperations. + /// Initializes a new instance of ServerDevOpsAuditSettingsOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. - internal RecommendedElasticPoolsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + internal ServerDevOpsAuditSettingsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { - RestClient = new RecommendedElasticPoolsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new ServerDevOpsAuditSettingsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } - /// Gets a recommended elastic pool. + /// Gets a server's DevOps audit settings. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the recommended elastic pool to be retrieved. + /// The name of the devops audit settings. This should always be 'default'. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("RecommendedElasticPoolsOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("ServerDevOpsAuditSettingsOperations.Get"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, serverName, recommendedElasticPoolName, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -59,18 +59,18 @@ public virtual async Task> GetAsync(string reso } } - /// Gets a recommended elastic pool. + /// Gets a server's DevOps audit settings. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the recommended elastic pool to be retrieved. + /// The name of the devops audit settings. This should always be 'default'. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("RecommendedElasticPoolsOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("ServerDevOpsAuditSettingsOperations.Get"); scope.Start(); try { - return RestClient.Get(resourceGroupName, serverName, recommendedElasticPoolName, cancellationToken); + return RestClient.Get(resourceGroupName, serverName, devOpsAuditingSettingsName, cancellationToken); } catch (Exception e) { @@ -79,12 +79,12 @@ public virtual Response Get(string resourceGroupName, st } } - /// Returns recommended elastic pools. + /// Lists DevOps audit settings of a server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. /// or is null. - public virtual AsyncPageable ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -95,14 +95,14 @@ public virtual AsyncPageable ListByServerAsync(string re throw new ArgumentNullException(nameof(serverName)); } - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("RecommendedElasticPoolsOperations.ListByServer"); + using var scope = _clientDiagnostics.CreateScope("ServerDevOpsAuditSettingsOperations.ListByServer"); scope.Start(); try { var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -110,15 +110,30 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerDevOpsAuditSettingsOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Returns recommended elastic pools. + /// Lists DevOps audit settings of a server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. /// The cancellation token to use. /// or is null. - public virtual Pageable ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public virtual Pageable ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -129,14 +144,14 @@ public virtual Pageable ListByServer(string resourceGrou throw new ArgumentNullException(nameof(serverName)); } - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("RecommendedElasticPoolsOperations.ListByServer"); + using var scope = _clientDiagnostics.CreateScope("ServerDevOpsAuditSettingsOperations.ListByServer"); scope.Start(); try { var response = RestClient.ListByServer(resourceGroupName, serverName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -144,16 +159,32 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerDevOpsAuditSettingsOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Returns recommended elastic pool metrics. + /// Creates or updates a server's DevOps audit settings. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the recommended elastic pool to be retrieved. + /// The name of the devops audit settings. This should always be 'default'. + /// Properties of DevOps audit settings. /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListMetricsAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default) + /// , , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, ServerDevOpsAuditingSettings parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -163,36 +194,37 @@ public virtual AsyncPageable ListMetricsAsync(stri { throw new ArgumentNullException(nameof(serverName)); } - if (recommendedElasticPoolName == null) + if (devOpsAuditingSettingsName == null) { - throw new ArgumentNullException(nameof(recommendedElasticPoolName)); + throw new ArgumentNullException(nameof(devOpsAuditingSettingsName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); } - async Task> FirstPageFunc(int? pageSizeHint) + using var scope = _clientDiagnostics.CreateScope("ServerDevOpsAuditSettingsOperations.StartCreateOrUpdate"); + scope.Start(); + try { - using var scope = _clientDiagnostics.CreateScope("RecommendedElasticPoolsOperations.ListMetrics"); - scope.Start(); - try - { - var response = await RestClient.ListMetricsAsync(resourceGroupName, serverName, recommendedElasticPoolName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, cancellationToken).ConfigureAwait(false); + return new ServerDevOpsAuditSettingsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); } - /// Returns recommended elastic pool metrics. + /// Creates or updates a server's DevOps audit settings. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the recommended elastic pool to be retrieved. + /// The name of the devops audit settings. This should always be 'default'. + /// Properties of DevOps audit settings. /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListMetrics(string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default) + /// , , , or is null. + public virtual ServerDevOpsAuditSettingsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, ServerDevOpsAuditingSettings parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -202,27 +234,27 @@ public virtual Pageable ListMetrics(string resourc { throw new ArgumentNullException(nameof(serverName)); } - if (recommendedElasticPoolName == null) + if (devOpsAuditingSettingsName == null) { - throw new ArgumentNullException(nameof(recommendedElasticPoolName)); + throw new ArgumentNullException(nameof(devOpsAuditingSettingsName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); } - Page FirstPageFunc(int? pageSizeHint) + using var scope = _clientDiagnostics.CreateScope("ServerDevOpsAuditSettingsOperations.StartCreateOrUpdate"); + scope.Start(); + try { - using var scope = _clientDiagnostics.CreateScope("RecommendedElasticPoolsOperations.ListMetrics"); - scope.Start(); - try - { - var response = RestClient.ListMetrics(resourceGroupName, serverName, recommendedElasticPoolName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, cancellationToken); + return new ServerDevOpsAuditSettingsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsRestOperations.cs new file mode 100644 index 0000000000000..c6258a1d840e3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDevOpsAuditSettingsRestOperations.cs @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ServerDevOpsAuditSettingsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ServerDevOpsAuditSettingsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ServerDevOpsAuditSettingsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string devOpsAuditingSettingsName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/devOpsAuditingSettings/", false); + uri.AppendPath(devOpsAuditingSettingsName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a server's DevOps audit settings. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the devops audit settings. This should always be 'default'. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (devOpsAuditingSettingsName == null) + { + throw new ArgumentNullException(nameof(devOpsAuditingSettingsName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, devOpsAuditingSettingsName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerDevOpsAuditingSettings value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerDevOpsAuditingSettings.DeserializeServerDevOpsAuditingSettings(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a server's DevOps audit settings. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the devops audit settings. This should always be 'default'. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (devOpsAuditingSettingsName == null) + { + throw new ArgumentNullException(nameof(devOpsAuditingSettingsName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, devOpsAuditingSettingsName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerDevOpsAuditingSettings value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerDevOpsAuditingSettings.DeserializeServerDevOpsAuditingSettings(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, ServerDevOpsAuditingSettings parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/devOpsAuditingSettings/", false); + uri.AppendPath(devOpsAuditingSettingsName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates or updates a server's DevOps audit settings. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the devops audit settings. This should always be 'default'. + /// Properties of DevOps audit settings. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, ServerDevOpsAuditingSettings parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (devOpsAuditingSettingsName == null) + { + throw new ArgumentNullException(nameof(devOpsAuditingSettingsName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates or updates a server's DevOps audit settings. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the devops audit settings. This should always be 'default'. + /// Properties of DevOps audit settings. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string serverName, string devOpsAuditingSettingsName, ServerDevOpsAuditingSettings parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (devOpsAuditingSettingsName == null) + { + throw new ArgumentNullException(nameof(devOpsAuditingSettingsName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/devOpsAuditingSettings", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists DevOps audit settings of a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerDevOpsAuditSettingsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerDevOpsAuditSettingsListResult.DeserializeServerDevOpsAuditSettingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists DevOps audit settings of a server. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// or is null. + public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerRequest(resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerDevOpsAuditSettingsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerDevOpsAuditSettingsListResult.DeserializeServerDevOpsAuditSettingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists DevOps audit settings of a server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerDevOpsAuditSettingsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerDevOpsAuditSettingsListResult.DeserializeServerDevOpsAuditSettingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists DevOps audit settings of a server. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The cancellation token to use. + /// , , or is null. + public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerDevOpsAuditSettingsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerDevOpsAuditSettingsListResult.DeserializeServerDevOpsAuditSettingsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesAcquireOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesAcquireOperation.cs index 7c05a03cf1bf2..d8fed39fa5b5d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesAcquireOperation.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesAcquireOperation.cs @@ -6,18 +6,20 @@ #nullable disable using System; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql { /// Acquires server DNS alias from another server. - public partial class ServerDnsAliasesAcquireOperation : Operation, IOperationSource + public partial class ServerDnsAliasesAcquireOperation : Operation, IOperationSource { - private readonly ArmOperationHelpers _operation; + private readonly ArmOperationHelpers _operation; /// Initializes a new instance of ServerDnsAliasesAcquireOperation for mocking. protected ServerDnsAliasesAcquireOperation() @@ -26,13 +28,13 @@ protected ServerDnsAliasesAcquireOperation() internal ServerDnsAliasesAcquireOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { - _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServerDnsAliasesAcquireOperation"); + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServerDnsAliasesAcquireOperation"); } /// public override string Id => _operation.Id; /// - public override Response Value => _operation.Value; + public override ServerDnsAlias Value => _operation.Value; /// public override bool HasCompleted => _operation.HasCompleted; @@ -50,19 +52,21 @@ internal ServerDnsAliasesAcquireOperation(ClientDiagnostics clientDiagnostics, H public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + ServerDnsAlias IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - return response; + using var document = JsonDocument.Parse(response.ContentStream); + return ServerDnsAlias.DeserializeServerDnsAlias(document.RootElement); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - return await new ValueTask(response).ConfigureAwait(false); + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ServerDnsAlias.DeserializeServerDnsAlias(document.RootElement); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesCreateOrUpdateOperation.cs index 5491bdbf10e0c..53cca23a90a7f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesCreateOrUpdateOperation.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesCreateOrUpdateOperation.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Sql { - /// Creates a server dns alias. + /// Creates a server DNS alias. public partial class ServerDnsAliasesCreateOrUpdateOperation : Operation, IOperationSource { private readonly ArmOperationHelpers _operation; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesOperations.cs index 6f27e5a70af86..6c14a961fb78a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesOperations.cs @@ -42,7 +42,7 @@ internal ServerDnsAliasesOperations(ClientDiagnostics clientDiagnostics, HttpPip /// Gets a server DNS alias. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. public virtual async Task> GetAsync(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) { @@ -62,7 +62,7 @@ public virtual async Task> GetAsync(string resourceGrou /// Gets a server DNS alias. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. public virtual Response Get(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) { @@ -177,10 +177,10 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } - /// Creates a server dns alias. + /// Creates a server DNS alias. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -212,10 +212,10 @@ public virtual async Task StartCreateOr } } - /// Creates a server dns alias. + /// Creates a server DNS alias. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public virtual ServerDnsAliasesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -250,7 +250,7 @@ public virtual ServerDnsAliasesCreateOrUpdateOperation StartCreateOrUpdate(strin /// Deletes the server DNS alias with the given name. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public virtual async Task StartDeleteAsync(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -285,7 +285,7 @@ public virtual async Task StartDeleteAsync(stri /// Deletes the server DNS alias with the given name. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public virtual ServerDnsAliasesDeleteOperation StartDelete(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesRestOperations.cs index 5e7085afa47b3..7a86a2d850224 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDnsAliasesRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/dnsAliases/", false); uri.AppendPath(dnsAliasName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -67,7 +67,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam /// Gets a server DNS alias. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public async Task> GetAsync(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -104,7 +104,7 @@ public async Task> GetAsync(string resourceGroupName, s /// Gets a server DNS alias. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public Response Get(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -153,16 +153,16 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/dnsAliases/", false); uri.AppendPath(dnsAliasName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Creates a server dns alias. + /// Creates a server DNS alias. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -193,10 +193,10 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } } - /// Creates a server dns alias. + /// Creates a server DNS alias. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public Response CreateOrUpdate(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -242,7 +242,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/dnsAliases/", false); uri.AppendPath(dnsAliasName, true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -250,7 +250,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server /// Deletes the server DNS alias with the given name. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public async Task DeleteAsync(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -284,7 +284,7 @@ public async Task DeleteAsync(string resourceGroupName, string serverN /// Deletes the server DNS alias with the given name. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server that the alias is pointing to. - /// The name of the server DNS alias. + /// The name of the server dns alias. /// The cancellation token to use. /// , , or is null. public Response Delete(string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default) @@ -329,7 +329,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/dnsAliases", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -415,8 +415,9 @@ internal HttpMessage CreateAcquireRequest(string resourceGroupName, string serve uri.AppendPath("/dnsAliases/", false); uri.AppendPath(dnsAliasName, true); uri.AppendPath("/acquire", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(parameters); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerKeysOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerKeysOperations.cs index 2d36b274ada71..9639a63317aae 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerKeysOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerKeysOperations.cs @@ -180,7 +180,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// Creates or updates a server key. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + /// 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. /// The requested server key resource state. /// The cancellation token to use. /// , , , or is null. @@ -220,7 +220,7 @@ public virtual async Task StartCreateOrUpdate /// Creates or updates a server key. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + /// 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. /// The requested server key resource state. /// The cancellation token to use. /// , , , or is null. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerKeysRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerKeysRestOperations.cs index fcc799d3c5637..0b6ddfb2989b5 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerKeysRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerKeysRestOperations.cs @@ -57,7 +57,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/keys", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -142,7 +142,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/keys/", false); uri.AppendPath(keyName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -237,7 +237,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/keys/", false); uri.AppendPath(keyName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -250,7 +250,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin /// Creates or updates a server key. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + /// 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. /// The requested server key resource state. /// The cancellation token to use. /// , , , or is null. @@ -289,7 +289,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string /// Creates or updates a server key. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901. + /// 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. /// The requested server key resource state. /// The cancellation token to use. /// , , , or is null. @@ -340,7 +340,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/keys/", false); uri.AppendPath(keyName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerOperations.cs similarity index 50% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerOperations.cs index 847886616ebdb..c1a54b04502ba 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionActivitiesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerOperations.cs @@ -15,38 +15,36 @@ namespace Azure.ResourceManager.Sql { - /// The TransparentDataEncryptionActivities service client. - public partial class TransparentDataEncryptionActivitiesOperations + /// The Server service client. + public partial class ServerOperations { private readonly ClientDiagnostics _clientDiagnostics; private readonly HttpPipeline _pipeline; - internal TransparentDataEncryptionActivitiesRestOperations RestClient { get; } + internal ServerRestOperations RestClient { get; } - /// Initializes a new instance of TransparentDataEncryptionActivitiesOperations for mocking. - protected TransparentDataEncryptionActivitiesOperations() + /// Initializes a new instance of ServerOperations for mocking. + protected ServerOperations() { } - /// Initializes a new instance of TransparentDataEncryptionActivitiesOperations. + /// Initializes a new instance of ServerOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. - internal TransparentDataEncryptionActivitiesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + internal ServerOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { - RestClient = new TransparentDataEncryptionActivitiesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + RestClient = new ServerRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); _clientDiagnostics = clientDiagnostics; _pipeline = pipeline; } - /// Returns a database's transparent data encryption operation result. + /// Gets a list of operations performed on the server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which the transparent data encryption applies. - /// The name of the transparent data encryption configuration. /// The cancellation token to use. - /// , , or is null. - public virtual AsyncPageable ListByConfigurationAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + /// or is null. + public virtual AsyncPageable ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -56,19 +54,30 @@ public virtual AsyncPageable ListByConfigurat { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) + + async Task> FirstPageFunc(int? pageSizeHint) { - throw new ArgumentNullException(nameof(databaseName)); + using var scope = _clientDiagnostics.CreateScope("ServerOperations.ListByServer"); + scope.Start(); + try + { + var response = await RestClient.ListByServerAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - - async Task> FirstPageFunc(int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionActivitiesOperations.ListByConfiguration"); + using var scope = _clientDiagnostics.CreateScope("ServerOperations.ListByServer"); scope.Start(); try { - var response = await RestClient.ListByConfigurationAsync(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + var response = await RestClient.ListByServerNextPageAsync(nextLink, resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -76,17 +85,15 @@ async Task> FirstPageFunc(int? pageSizeH throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } - /// Returns a database's transparent data encryption operation result. + /// Gets a list of operations performed on the server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which the transparent data encryption applies. - /// The name of the transparent data encryption configuration. /// The cancellation token to use. - /// , , or is null. - public virtual Pageable ListByConfiguration(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + /// or is null. + public virtual Pageable ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -96,19 +103,30 @@ public virtual Pageable ListByConfiguration(s { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) + + Page FirstPageFunc(int? pageSizeHint) { - throw new ArgumentNullException(nameof(databaseName)); + using var scope = _clientDiagnostics.CreateScope("ServerOperations.ListByServer"); + scope.Start(); + try + { + var response = RestClient.ListByServer(resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - - Page FirstPageFunc(int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionActivitiesOperations.ListByConfiguration"); + using var scope = _clientDiagnostics.CreateScope("ServerOperations.ListByServer"); scope.Start(); try { - var response = RestClient.ListByConfiguration(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, cancellationToken); - return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); + var response = RestClient.ListByServerNextPage(nextLink, resourceGroupName, serverName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -116,7 +134,7 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerRestOperations.cs similarity index 58% rename from sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsRestOperations.cs rename to sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerRestOperations.cs index 6f12cecafd4dc..ad22b48e4289d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServiceTierAdvisorsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerRestOperations.cs @@ -16,20 +16,20 @@ namespace Azure.ResourceManager.Sql { - internal partial class ServiceTierAdvisorsRestOperations + internal partial class ServerRestOperations { private string subscriptionId; private Uri endpoint; private ClientDiagnostics _clientDiagnostics; private HttpPipeline _pipeline; - /// Initializes a new instance of ServiceTierAdvisorsRestOperations. + /// Initializes a new instance of ServerRestOperations. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The subscription ID that identifies an Azure subscription. /// server parameter. /// is null. - public ServiceTierAdvisorsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + public ServerRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) { if (subscriptionId == null) { @@ -43,7 +43,7 @@ public ServiceTierAdvisorsRestOperations(ClientDiagnostics clientDiagnostics, Ht _pipeline = pipeline; } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName) + internal HttpMessage CreateListByServerRequest(string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -56,24 +56,19 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/serviceTierAdvisors/", false); - uri.AppendPath(serviceTierAdvisorName, true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/operations", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a service tier advisor. + /// Gets a list of operations performed on the server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of database. - /// The name of service tier advisor. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListByServerAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -83,24 +78,16 @@ public async Task> GetAsync(string resourceGroupNam { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - if (serviceTierAdvisorName == null) - { - throw new ArgumentNullException(nameof(serviceTierAdvisorName)); - } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, serviceTierAdvisorName); + using var message = CreateListByServerRequest(resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ServiceTierAdvisor value = default; + ServerOperationListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ServiceTierAdvisor.DeserializeServiceTierAdvisor(document.RootElement); + value = ServerOperationListResult.DeserializeServerOperationListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -108,14 +95,12 @@ public async Task> GetAsync(string resourceGroupNam } } - /// Gets a service tier advisor. + /// Gets a list of operations performed on the server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of database. - /// The name of service tier advisor. /// The cancellation token to use. - /// , , , or is null. - public Response Get(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, CancellationToken cancellationToken = default) + /// or is null. + public Response ListByServer(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -125,24 +110,16 @@ public Response Get(string resourceGroupName, string serverN { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - if (serviceTierAdvisorName == null) - { - throw new ArgumentNullException(nameof(serviceTierAdvisorName)); - } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, serviceTierAdvisorName); + using var message = CreateListByServerRequest(resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ServiceTierAdvisor value = default; + ServerOperationListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ServiceTierAdvisor.DeserializeServiceTierAdvisor(document.RootElement); + value = ServerOperationListResult.DeserializeServerOperationListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -150,36 +127,31 @@ public Response Get(string resourceGroupName, string serverN } } - internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) + internal HttpMessage CreateListByServerNextPageRequest(string nextLink, string resourceGroupName, string serverName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Sql/servers/", false); - uri.AppendPath(serverName, true); - uri.AppendPath("/databases/", false); - uri.AppendPath(databaseName, true); - uri.AppendPath("/serviceTierAdvisors", false); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Returns service tier advisors for specified database. + /// Gets a list of operations performed on the server. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of database. /// The cancellation token to use. - /// , , or is null. - public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListByServerNextPageAsync(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -188,20 +160,16 @@ public async Task> ListByDatabaseAsync(st { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ServiceTierAdvisorListResult value = default; + ServerOperationListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ServiceTierAdvisorListResult.DeserializeServiceTierAdvisorListResult(document.RootElement); + value = ServerOperationListResult.DeserializeServerOperationListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -209,14 +177,18 @@ public async Task> ListByDatabaseAsync(st } } - /// Returns service tier advisors for specified database. + /// Gets a list of operations performed on the server. + /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of database. /// The cancellation token to use. - /// , , or is null. - public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListByServerNextPage(string nextLink, string resourceGroupName, string serverName, CancellationToken cancellationToken = default) { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -225,20 +197,16 @@ public Response ListByDatabase(string resourceGrou { throw new ArgumentNullException(nameof(serverName)); } - if (databaseName == null) - { - throw new ArgumentNullException(nameof(databaseName)); - } - using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + using var message = CreateListByServerNextPageRequest(nextLink, resourceGroupName, serverName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ServiceTierAdvisorListResult value = default; + ServerOperationListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ServiceTierAdvisorListResult.DeserializeServiceTierAdvisorListResult(document.RootElement); + value = ServerOperationListResult.DeserializeServerOperationListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs index e4eaba94c26b5..bee06509d834a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs @@ -44,7 +44,7 @@ internal ServerSecurityAlertPoliciesOperations(ClientDiagnostics clientDiagnosti /// The name of the server. /// The name of the security alert policy. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ServerSecurityAlertPoliciesOperations.Get"); scope.Start(); @@ -64,7 +64,7 @@ public virtual async Task> GetAsync(string r /// The name of the server. /// The name of the security alert policy. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ServerSecurityAlertPoliciesOperations.Get"); scope.Start(); @@ -184,7 +184,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// The server security alert policy. /// The cancellation token to use. /// , , or is null. - public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -220,7 +220,7 @@ public virtual async Task St /// The server security alert policy. /// The cancellation token to use. /// , , or is null. - public virtual ServerSecurityAlertPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + public virtual ServerSecurityAlertPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerSecurityAlertPoliciesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerSecurityAlertPoliciesRestOperations.cs index ac5f4f442f286..31983b7d11bea 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerSecurityAlertPoliciesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerSecurityAlertPoliciesRestOperations.cs @@ -43,7 +43,7 @@ public ServerSecurityAlertPoliciesRestOperations(ClientDiagnostics clientDiagnos _pipeline = pipeline; } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/securityAlertPolicies/", false); uri.AppendPath(securityAlertPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -70,7 +70,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam /// The name of the security alert policy. /// The cancellation token to use. /// or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -103,7 +103,7 @@ public async Task> GetAsync(string resourceG /// The name of the security alert policy. /// The cancellation token to use. /// or is null. - public Response Get(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -130,7 +130,7 @@ public Response Get(string resourceGroupName, string } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ServerSecurityAlertPolicy parameters) + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicy parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -145,7 +145,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/securityAlertPolicies/", false); uri.AppendPath(securityAlertPolicyName.ToString(), true); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -162,7 +162,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin /// The server security alert policy. /// The cancellation token to use. /// , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -196,7 +196,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string /// The server security alert policy. /// The cancellation token to use. /// , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string serverName, SecurityAlertPolicyNameAutoGenerated securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string resourceGroupName, string serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -237,7 +237,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/securityAlertPolicies", false); - uri.AppendQuery("api-version", "2017-03-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsCreateOrUpdateOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsCreateOrUpdateOperation.cs new file mode 100644 index 0000000000000..2f602dbcd7d25 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsCreateOrUpdateOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Creates or updates a server trust group. + public partial class ServerTrustGroupsCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ServerTrustGroupsCreateOrUpdateOperation for mocking. + protected ServerTrustGroupsCreateOrUpdateOperation() + { + } + + internal ServerTrustGroupsCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServerTrustGroupsCreateOrUpdateOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ServerTrustGroup Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ServerTrustGroup IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ServerTrustGroup.DeserializeServerTrustGroup(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ServerTrustGroup.DeserializeServerTrustGroup(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsDeleteOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsDeleteOperation.cs new file mode 100644 index 0000000000000..365e8df5e1e4e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsDeleteOperation.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Sql +{ + /// Deletes a server trust group. + public partial class ServerTrustGroupsDeleteOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ServerTrustGroupsDeleteOperation for mocking. + protected ServerTrustGroupsDeleteOperation() + { + } + + internal ServerTrustGroupsDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServerTrustGroupsDeleteOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override Response Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Response IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + return response; + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + return await new ValueTask(response).ConfigureAwait(false); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsOperations.cs new file mode 100644 index 0000000000000..bec1020dc575b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsOperations.cs @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The ServerTrustGroups service client. + public partial class ServerTrustGroupsOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal ServerTrustGroupsRestOperations RestClient { get; } + + /// Initializes a new instance of ServerTrustGroupsOperations for mocking. + protected ServerTrustGroupsOperations() + { + } + + /// Initializes a new instance of ServerTrustGroupsOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal ServerTrustGroupsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new ServerTrustGroupsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, locationName, serverTrustGroupName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, locationName, serverTrustGroupName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByLocationAsync(string resourceGroupName, string locationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.ListByLocation"); + scope.Start(); + try + { + var response = await RestClient.ListByLocationAsync(resourceGroupName, locationName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.ListByLocation"); + scope.Start(); + try + { + var response = await RestClient.ListByLocationNextPageAsync(nextLink, resourceGroupName, locationName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Lists a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByLocation(string resourceGroupName, string locationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.ListByLocation"); + scope.Start(); + try + { + var response = RestClient.ListByLocation(resourceGroupName, locationName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.ListByLocation"); + scope.Start(); + try + { + var response = RestClient.ListByLocationNextPage(nextLink, resourceGroupName, locationName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a server trust groups by instance name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public virtual AsyncPageable ListByInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.ListByInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByInstanceAsync(resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.ListByInstance"); + scope.Start(); + try + { + var response = await RestClient.ListByInstanceNextPageAsync(nextLink, resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a server trust groups by instance name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public virtual Pageable ListByInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.ListByInstance"); + scope.Start(); + try + { + var response = RestClient.ListByInstance(resourceGroupName, managedInstanceName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.ListByInstance"); + scope.Start(); + try + { + var response = RestClient.ListByInstanceNextPage(nextLink, resourceGroupName, managedInstanceName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Creates or updates a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The server trust group parameters. + /// The cancellation token to use. + /// , , , or is null. + public virtual async Task StartCreateOrUpdateAsync(string resourceGroupName, string locationName, string serverTrustGroupName, ServerTrustGroup parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, cancellationToken).ConfigureAwait(false); + return new ServerTrustGroupsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, locationName, serverTrustGroupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Creates or updates a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The server trust group parameters. + /// The cancellation token to use. + /// , , , or is null. + public virtual ServerTrustGroupsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string locationName, string serverTrustGroupName, ServerTrustGroup parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.StartCreateOrUpdate"); + scope.Start(); + try + { + var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, locationName, serverTrustGroupName, parameters, cancellationToken); + return new ServerTrustGroupsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, locationName, serverTrustGroupName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartDeleteAsync(string resourceGroupName, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = await RestClient.DeleteAsync(resourceGroupName, locationName, serverTrustGroupName, cancellationToken).ConfigureAwait(false); + return new ServerTrustGroupsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, locationName, serverTrustGroupName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + /// , , or is null. + public virtual ServerTrustGroupsDeleteOperation StartDelete(string resourceGroupName, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + + using var scope = _clientDiagnostics.CreateScope("ServerTrustGroupsOperations.StartDelete"); + scope.Start(); + try + { + var originalResponse = RestClient.Delete(resourceGroupName, locationName, serverTrustGroupName, cancellationToken); + return new ServerTrustGroupsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGroupName, locationName, serverTrustGroupName).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsRestOperations.cs new file mode 100644 index 0000000000000..c64f6062dc03c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerTrustGroupsRestOperations.cs @@ -0,0 +1,674 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class ServerTrustGroupsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of ServerTrustGroupsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public ServerTrustGroupsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string locationName, string serverTrustGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/serverTrustGroups/", false); + uri.AppendPath(serverTrustGroupName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + + using var message = CreateGetRequest(resourceGroupName, locationName, serverTrustGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroup value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerTrustGroup.DeserializeServerTrustGroup(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + + using var message = CreateGetRequest(resourceGroupName, locationName, serverTrustGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroup value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerTrustGroup.DeserializeServerTrustGroup(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string locationName, string serverTrustGroupName, ServerTrustGroup parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/serverTrustGroups/", false); + uri.AppendPath(serverTrustGroupName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Creates or updates a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The server trust group parameters. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string locationName, string serverTrustGroupName, ServerTrustGroup parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, locationName, serverTrustGroupName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Creates or updates a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The server trust group parameters. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string locationName, string serverTrustGroupName, ServerTrustGroup parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, locationName, serverTrustGroupName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string locationName, string serverTrustGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/serverTrustGroups/", false); + uri.AppendPath(serverTrustGroupName, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + return message; + } + + /// Deletes a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, locationName, serverTrustGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Deletes a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The name of the server trust group. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string locationName, string serverTrustGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (serverTrustGroupName == null) + { + throw new ArgumentNullException(nameof(serverTrustGroupName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, locationName, serverTrustGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByLocationRequest(string resourceGroupName, string locationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/serverTrustGroups", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// or is null. + public async Task> ListByLocationAsync(string resourceGroupName, string locationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationRequest(resourceGroupName, locationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerTrustGroupListResult.DeserializeServerTrustGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists a server trust group. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// or is null. + public Response ListByLocation(string resourceGroupName, string locationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationRequest(resourceGroupName, locationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerTrustGroupListResult.DeserializeServerTrustGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByInstanceRequest(string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/serverTrustGroups", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a server trust groups by instance name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public async Task> ListByInstanceAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByInstanceRequest(resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerTrustGroupListResult.DeserializeServerTrustGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a server trust groups by instance name. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public Response ListByInstance(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByInstanceRequest(resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerTrustGroupListResult.DeserializeServerTrustGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByLocationNextPageRequest(string nextLink, string resourceGroupName, string locationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Lists a server trust group. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByLocationNextPageAsync(string nextLink, string resourceGroupName, string locationName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationNextPageRequest(nextLink, resourceGroupName, locationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerTrustGroupListResult.DeserializeServerTrustGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Lists a server trust group. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the region where the resource is located. + /// The cancellation token to use. + /// , , or is null. + public Response ListByLocationNextPage(string nextLink, string resourceGroupName, string locationName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationNextPageRequest(nextLink, resourceGroupName, locationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerTrustGroupListResult.DeserializeServerTrustGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByInstanceNextPageRequest(string nextLink, string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a server trust groups by instance name. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + public async Task> ListByInstanceNextPageAsync(string nextLink, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroupListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ServerTrustGroupListResult.DeserializeServerTrustGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a server trust groups by instance name. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , , or is null. + public Response ListByInstanceNextPage(string nextLink, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateListByInstanceNextPageRequest(nextLink, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ServerTrustGroupListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ServerTrustGroupListResult.DeserializeServerTrustGroupListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs index 7dbc7a3844635..947868a615ea4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs @@ -79,7 +79,7 @@ public virtual Response Get(string resourceGroupN } } - /// Creates or updates the server's vulnerability assessment. + /// 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. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server for which the vulnerability assessment is defined. /// The name of the vulnerability assessment. @@ -100,7 +100,7 @@ public virtual async Task> CreateOrUpdat } } - /// Creates or updates the server's vulnerability assessment. + /// 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. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server for which the vulnerability assessment is defined. /// The name of the vulnerability assessment. diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerVulnerabilityAssessmentsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerVulnerabilityAssessmentsRestOperations.cs index 66a0e261f87d7..a16f2a92957db 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerVulnerabilityAssessmentsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerVulnerabilityAssessmentsRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -145,7 +145,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -155,7 +155,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin return message; } - /// Creates or updates the server's vulnerability assessment. + /// 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. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server for which the vulnerability assessment is defined. /// The name of the vulnerability assessment. @@ -194,7 +194,7 @@ public async Task> CreateOrUpdateAsync(s } } - /// Creates or updates the server's vulnerability assessment. + /// 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. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server for which the vulnerability assessment is defined. /// The name of the vulnerability assessment. @@ -248,7 +248,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/vulnerabilityAssessments/", false); uri.AppendPath(vulnerabilityAssessmentName.ToString(), true); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -323,7 +323,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/vulnerabilityAssessments", false); - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersImportDatabaseOperation.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersImportDatabaseOperation.cs new file mode 100644 index 0000000000000..9bcca59d6571a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersImportDatabaseOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// Imports a bacpac into a new database. + public partial class ServersImportDatabaseOperation : Operation, IOperationSource + { + private readonly ArmOperationHelpers _operation; + + /// Initializes a new instance of ServersImportDatabaseOperation for mocking. + protected ServersImportDatabaseOperation() + { + } + + internal ServersImportDatabaseOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new ArmOperationHelpers(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServersImportDatabaseOperation"); + } + /// + public override string Id => _operation.Id; + + /// + public override ImportExportOperationResult Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ImportExportOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return ImportExportOperationResult.DeserializeImportExportOperationResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return ImportExportOperationResult.DeserializeImportExportOperationResult(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersOperations.cs index 03295b97cdc9d..d9cacdd7f1bd8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersOperations.cs @@ -42,14 +42,15 @@ internal ServersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pip /// Gets a server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The child resources to include in the response. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ServersOperations.Get"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, serverName, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, serverName, expand, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -61,14 +62,15 @@ public virtual async Task> GetAsync(string resourceGroupName, s /// Gets a server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The child resources to include in the response. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string serverName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ServersOperations.Get"); scope.Start(); try { - return RestClient.Get(resourceGroupName, serverName, cancellationToken); + return RestClient.Get(resourceGroupName, serverName, expand, cancellationToken); } catch (Exception e) { @@ -115,9 +117,10 @@ public virtual Response CheckNameAvailability(Che /// Gets a list of servers in a resource groups. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. /// is null. - public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListByResourceGroupAsync(string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -130,7 +133,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -145,7 +148,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -159,9 +162,10 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) /// Gets a list of servers in a resource groups. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. /// is null. - public virtual Pageable ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + public virtual Pageable ListByResourceGroup(string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -174,7 +178,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); + var response = RestClient.ListByResourceGroup(resourceGroupName, expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -189,7 +193,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken); + var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -202,8 +206,9 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) } /// Gets a list of all servers in the subscription. + /// The child resources to include in the response. /// The cancellation token to use. - public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + public virtual AsyncPageable ListAsync(string expand = null, CancellationToken cancellationToken = default) { async Task> FirstPageFunc(int? pageSizeHint) { @@ -211,7 +216,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListAsync(expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -226,7 +231,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); + var response = await RestClient.ListNextPageAsync(nextLink, expand, cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -239,8 +244,9 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) } /// Gets a list of all servers in the subscription. + /// The child resources to include in the response. /// The cancellation token to use. - public virtual Pageable List(CancellationToken cancellationToken = default) + public virtual Pageable List(string expand = null, CancellationToken cancellationToken = default) { Page FirstPageFunc(int? pageSizeHint) { @@ -248,7 +254,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = RestClient.List(cancellationToken); + var response = RestClient.List(expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -263,7 +269,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = RestClient.ListNextPage(nextLink, cancellationToken); + var response = RestClient.ListNextPage(nextLink, expand, cancellationToken); return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -474,5 +480,75 @@ public virtual ServersUpdateOperation StartUpdate(string resourceGroupName, stri throw; } } + + /// Imports a bacpac into a new database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The database import request parameters. + /// The cancellation token to use. + /// , , or is null. + public virtual async Task StartImportDatabaseAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ServersOperations.StartImportDatabase"); + scope.Start(); + try + { + var originalResponse = await RestClient.ImportDatabaseAsync(resourceGroupName, serverName, parameters, cancellationToken).ConfigureAwait(false); + return new ServersImportDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateImportDatabaseRequest(resourceGroupName, serverName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Imports a bacpac into a new database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The database import request parameters. + /// The cancellation token to use. + /// , , or is null. + public virtual ServersImportDatabaseOperation StartImportDatabase(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var scope = _clientDiagnostics.CreateScope("ServersOperations.StartImportDatabase"); + scope.Start(); + try + { + var originalResponse = RestClient.ImportDatabase(resourceGroupName, serverName, parameters, cancellationToken); + return new ServersImportDatabaseOperation(_clientDiagnostics, _pipeline, RestClient.CreateImportDatabaseRequest(resourceGroupName, serverName, parameters).Request, originalResponse); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersRestOperations.cs index b494ab28a1864..4a9e3011567b2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServersRestOperations.cs @@ -43,7 +43,7 @@ public ServersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline p _pipeline = pipeline; } - internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) + internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -55,7 +55,11 @@ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -63,16 +67,17 @@ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) /// Gets a list of servers in a resource groups. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. /// is null. - public async Task> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancellationToken = default) + public async Task> ListByResourceGroupAsync(string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateListByResourceGroupRequest(resourceGroupName); + using var message = CreateListByResourceGroupRequest(resourceGroupName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -90,16 +95,17 @@ public async Task> ListByResourceGroupAsync(string re /// Gets a list of servers in a resource groups. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. /// is null. - public Response ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken = default) + public Response ListByResourceGroup(string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateListByResourceGroupRequest(resourceGroupName); + using var message = CreateListByResourceGroupRequest(resourceGroupName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -115,7 +121,7 @@ public Response ListByResourceGroup(string resourceGroupName, } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -128,7 +134,11 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -137,9 +147,10 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam /// Gets a server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The child resources to include in the response. /// The cancellation token to use. /// or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string serverName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -150,7 +161,7 @@ public async Task> GetAsync(string resourceGroupName, string se throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateGetRequest(resourceGroupName, serverName); + using var message = CreateGetRequest(resourceGroupName, serverName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -169,9 +180,10 @@ public async Task> GetAsync(string resourceGroupName, string se /// Gets a server. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. + /// The child resources to include in the response. /// The cancellation token to use. /// or is null. - public Response Get(string resourceGroupName, string serverName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string serverName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -182,7 +194,7 @@ public Response Get(string resourceGroupName, string serverName, Cancell throw new ArgumentNullException(nameof(serverName)); } - using var message = CreateGetRequest(resourceGroupName, serverName); + using var message = CreateGetRequest(resourceGroupName, serverName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -211,7 +223,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -302,7 +314,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; return message; } @@ -378,7 +390,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -454,7 +466,7 @@ public Response Update(string resourceGroupName, string serverName, ServerUpdate } } - internal HttpMessage CreateListRequest() + internal HttpMessage CreateListRequest(string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -464,17 +476,22 @@ internal HttpMessage CreateListRequest() uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Sql/servers", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } /// Gets a list of all servers in the subscription. + /// The child resources to include in the response. /// The cancellation token to use. - public async Task> ListAsync(CancellationToken cancellationToken = default) + public async Task> ListAsync(string expand = null, CancellationToken cancellationToken = default) { - using var message = CreateListRequest(); + using var message = CreateListRequest(expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -491,10 +508,11 @@ public async Task> ListAsync(CancellationToken cancel } /// Gets a list of all servers in the subscription. + /// The child resources to include in the response. /// The cancellation token to use. - public Response List(CancellationToken cancellationToken = default) + public Response List(string expand = null, CancellationToken cancellationToken = default) { - using var message = CreateListRequest(); + using var message = CreateListRequest(expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -510,6 +528,96 @@ public Response List(CancellationToken cancellationToken = def } } + internal HttpMessage CreateImportDatabaseRequest(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/import", false); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Imports a bacpac into a new database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The database import request parameters. + /// The cancellation token to use. + /// , , or is null. + public async Task ImportDatabaseAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateImportDatabaseRequest(resourceGroupName, serverName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Imports a bacpac into a new database. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The database import request parameters. + /// The cancellation token to use. + /// , , or is null. + public Response ImportDatabase(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateImportDatabaseRequest(resourceGroupName, serverName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + internal HttpMessage CreateCheckNameAvailabilityRequest(CheckNameAvailabilityRequest parameters) { var message = _pipeline.CreateMessage(); @@ -520,7 +628,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(CheckNameAvailabilityReq uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Sql/checkNameAvailability", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -584,7 +692,7 @@ public Response CheckNameAvailability(CheckNameAv } } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName) + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -600,9 +708,10 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// Gets a list of servers in a resource groups. /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. /// or is null. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default) + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -613,7 +722,7 @@ public async Task> ListByResourceGroupNextPageAsync(s throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -632,9 +741,10 @@ public async Task> ListByResourceGroupNextPageAsync(s /// Gets a list of servers in a resource groups. /// The URL to the next page of results. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The child resources to include in the response. /// The cancellation token to use. /// or is null. - public Response ListByResourceGroupNextPage(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default) + public Response ListByResourceGroupNextPage(string nextLink, string resourceGroupName, string expand = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -645,7 +755,7 @@ public Response ListByResourceGroupNextPage(string nextLink, s throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -661,7 +771,7 @@ public Response ListByResourceGroupNextPage(string nextLink, s } } - internal HttpMessage CreateListNextPageRequest(string nextLink) + internal HttpMessage CreateListNextPageRequest(string nextLink, string expand) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -676,16 +786,17 @@ internal HttpMessage CreateListNextPageRequest(string nextLink) /// Gets a list of all servers in the subscription. /// The URL to the next page of results. + /// The child resources to include in the response. /// The cancellation token to use. /// is null. - public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + public async Task> ListNextPageAsync(string nextLink, string expand = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - using var message = CreateListNextPageRequest(nextLink); + using var message = CreateListNextPageRequest(nextLink, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -703,16 +814,17 @@ public async Task> ListNextPageAsync(string nextLink, /// Gets a list of all servers in the subscription. /// The URL to the next page of results. + /// The child resources to include in the response. /// The cancellation token to use. /// is null. - public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + public Response ListNextPage(string nextLink, string expand = null, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } - using var message = CreateListNextPageRequest(nextLink); + using var message = CreateListNextPageRequest(nextLink, expand); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentOperations.cs new file mode 100644 index 0000000000000..39da4917ebfc3 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentOperations.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The SqlAgent service client. + public partial class SqlAgentOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal SqlAgentRestOperations RestClient { get; } + + /// Initializes a new instance of SqlAgentOperations for mocking. + protected SqlAgentOperations() + { + } + + /// Initializes a new instance of SqlAgentOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal SqlAgentOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new SqlAgentRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets current instance sql agent configuration. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + public virtual async Task> GetAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlAgentOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(resourceGroupName, managedInstanceName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets current instance sql agent configuration. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + public virtual Response Get(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlAgentOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(resourceGroupName, managedInstanceName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Puts new sql agent configuration to instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The SqlAgentConfiguration to use. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlAgentOperations.CreateOrUpdate"); + scope.Start(); + try + { + return await RestClient.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Puts new sql agent configuration to instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The SqlAgentConfiguration to use. + /// The cancellation token to use. + public virtual Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("SqlAgentOperations.CreateOrUpdate"); + scope.Start(); + try + { + return RestClient.CreateOrUpdate(resourceGroupName, managedInstanceName, parameters, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentRestOperations.cs new file mode 100644 index 0000000000000..7363a1a347c84 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlAgentRestOperations.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class SqlAgentRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of SqlAgentRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public SqlAgentRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string managedInstanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/sqlAgent/current", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets current instance sql agent configuration. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlAgentConfiguration value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlAgentConfiguration.DeserializeSqlAgentConfiguration(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets current instance sql agent configuration. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// or is null. + public Response Get(string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + + using var message = CreateGetRequest(resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlAgentConfiguration value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlAgentConfiguration.DeserializeSqlAgentConfiguration(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/sqlAgent/current", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(parameters); + request.Content = content; + return message; + } + + /// Puts new sql agent configuration to instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The SqlAgentConfiguration to use. + /// The cancellation token to use. + /// , , or is null. + public async Task> CreateOrUpdateAsync(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, parameters); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SqlAgentConfiguration value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SqlAgentConfiguration.DeserializeSqlAgentConfiguration(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Puts new sql agent configuration to instance. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The SqlAgentConfiguration to use. + /// The cancellation token to use. + /// , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (managedInstanceName == null) + { + throw new ArgumentNullException(nameof(managedInstanceName)); + } + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, managedInstanceName, parameters); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SqlAgentConfiguration value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SqlAgentConfiguration.DeserializeSqlAgentConfiguration(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlManagementClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlManagementClient.cs index a599405f2aae2..93f135aed1c41 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlManagementClient.cs @@ -56,24 +56,12 @@ public SqlManagementClient(string subscriptionId, Uri endpoint, TokenCredential /// Returns an instance of RecoverableDatabasesOperations. public virtual RecoverableDatabasesOperations RecoverableDatabases => new RecoverableDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of RestorableDroppedDatabasesOperations. - public virtual RestorableDroppedDatabasesOperations RestorableDroppedDatabases => new RestorableDroppedDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of ServerConnectionPoliciesOperations. - public virtual ServerConnectionPoliciesOperations ServerConnectionPolicies => new ServerConnectionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of DatabaseThreatDetectionPoliciesOperations. - public virtual DatabaseThreatDetectionPoliciesOperations DatabaseThreatDetectionPolicies => new DatabaseThreatDetectionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of DataMaskingPoliciesOperations. public virtual DataMaskingPoliciesOperations DataMaskingPolicies => new DataMaskingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of DataMaskingRulesOperations. public virtual DataMaskingRulesOperations DataMaskingRules => new DataMaskingRulesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of FirewallRulesOperations. - public virtual FirewallRulesOperations FirewallRules => new FirewallRulesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of GeoBackupPoliciesOperations. public virtual GeoBackupPoliciesOperations GeoBackupPolicies => new GeoBackupPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); @@ -83,9 +71,6 @@ public SqlManagementClient(string subscriptionId, Uri endpoint, TokenCredential /// Returns an instance of ElasticPoolsOperations. public virtual ElasticPoolsOperations ElasticPools => new ElasticPoolsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of RecommendedElasticPoolsOperations. - public virtual RecommendedElasticPoolsOperations RecommendedElasticPools => new RecommendedElasticPoolsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ReplicationLinksOperations. public virtual ReplicationLinksOperations ReplicationLinks => new ReplicationLinksOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); @@ -101,65 +86,74 @@ public SqlManagementClient(string subscriptionId, Uri endpoint, TokenCredential /// Returns an instance of ElasticPoolDatabaseActivitiesOperations. public virtual ElasticPoolDatabaseActivitiesOperations ElasticPoolDatabaseActivities => new ElasticPoolDatabaseActivitiesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServiceTierAdvisorsOperations. - public virtual ServiceTierAdvisorsOperations ServiceTierAdvisors => new ServiceTierAdvisorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ServerUsagesOperations. + public virtual ServerUsagesOperations ServerUsages => new ServerUsagesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of TransparentDataEncryptionsOperations. - public virtual TransparentDataEncryptionsOperations TransparentDataEncryptions => new TransparentDataEncryptionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ExtendedDatabaseBlobAuditingPoliciesOperations. + public virtual ExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies => new ExtendedDatabaseBlobAuditingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of TransparentDataEncryptionActivitiesOperations. - public virtual TransparentDataEncryptionActivitiesOperations TransparentDataEncryptionActivities => new TransparentDataEncryptionActivitiesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ExtendedServerBlobAuditingPoliciesOperations. + public virtual ExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies => new ExtendedServerBlobAuditingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServerUsagesOperations. - public virtual ServerUsagesOperations ServerUsages => new ServerUsagesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ServerBlobAuditingPoliciesOperations. + public virtual ServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies => new ServerBlobAuditingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of DatabaseUsagesOperations. - public virtual DatabaseUsagesOperations DatabaseUsages => new DatabaseUsagesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseBlobAuditingPoliciesOperations. + public virtual DatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies => new DatabaseBlobAuditingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of DatabaseAdvisorsOperations. + public virtual DatabaseAdvisorsOperations DatabaseAdvisors => new DatabaseAdvisorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of DatabaseAutomaticTuningOperations. public virtual DatabaseAutomaticTuningOperations DatabaseAutomaticTuning => new DatabaseAutomaticTuningOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of EncryptionProtectorsOperations. - public virtual EncryptionProtectorsOperations EncryptionProtectors => new EncryptionProtectorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseColumnsOperations. + public virtual DatabaseColumnsOperations DatabaseColumns => new DatabaseColumnsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of FailoverGroupsOperations. - public virtual FailoverGroupsOperations FailoverGroups => new FailoverGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseRecommendedActionsOperations. + public virtual DatabaseRecommendedActionsOperations DatabaseRecommendedActions => new DatabaseRecommendedActionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of Operations. - public virtual Operations Operations => new Operations(_clientDiagnostics, _pipeline, _endpoint); + /// Returns an instance of DatabaseSchemasOperations. + public virtual DatabaseSchemasOperations DatabaseSchemas => new DatabaseSchemasOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServerKeysOperations. - public virtual ServerKeysOperations ServerKeys => new ServerKeysOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseSecurityAlertPoliciesOperations. + public virtual DatabaseSecurityAlertPoliciesOperations DatabaseSecurityAlertPolicies => new DatabaseSecurityAlertPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of SyncAgentsOperations. - public virtual SyncAgentsOperations SyncAgents => new SyncAgentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseTablesOperations. + public virtual DatabaseTablesOperations DatabaseTables => new DatabaseTablesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of SubscriptionUsagesOperations. - public virtual SubscriptionUsagesOperations SubscriptionUsages => new SubscriptionUsagesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseVulnerabilityAssessmentRuleBaselinesOperations. + public virtual DatabaseVulnerabilityAssessmentRuleBaselinesOperations DatabaseVulnerabilityAssessmentRuleBaselines => new DatabaseVulnerabilityAssessmentRuleBaselinesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of VirtualClustersOperations. - public virtual VirtualClustersOperations VirtualClusters => new VirtualClustersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseVulnerabilityAssessmentsOperations. + public virtual DatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments => new DatabaseVulnerabilityAssessmentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of VirtualNetworkRulesOperations. - public virtual VirtualNetworkRulesOperations VirtualNetworkRules => new VirtualNetworkRulesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseVulnerabilityAssessmentScansOperations. + public virtual DatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans => new DatabaseVulnerabilityAssessmentScansOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ExtendedDatabaseBlobAuditingPoliciesOperations. - public virtual ExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies => new ExtendedDatabaseBlobAuditingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DataWarehouseUserActivitiesOperations. + public virtual DataWarehouseUserActivitiesOperations DataWarehouseUserActivities => new DataWarehouseUserActivitiesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ExtendedServerBlobAuditingPoliciesOperations. - public virtual ExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies => new ExtendedServerBlobAuditingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DeletedServersOperations. + public virtual DeletedServersOperations DeletedServers => new DeletedServersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServerBlobAuditingPoliciesOperations. - public virtual ServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies => new ServerBlobAuditingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ElasticPoolOperations. + public virtual ElasticPoolOperations ElasticPool => new ElasticPoolOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of DatabaseBlobAuditingPoliciesOperations. - public virtual DatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies => new DatabaseBlobAuditingPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of EncryptionProtectorsOperations. + public virtual EncryptionProtectorsOperations EncryptionProtectors => new EncryptionProtectorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of DatabaseVulnerabilityAssessmentRuleBaselinesOperations. - public virtual DatabaseVulnerabilityAssessmentRuleBaselinesOperations DatabaseVulnerabilityAssessmentRuleBaselines => new DatabaseVulnerabilityAssessmentRuleBaselinesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of FailoverGroupsOperations. + public virtual FailoverGroupsOperations FailoverGroups => new FailoverGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of DatabaseVulnerabilityAssessmentsOperations. - public virtual DatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments => new DatabaseVulnerabilityAssessmentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of FirewallRulesOperations. + public virtual FirewallRulesOperations FirewallRules => new FirewallRulesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of InstanceFailoverGroupsOperations. + public virtual InstanceFailoverGroupsOperations InstanceFailoverGroups => new InstanceFailoverGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of InstancePoolsOperations. + public virtual InstancePoolsOperations InstancePools => new InstancePoolsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of JobAgentsOperations. public virtual JobAgentsOperations JobAgents => new JobAgentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); @@ -188,95 +182,101 @@ public SqlManagementClient(string subscriptionId, Uri endpoint, TokenCredential /// Returns an instance of JobVersionsOperations. public virtual JobVersionsOperations JobVersions => new JobVersionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of LongTermRetentionBackupsOperations. - public virtual LongTermRetentionBackupsOperations LongTermRetentionBackups => new LongTermRetentionBackupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of CapabilitiesOperations. + public virtual CapabilitiesOperations Capabilities => new CapabilitiesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of LongTermRetentionPoliciesOperations. + public virtual LongTermRetentionPoliciesOperations LongTermRetentionPolicies => new LongTermRetentionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of BackupLongTermRetentionPoliciesOperations. - public virtual BackupLongTermRetentionPoliciesOperations BackupLongTermRetentionPolicies => new BackupLongTermRetentionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of MaintenanceWindowOptionsOperations. + public virtual MaintenanceWindowOptionsOperations MaintenanceWindowOptions => new MaintenanceWindowOptionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of MaintenanceWindowsOperations. + public virtual MaintenanceWindowsOperations MaintenanceWindows => new MaintenanceWindowsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of ManagedBackupShortTermRetentionPoliciesOperations. public virtual ManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies => new ManagedBackupShortTermRetentionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. - public virtual ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies => new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of ServerAutomaticTuningOperations. - public virtual ServerAutomaticTuningOperations ServerAutomaticTuning => new ServerAutomaticTuningOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseColumnsOperations. + public virtual ManagedDatabaseColumnsOperations ManagedDatabaseColumns => new ManagedDatabaseColumnsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServerDnsAliasesOperations. - public virtual ServerDnsAliasesOperations ServerDnsAliases => new ServerDnsAliasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseQueriesOperations. + public virtual ManagedDatabaseQueriesOperations ManagedDatabaseQueries => new ManagedDatabaseQueriesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServerSecurityAlertPoliciesOperations. - public virtual ServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies => new ServerSecurityAlertPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseRestoreDetailsOperations. + public virtual ManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails => new ManagedDatabaseRestoreDetailsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of RestorableDroppedManagedDatabasesOperations. - public virtual RestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases => new RestorableDroppedManagedDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabasesOperations. + public virtual ManagedDatabasesOperations ManagedDatabases => new ManagedDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of RestorePointsOperations. - public virtual RestorePointsOperations RestorePoints => new RestorePointsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseSchemasOperations. + public virtual ManagedDatabaseSchemasOperations ManagedDatabaseSchemas => new ManagedDatabaseSchemasOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of ManagedDatabaseSecurityAlertPoliciesOperations. public virtual ManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies => new ManagedDatabaseSecurityAlertPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedServerSecurityAlertPoliciesOperations. - public virtual ManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies => new ManagedServerSecurityAlertPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of SensitivityLabelsOperations. - public virtual SensitivityLabelsOperations SensitivityLabels => new SensitivityLabelsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseSecurityEventsOperations. + public virtual ManagedDatabaseSecurityEventsOperations ManagedDatabaseSecurityEvents => new ManagedDatabaseSecurityEventsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedInstanceAdministratorsOperations. - public virtual ManagedInstanceAdministratorsOperations ManagedInstanceAdministrators => new ManagedInstanceAdministratorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseSensitivityLabelsOperations. + public virtual ManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels => new ManagedDatabaseSensitivityLabelsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of DatabaseOperations. - public virtual DatabaseOperations Database => new DatabaseOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseRecommendedSensitivityLabelsOperations. + public virtual ManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels => new ManagedDatabaseRecommendedSensitivityLabelsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ElasticPoolOperations. - public virtual ElasticPoolOperations ElasticPool => new ElasticPoolOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseTablesOperations. + public virtual ManagedDatabaseTablesOperations ManagedDatabaseTables => new ManagedDatabaseTablesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of DatabaseVulnerabilityAssessmentScansOperations. - public virtual DatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans => new DatabaseVulnerabilityAssessmentScansOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseTransparentDataEncryptionOperations. + public virtual ManagedDatabaseTransparentDataEncryptionOperations ManagedDatabaseTransparentDataEncryption => new ManagedDatabaseTransparentDataEncryptionOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. public virtual ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines => new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedDatabaseVulnerabilityAssessmentScansOperations. - public virtual ManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans => new ManagedDatabaseVulnerabilityAssessmentScansOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedDatabaseVulnerabilityAssessmentsOperations. public virtual ManagedDatabaseVulnerabilityAssessmentsOperations ManagedDatabaseVulnerabilityAssessments => new ManagedDatabaseVulnerabilityAssessmentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of InstanceFailoverGroupsOperations. - public virtual InstanceFailoverGroupsOperations InstanceFailoverGroups => new InstanceFailoverGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedDatabaseVulnerabilityAssessmentScansOperations. + public virtual ManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans => new ManagedDatabaseVulnerabilityAssessmentScansOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of TdeCertificatesOperations. - public virtual TdeCertificatesOperations TdeCertificates => new TdeCertificatesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedInstanceAdministratorsOperations. + public virtual ManagedInstanceAdministratorsOperations ManagedInstanceAdministrators => new ManagedInstanceAdministratorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedInstanceTdeCertificatesOperations. - public virtual ManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates => new ManagedInstanceTdeCertificatesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedInstanceAzureADOnlyAuthenticationsOperations. + public virtual ManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications => new ManagedInstanceAzureADOnlyAuthenticationsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ManagedInstanceEncryptionProtectorsOperations. + public virtual ManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors => new ManagedInstanceEncryptionProtectorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of ManagedInstanceKeysOperations. public virtual ManagedInstanceKeysOperations ManagedInstanceKeys => new ManagedInstanceKeysOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedInstanceEncryptionProtectorsOperations. - public virtual ManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors => new ManagedInstanceEncryptionProtectorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedInstanceLongTermRetentionPoliciesOperations. + public virtual ManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies => new ManagedInstanceLongTermRetentionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of RecoverableManagedDatabasesOperations. - public virtual RecoverableManagedDatabasesOperations RecoverableManagedDatabases => new RecoverableManagedDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedInstanceOperations. + public virtual ManagedInstanceOperations ManagedInstance => new ManagedInstanceOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ManagedInstancePrivateEndpointConnectionsOperations. + public virtual ManagedInstancePrivateEndpointConnectionsOperations ManagedInstancePrivateEndpointConnections => new ManagedInstancePrivateEndpointConnectionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ManagedInstancePrivateLinkResourcesOperations. + public virtual ManagedInstancePrivateLinkResourcesOperations ManagedInstancePrivateLinkResources => new ManagedInstancePrivateLinkResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ManagedInstanceTdeCertificatesOperations. + public virtual ManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates => new ManagedInstanceTdeCertificatesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of ManagedInstanceVulnerabilityAssessmentsOperations. public virtual ManagedInstanceVulnerabilityAssessmentsOperations ManagedInstanceVulnerabilityAssessments => new ManagedInstanceVulnerabilityAssessmentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServerVulnerabilityAssessmentsOperations. - public virtual ServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments => new ServerVulnerabilityAssessmentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of ManagedDatabaseSensitivityLabelsOperations. - public virtual ManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels => new ManagedDatabaseSensitivityLabelsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. + public virtual ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies => new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of InstancePoolsOperations. - public virtual InstancePoolsOperations InstancePools => new InstancePoolsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ManagedServerSecurityAlertPoliciesOperations. + public virtual ManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies => new ManagedServerSecurityAlertPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of UsagesOperations. - public virtual UsagesOperations Usages => new UsagesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of Operations. + public virtual Operations Operations => new Operations(_clientDiagnostics, _pipeline, _endpoint); /// Returns an instance of PrivateEndpointConnectionsOperations. public virtual PrivateEndpointConnectionsOperations PrivateEndpointConnections => new PrivateEndpointConnectionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); @@ -284,49 +284,127 @@ public SqlManagementClient(string subscriptionId, Uri endpoint, TokenCredential /// Returns an instance of PrivateLinkResourcesOperations. public virtual PrivateLinkResourcesOperations PrivateLinkResources => new PrivateLinkResourcesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServersOperations. - public virtual ServersOperations Servers => new ServersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - - /// Returns an instance of CapabilitiesOperations. - public virtual CapabilitiesOperations Capabilities => new CapabilitiesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of RecoverableManagedDatabasesOperations. + public virtual RecoverableManagedDatabasesOperations RecoverableManagedDatabases => new RecoverableManagedDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of LongTermRetentionManagedInstanceBackupsOperations. - public virtual LongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups => new LongTermRetentionManagedInstanceBackupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of RestorePointsOperations. + public virtual RestorePointsOperations RestorePoints => new RestorePointsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedInstanceLongTermRetentionPoliciesOperations. - public virtual ManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies => new ManagedInstanceLongTermRetentionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of SensitivityLabelsOperations. + public virtual SensitivityLabelsOperations SensitivityLabels => new SensitivityLabelsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of WorkloadGroupsOperations. - public virtual WorkloadGroupsOperations WorkloadGroups => new WorkloadGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of RecommendedSensitivityLabelsOperations. + public virtual RecommendedSensitivityLabelsOperations RecommendedSensitivityLabels => new RecommendedSensitivityLabelsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of WorkloadClassifiersOperations. - public virtual WorkloadClassifiersOperations WorkloadClassifiers => new WorkloadClassifiersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ServerAdvisorsOperations. + public virtual ServerAdvisorsOperations ServerAdvisors => new ServerAdvisorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedInstanceOperations. - public virtual ManagedInstanceOperations ManagedInstance => new ManagedInstanceOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ServerAutomaticTuningOperations. + public virtual ServerAutomaticTuningOperations ServerAutomaticTuning => new ServerAutomaticTuningOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of ServerAzureADAdministratorsOperations. public virtual ServerAzureADAdministratorsOperations ServerAzureADAdministrators => new ServerAzureADAdministratorsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of ServerAzureADOnlyAuthenticationsOperations. + public virtual ServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications => new ServerAzureADOnlyAuthenticationsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServerDevOpsAuditSettingsOperations. + public virtual ServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings => new ServerDevOpsAuditSettingsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServerDnsAliasesOperations. + public virtual ServerDnsAliasesOperations ServerDnsAliases => new ServerDnsAliasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServerKeysOperations. + public virtual ServerKeysOperations ServerKeys => new ServerKeysOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServerOperations. + public virtual ServerOperations Server => new ServerOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServerSecurityAlertPoliciesOperations. + public virtual ServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies => new ServerSecurityAlertPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServerTrustGroupsOperations. + public virtual ServerTrustGroupsOperations ServerTrustGroups => new ServerTrustGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServerVulnerabilityAssessmentsOperations. + public virtual ServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments => new ServerVulnerabilityAssessmentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of SqlAgentOperations. + public virtual SqlAgentOperations SqlAgent => new SqlAgentOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of SubscriptionUsagesOperations. + public virtual SubscriptionUsagesOperations SubscriptionUsages => new SubscriptionUsagesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of SyncAgentsOperations. + public virtual SyncAgentsOperations SyncAgents => new SyncAgentsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of SyncGroupsOperations. public virtual SyncGroupsOperations SyncGroups => new SyncGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of SyncMembersOperations. public virtual SyncMembersOperations SyncMembers => new SyncMembersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedInstancesOperations. - public virtual ManagedInstancesOperations ManagedInstances => new ManagedInstancesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of TdeCertificatesOperations. + public virtual TdeCertificatesOperations TdeCertificates => new TdeCertificatesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of TimeZonesOperations. + public virtual TimeZonesOperations TimeZones => new TimeZonesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of VirtualClustersOperations. + public virtual VirtualClustersOperations VirtualClusters => new VirtualClustersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of VirtualNetworkRulesOperations. + public virtual VirtualNetworkRulesOperations VirtualNetworkRules => new VirtualNetworkRulesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of WorkloadClassifiersOperations. + public virtual WorkloadClassifiersOperations WorkloadClassifiers => new WorkloadClassifiersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of WorkloadGroupsOperations. + public virtual WorkloadGroupsOperations WorkloadGroups => new WorkloadGroupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of TransparentDataEncryptionsOperations. + public virtual TransparentDataEncryptionsOperations TransparentDataEncryptions => new TransparentDataEncryptionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); /// Returns an instance of BackupShortTermRetentionPoliciesOperations. public virtual BackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies => new BackupShortTermRetentionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedDatabaseRestoreDetailsOperations. - public virtual ManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails => new ManagedDatabaseRestoreDetailsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseExtensionsOperations. + public virtual DatabaseExtensionsOperations DatabaseExtensions => new DatabaseExtensionsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ManagedDatabasesOperations. - public virtual ManagedDatabasesOperations ManagedDatabases => new ManagedDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseOperations. + public virtual DatabaseOperations Database => new DatabaseOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); - /// Returns an instance of ServerAzureADOnlyAuthenticationsOperations. - public virtual ServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications => new ServerAzureADOnlyAuthenticationsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + /// Returns an instance of DatabaseUsagesOperations. + public virtual DatabaseUsagesOperations DatabaseUsages => new DatabaseUsagesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of LedgerDigestUploadsOperations. + public virtual LedgerDigestUploadsOperations LedgerDigestUploads => new LedgerDigestUploadsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of OutboundFirewallRulesOperations. + public virtual OutboundFirewallRulesOperations OutboundFirewallRules => new OutboundFirewallRulesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServersOperations. + public virtual ServersOperations Servers => new ServersOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of UsagesOperations. + public virtual UsagesOperations Usages => new UsagesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of LongTermRetentionBackupsOperations. + public virtual LongTermRetentionBackupsOperations LongTermRetentionBackups => new LongTermRetentionBackupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of LongTermRetentionManagedInstanceBackupsOperations. + public virtual LongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups => new LongTermRetentionManagedInstanceBackupsOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ManagedInstancesOperations. + public virtual ManagedInstancesOperations ManagedInstances => new ManagedInstancesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of RestorableDroppedDatabasesOperations. + public virtual RestorableDroppedDatabasesOperations RestorableDroppedDatabases => new RestorableDroppedDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of RestorableDroppedManagedDatabasesOperations. + public virtual RestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases => new RestorableDroppedManagedDatabasesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); + + /// Returns an instance of ServerConnectionPoliciesOperations. + public virtual ServerConnectionPoliciesOperations ServerConnectionPolicies => new ServerConnectionPoliciesOperations(_clientDiagnostics, _pipeline, _subscriptionId, _endpoint); } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsagesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsagesRestOperations.cs index 98505a4ee5bac..f53eeabac931f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsagesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SubscriptionUsagesRestOperations.cs @@ -55,7 +55,7 @@ internal HttpMessage CreateListByLocationRequest(string locationName) uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/usages", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -128,7 +128,7 @@ internal HttpMessage CreateGetRequest(string locationName, string usageName) uri.AppendPath(locationName, true); uri.AppendPath("/usages/", false); uri.AppendPath(usageName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentsRestOperations.cs index 5814a18012810..1026c62661e22 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncAgentsRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/syncAgents/", false); uri.AppendPath(syncAgentName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -153,7 +153,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/syncAgents/", false); uri.AppendPath(syncAgentName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -256,7 +256,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/syncAgents/", false); uri.AppendPath(syncAgentName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -343,7 +343,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/syncAgents", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -429,7 +429,7 @@ internal HttpMessage CreateGenerateKeyRequest(string resourceGroupName, string s uri.AppendPath("/syncAgents/", false); uri.AppendPath(syncAgentName, true); uri.AppendPath("/generateKey", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -525,7 +525,7 @@ internal HttpMessage CreateListLinkedDatabasesRequest(string resourceGroupName, uri.AppendPath("/syncAgents/", false); uri.AppendPath(syncAgentName, true); uri.AppendPath("/linkedDatabases", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupsOperations.cs index b4fb7e18e4d6f..2f74fbbd34159 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupsOperations.cs @@ -382,7 +382,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// The continuation token for this operation. /// The cancellation token to use. /// , , , , , or is null. - public virtual AsyncPageable ListLogsAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum65 type, string continuationToken = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListLogsAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum60 type, string continuationToken = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -453,7 +453,7 @@ async Task> NextPageFunc(string nextLink, int? page /// The continuation token for this operation. /// The cancellation token to use. /// , , , , , or is null. - public virtual Pageable ListLogs(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum65 type, string continuationToken = null, CancellationToken cancellationToken = default) + public virtual Pageable ListLogs(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum60 type, string continuationToken = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupsRestOperations.cs index 93e7af9f1714f..d1089d8e92ca6 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupsRestOperations.cs @@ -55,7 +55,7 @@ internal HttpMessage CreateListSyncDatabaseIdsRequest(string locationName) uri.AppendPath("/providers/Microsoft.Sql/locations/", false); uri.AppendPath(locationName, true); uri.AppendPath("/syncDatabaseIds", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -133,7 +133,7 @@ internal HttpMessage CreateRefreshHubSchemaRequest(string resourceGroupName, str uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); uri.AppendPath("/refreshHubSchema", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -232,7 +232,7 @@ internal HttpMessage CreateListHubSchemasRequest(string resourceGroupName, strin uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); uri.AppendPath("/hubSchemas", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -322,7 +322,7 @@ public Response ListHubSchemas(string resour } } - internal HttpMessage CreateListLogsRequest(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum65 type, string continuationToken) + internal HttpMessage CreateListLogsRequest(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum60 type, string continuationToken) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -347,7 +347,7 @@ internal HttpMessage CreateListLogsRequest(string resourceGroupName, string serv { uri.AppendQuery("continuationToken", continuationToken, true); } - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -364,7 +364,7 @@ internal HttpMessage CreateListLogsRequest(string resourceGroupName, string serv /// The continuation token for this operation. /// The cancellation token to use. /// , , , , , or is null. - public async Task> ListLogsAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum65 type, string continuationToken = null, CancellationToken cancellationToken = default) + public async Task> ListLogsAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum60 type, string continuationToken = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -418,7 +418,7 @@ public async Task> ListLogsAsync(string resourc /// The continuation token for this operation. /// The cancellation token to use. /// , , , , , or is null. - public Response ListLogs(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum65 type, string continuationToken = null, CancellationToken cancellationToken = default) + public Response ListLogs(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum60 type, string continuationToken = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -479,7 +479,7 @@ internal HttpMessage CreateCancelSyncRequest(string resourceGroupName, string se uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); uri.AppendPath("/cancelSync", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -576,7 +576,7 @@ internal HttpMessage CreateTriggerSyncRequest(string resourceGroupName, string s uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); uri.AppendPath("/triggerSync", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -672,7 +672,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -779,7 +779,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -894,7 +894,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(databaseName, true); uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -994,7 +994,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath(databaseName, true); uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1106,7 +1106,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/syncGroups", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1370,7 +1370,7 @@ public Response ListHubSchemasNextPage(strin } } - internal HttpMessage CreateListLogsNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum65 type, string continuationToken) + internal HttpMessage CreateListLogsNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum60 type, string continuationToken) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1395,7 +1395,7 @@ internal HttpMessage CreateListLogsNextPageRequest(string nextLink, string resou /// The continuation token for this operation. /// The cancellation token to use. /// , , , , , , or is null. - public async Task> ListLogsNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum65 type, string continuationToken = null, CancellationToken cancellationToken = default) + public async Task> ListLogsNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum60 type, string continuationToken = null, CancellationToken cancellationToken = default) { if (nextLink == null) { @@ -1454,7 +1454,7 @@ public async Task> ListLogsNextPageAsync(string /// The continuation token for this operation. /// The cancellation token to use. /// , , , , , , or is null. - public Response ListLogsNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum65 type, string continuationToken = null, CancellationToken cancellationToken = default) + public Response ListLogsNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, Enum60 type, string continuationToken = null, CancellationToken cancellationToken = default) { if (nextLink == null) { diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMembersRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMembersRestOperations.cs index 161eb68fe9232..6be1bd5dc3f13 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMembersRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncMembersRestOperations.cs @@ -62,7 +62,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(syncGroupName, true); uri.AppendPath("/syncMembers/", false); uri.AppendPath(syncMemberName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -181,7 +181,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(syncGroupName, true); uri.AppendPath("/syncMembers/", false); uri.AppendPath(syncMemberName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -308,7 +308,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(syncGroupName, true); uri.AppendPath("/syncMembers/", false); uri.AppendPath(syncMemberName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -420,7 +420,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string server uri.AppendPath(syncGroupName, true); uri.AppendPath("/syncMembers/", false); uri.AppendPath(syncMemberName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -544,7 +544,7 @@ internal HttpMessage CreateListBySyncGroupRequest(string resourceGroupName, stri uri.AppendPath("/syncGroups/", false); uri.AppendPath(syncGroupName, true); uri.AppendPath("/syncMembers", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -654,7 +654,7 @@ internal HttpMessage CreateListMemberSchemasRequest(string resourceGroupName, st uri.AppendPath("/syncMembers/", false); uri.AppendPath(syncMemberName, true); uri.AppendPath("/schemas", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -774,7 +774,7 @@ internal HttpMessage CreateRefreshMemberSchemaRequest(string resourceGroupName, uri.AppendPath("/syncMembers/", false); uri.AppendPath(syncMemberName, true); uri.AppendPath("/refreshSchema", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TdeCertificatesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TdeCertificatesRestOperations.cs index 0d016b3f031c9..a1875e116e296 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TdeCertificatesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TdeCertificatesRestOperations.cs @@ -56,7 +56,7 @@ internal HttpMessage CreateCreateRequest(string resourceGroupName, string server uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/tdeCertificates", false); - uri.AppendQuery("api-version", "2017-10-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TimeZonesOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TimeZonesOperations.cs new file mode 100644 index 0000000000000..4da32f3047e6e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TimeZonesOperations.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + /// The TimeZones service client. + public partial class TimeZonesOperations + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HttpPipeline _pipeline; + internal TimeZonesRestOperations RestClient { get; } + + /// Initializes a new instance of TimeZonesOperations for mocking. + protected TimeZonesOperations() + { + } + + /// Initializes a new instance of TimeZonesOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + internal TimeZonesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + RestClient = new TimeZonesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + /// Gets a managed instance time zone. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + public virtual async Task> GetAsync(string locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TimeZonesOperations.Get"); + scope.Start(); + try + { + return await RestClient.GetAsync(locationName, timeZoneId, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a managed instance time zone. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + public virtual Response Get(string locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("TimeZonesOperations.Get"); + scope.Start(); + try + { + return RestClient.Get(locationName, timeZoneId, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of managed instance time zones by location. + /// The String to use. + /// The cancellation token to use. + /// is null. + public virtual AsyncPageable ListByLocationAsync(string locationName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TimeZonesOperations.ListByLocation"); + scope.Start(); + try + { + var response = await RestClient.ListByLocationAsync(locationName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TimeZonesOperations.ListByLocation"); + scope.Start(); + try + { + var response = await RestClient.ListByLocationNextPageAsync(nextLink, locationName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of managed instance time zones by location. + /// The String to use. + /// The cancellation token to use. + /// is null. + public virtual Pageable ListByLocation(string locationName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TimeZonesOperations.ListByLocation"); + scope.Start(); + try + { + var response = RestClient.ListByLocation(locationName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TimeZonesOperations.ListByLocation"); + scope.Start(); + try + { + var response = RestClient.ListByLocationNextPage(nextLink, locationName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TimeZonesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TimeZonesRestOperations.cs new file mode 100644 index 0000000000000..01773db2a3b57 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TimeZonesRestOperations.cs @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal partial class TimeZonesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of TimeZonesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The subscription ID that identifies an Azure subscription. + /// server parameter. + /// is null. + public TimeZonesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + endpoint ??= new Uri("https://management.azure.com"); + + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListByLocationRequest(string locationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/timeZones", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of managed instance time zones by location. + /// The String to use. + /// The cancellation token to use. + /// is null. + public async Task> ListByLocationAsync(string locationName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationRequest(locationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TimeZoneListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TimeZoneListResult.DeserializeTimeZoneListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of managed instance time zones by location. + /// The String to use. + /// The cancellation token to use. + /// is null. + public Response ListByLocation(string locationName, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationRequest(locationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TimeZoneListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TimeZoneListResult.DeserializeTimeZoneListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string locationName, string timeZoneId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Sql/locations/", false); + uri.AppendPath(locationName, true); + uri.AppendPath("/timeZones/", false); + uri.AppendPath(timeZoneId, true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a managed instance time zone. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (timeZoneId == null) + { + throw new ArgumentNullException(nameof(timeZoneId)); + } + + using var message = CreateGetRequest(locationName, timeZoneId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Models.TimeZone value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Models.TimeZone.DeserializeTimeZone(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a managed instance time zone. + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// or is null. + public Response Get(string locationName, string timeZoneId, CancellationToken cancellationToken = default) + { + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + if (timeZoneId == null) + { + throw new ArgumentNullException(nameof(timeZoneId)); + } + + using var message = CreateGetRequest(locationName, timeZoneId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Models.TimeZone value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Models.TimeZone.DeserializeTimeZone(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByLocationNextPageRequest(string nextLink, string locationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of managed instance time zones by location. + /// The URL to the next page of results. + /// The String to use. + /// The cancellation token to use. + /// or is null. + public async Task> ListByLocationNextPageAsync(string nextLink, string locationName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationNextPageRequest(nextLink, locationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TimeZoneListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TimeZoneListResult.DeserializeTimeZoneListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of managed instance time zones by location. + /// The URL to the next page of results. + /// The String to use. + /// The cancellation token to use. + /// or is null. + public Response ListByLocationNextPage(string nextLink, string locationName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (locationName == null) + { + throw new ArgumentNullException(nameof(locationName)); + } + + using var message = CreateListByLocationNextPageRequest(nextLink, locationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TimeZoneListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TimeZoneListResult.DeserializeTimeZoneListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionsOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionsOperations.cs index 8e4fabb5eff9e..8ea28aa94ea0b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionsOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionsOperations.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Azure; +using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager.Sql.Models; @@ -38,20 +39,19 @@ internal TransparentDataEncryptionsOperations(ClientDiagnostics clientDiagnostic _pipeline = pipeline; } - /// Creates or updates a database's transparent data encryption configuration. + /// Gets a logical database's transparent data encryption. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which setting the transparent data encryption applies. - /// The name of the transparent data encryption configuration. - /// The required parameters for creating or updating transparent data encryption. + /// The name of the logical database for which the transparent data encryption is defined. + /// The name of the transparent data encryption configuration. /// The cancellation token to use. - public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, TransparentDataEncryption parameters, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.Get"); scope.Start(); try { - return await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, parameters, cancellationToken).ConfigureAwait(false); + return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, tdeName, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -60,20 +60,19 @@ public virtual async Task> CreateOrUpdateAsy } } - /// Creates or updates a database's transparent data encryption configuration. + /// Gets a logical database's transparent data encryption. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which setting the transparent data encryption applies. - /// The name of the transparent data encryption configuration. - /// The required parameters for creating or updating transparent data encryption. + /// The name of the logical database for which the transparent data encryption is defined. + /// The name of the transparent data encryption configuration. /// The cancellation token to use. - public virtual Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, TransparentDataEncryption parameters, CancellationToken cancellationToken = default) + public virtual Response Get(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.Get"); scope.Start(); try { - return RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, parameters, cancellationToken); + return RestClient.Get(resourceGroupName, serverName, databaseName, tdeName, cancellationToken); } catch (Exception e) { @@ -82,19 +81,20 @@ public virtual Response CreateOrUpdate(string resourc } } - /// Gets a database's transparent data encryption configuration. + /// Updates a logical database's transparent data encryption configuration. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which the transparent data encryption applies. - /// The name of the transparent data encryption configuration. + /// The name of the logical database for which the security alert policy is defined. + /// The name of the transparent data encryption configuration. + /// The database transparent data encryption. /// The cancellation token to use. - public virtual async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, LogicalDatabaseTransparentDataEncryption parameters, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.CreateOrUpdate"); scope.Start(); try { - return await RestClient.GetAsync(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, cancellationToken).ConfigureAwait(false); + return await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, tdeName, parameters, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -103,19 +103,20 @@ public virtual async Task> GetAsync(string r } } - /// Gets a database's transparent data encryption configuration. + /// Updates a logical database's transparent data encryption configuration. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which the transparent data encryption applies. - /// The name of the transparent data encryption configuration. + /// The name of the logical database for which the security alert policy is defined. + /// The name of the transparent data encryption configuration. + /// The database transparent data encryption. /// The cancellation token to use. - public virtual Response Get(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + public virtual Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, LogicalDatabaseTransparentDataEncryption parameters, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.Get"); + using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.CreateOrUpdate"); scope.Start(); try { - return RestClient.Get(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, cancellationToken); + return RestClient.CreateOrUpdate(resourceGroupName, serverName, databaseName, tdeName, parameters, cancellationToken); } catch (Exception e) { @@ -123,5 +124,113 @@ public virtual Response Get(string resourceGroupName, throw; } } + + /// Gets a list of the logical database's transparent data encryption. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the logical database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , or is null. + public virtual AsyncPageable ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = await RestClient.ListByDatabaseNextPageAsync(nextLink, resourceGroupName, serverName, databaseName, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets a list of the logical database's transparent data encryption. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the logical database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , or is null. + public virtual Pageable ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabase(resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("TransparentDataEncryptionsOperations.ListByDatabase"); + scope.Start(); + try + { + var response = RestClient.ListByDatabaseNextPage(nextLink, resourceGroupName, serverName, databaseName, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionsRestOperations.cs index 3255be4c5994a..37e69002b05e1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/TransparentDataEncryptionsRestOperations.cs @@ -43,7 +43,106 @@ public TransparentDataEncryptionsRestOperations(ClientDiagnostics clientDiagnost _pipeline = pipeline; } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, TransparentDataEncryption parameters) + internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/servers/", false); + uri.AppendPath(serverName, true); + uri.AppendPath("/databases/", false); + uri.AppendPath(databaseName, true); + uri.AppendPath("/transparentDataEncryption/", false); + uri.AppendPath(tdeName.ToString(), true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a logical database's transparent data encryption. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the logical database for which the transparent data encryption is defined. + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, tdeName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LogicalDatabaseTransparentDataEncryption value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LogicalDatabaseTransparentDataEncryption.DeserializeLogicalDatabaseTransparentDataEncryption(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a logical database's transparent data encryption. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the logical database for which the transparent data encryption is defined. + /// The name of the transparent data encryption configuration. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, tdeName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LogicalDatabaseTransparentDataEncryption value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LogicalDatabaseTransparentDataEncryption.DeserializeLogicalDatabaseTransparentDataEncryption(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, LogicalDatabaseTransparentDataEncryption parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -59,8 +158,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/transparentDataEncryption/", false); - uri.AppendPath(transparentDataEncryptionName.ToString(), true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath(tdeName.ToString(), true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -70,15 +169,15 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin return message; } - /// Creates or updates a database's transparent data encryption configuration. + /// Updates a logical database's transparent data encryption configuration. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which setting the transparent data encryption applies. - /// The name of the transparent data encryption configuration. - /// The required parameters for creating or updating transparent data encryption. + /// The name of the logical database for which the security alert policy is defined. + /// The name of the transparent data encryption configuration. + /// The database transparent data encryption. /// The cancellation token to use. /// , , , or is null. - public async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, TransparentDataEncryption parameters, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, LogicalDatabaseTransparentDataEncryption parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -97,32 +196,34 @@ public async Task> CreateOrUpdateAsync(strin throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, parameters); + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, tdeName, parameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: case 201: { - TransparentDataEncryption value = default; + LogicalDatabaseTransparentDataEncryption value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TransparentDataEncryption.DeserializeTransparentDataEncryption(document.RootElement); + value = LogicalDatabaseTransparentDataEncryption.DeserializeLogicalDatabaseTransparentDataEncryption(document.RootElement); return Response.FromValue(value, message.Response); } + case 202: + return Response.FromValue(null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } - /// Creates or updates a database's transparent data encryption configuration. + /// Updates a logical database's transparent data encryption configuration. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which setting the transparent data encryption applies. - /// The name of the transparent data encryption configuration. - /// The required parameters for creating or updating transparent data encryption. + /// The name of the logical database for which the security alert policy is defined. + /// The name of the transparent data encryption configuration. + /// The database transparent data encryption. /// The cancellation token to use. /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, TransparentDataEncryption parameters, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName tdeName, LogicalDatabaseTransparentDataEncryption parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -141,24 +242,26 @@ public Response CreateOrUpdate(string resourceGroupNa throw new ArgumentNullException(nameof(parameters)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, transparentDataEncryptionName, parameters); + using var message = CreateCreateOrUpdateRequest(resourceGroupName, serverName, databaseName, tdeName, parameters); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: case 201: { - TransparentDataEncryption value = default; + LogicalDatabaseTransparentDataEncryption value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TransparentDataEncryption.DeserializeTransparentDataEncryption(document.RootElement); + value = LogicalDatabaseTransparentDataEncryption.DeserializeLogicalDatabaseTransparentDataEncryption(document.RootElement); return Response.FromValue(value, message.Response); } + case 202: + return Response.FromValue(null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName) + internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, string serverName, string databaseName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -173,22 +276,20 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); - uri.AppendPath("/transparentDataEncryption/", false); - uri.AppendPath(transparentDataEncryptionName.ToString(), true); - uri.AppendQuery("api-version", "2014-04-01", true); + uri.AppendPath("/transparentDataEncryption", false); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which the transparent data encryption applies. - /// The name of the transparent data encryption configuration. + /// The name of the logical database for which the transparent data encryption is defined. /// The cancellation token to use. /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + public async Task> ListByDatabaseAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -203,15 +304,15 @@ public async Task> GetAsync(string resourceG throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, transparentDataEncryptionName); + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - TransparentDataEncryption value = default; + LogicalDatabaseTransparentDataEncryptionListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TransparentDataEncryption.DeserializeTransparentDataEncryption(document.RootElement); + value = LogicalDatabaseTransparentDataEncryptionListResult.DeserializeLogicalDatabaseTransparentDataEncryptionListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -219,15 +320,111 @@ public async Task> GetAsync(string resourceG } } - /// Gets a database's transparent data encryption configuration. + /// Gets a list of the logical database's transparent data encryption. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the server. - /// The name of the database for which the transparent data encryption applies. - /// The name of the transparent data encryption configuration. + /// The name of the logical database for which the transparent data encryption is defined. /// The cancellation token to use. /// , , or is null. - public Response Get(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionName transparentDataEncryptionName, CancellationToken cancellationToken = default) + public Response ListByDatabase(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseRequest(resourceGroupName, serverName, databaseName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LogicalDatabaseTransparentDataEncryptionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LogicalDatabaseTransparentDataEncryptionListResult.DeserializeLogicalDatabaseTransparentDataEncryptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDatabaseNextPageRequest(string nextLink, string resourceGroupName, string serverName, string databaseName) { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets a list of the logical database's transparent data encryption. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the logical database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , , or is null. + public async Task> ListByDatabaseNextPageAsync(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (serverName == null) + { + throw new ArgumentNullException(nameof(serverName)); + } + if (databaseName == null) + { + throw new ArgumentNullException(nameof(databaseName)); + } + + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LogicalDatabaseTransparentDataEncryptionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LogicalDatabaseTransparentDataEncryptionListResult.DeserializeLogicalDatabaseTransparentDataEncryptionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets a list of the logical database's transparent data encryption. + /// The URL to the next page of results. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the server. + /// The name of the logical database for which the transparent data encryption is defined. + /// The cancellation token to use. + /// , , , or is null. + public Response ListByDatabaseNextPage(string nextLink, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -241,15 +438,15 @@ public Response Get(string resourceGroupName, string throw new ArgumentNullException(nameof(databaseName)); } - using var message = CreateGetRequest(resourceGroupName, serverName, databaseName, transparentDataEncryptionName); + using var message = CreateListByDatabaseNextPageRequest(nextLink, resourceGroupName, serverName, databaseName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - TransparentDataEncryption value = default; + LogicalDatabaseTransparentDataEncryptionListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TransparentDataEncryption.DeserializeTransparentDataEncryption(document.RootElement); + value = LogicalDatabaseTransparentDataEncryptionListResult.DeserializeLogicalDatabaseTransparentDataEncryptionListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/UsagesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/UsagesRestOperations.cs index 76deaebb77f37..48b8c1fdea3f8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/UsagesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/UsagesRestOperations.cs @@ -61,7 +61,7 @@ internal HttpMessage CreateListByInstancePoolRequest(string resourceGroupName, s { uri.AppendQuery("expandChildren", expandChildren.Value, true); } - uri.AppendQuery("api-version", "2018-06-01-preview", true); + uri.AppendQuery("api-version", "2021-02-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClustersOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClustersOperations.cs index a163b3ecf992e..43afe64e4529d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClustersOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClustersOperations.cs @@ -39,6 +39,44 @@ internal VirtualClustersOperations(ClientDiagnostics clientDiagnostics, HttpPipe _pipeline = pipeline; } + /// Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the virtual cluster. + /// The cancellation token to use. + public virtual async Task> UpdateDnsServersAsync(string resourceGroupName, string virtualClusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("VirtualClustersOperations.UpdateDnsServers"); + scope.Start(); + try + { + return await RestClient.UpdateDnsServersAsync(resourceGroupName, virtualClusterName, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the virtual cluster. + /// The cancellation token to use. + public virtual Response UpdateDnsServers(string resourceGroupName, string virtualClusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("VirtualClustersOperations.UpdateDnsServers"); + scope.Start(); + try + { + return RestClient.UpdateDnsServers(resourceGroupName, virtualClusterName, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Gets a virtual cluster. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the virtual cluster. @@ -302,7 +340,7 @@ public virtual VirtualClustersDeleteOperation StartDelete(string resourceGroupNa /// Updates a virtual cluster. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the virtual cluster. - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// The cancellation token to use. /// , , or is null. public virtual async Task StartUpdateAsync(string resourceGroupName, string virtualClusterName, VirtualClusterUpdate parameters, CancellationToken cancellationToken = default) @@ -337,7 +375,7 @@ public virtual async Task StartUpdateAsync(strin /// Updates a virtual cluster. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the virtual cluster. - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// The cancellation token to use. /// , , or is null. public virtual VirtualClustersUpdateOperation StartUpdate(string resourceGroupName, string virtualClusterName, VirtualClusterUpdate parameters, CancellationToken cancellationToken = default) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClustersRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClustersRestOperations.cs index 4ac6768fe9a55..1f30c39f69c46 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClustersRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualClustersRestOperations.cs @@ -43,6 +43,90 @@ public VirtualClustersRestOperations(ClientDiagnostics clientDiagnostics, HttpPi _pipeline = pipeline; } + internal HttpMessage CreateUpdateDnsServersRequest(string resourceGroupName, string virtualClusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Sql/virtualClusters/", false); + uri.AppendPath(virtualClusterName, true); + uri.AppendPath("/updateManagedInstanceDnsServers", false); + uri.AppendQuery("api-version", "2020-11-01-preview", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the virtual cluster. + /// The cancellation token to use. + /// or is null. + public async Task> UpdateDnsServersAsync(string resourceGroupName, string virtualClusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (virtualClusterName == null) + { + throw new ArgumentNullException(nameof(virtualClusterName)); + } + + using var message = CreateUpdateDnsServersRequest(resourceGroupName, virtualClusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UpdateManagedInstanceDnsServersOperation value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = UpdateManagedInstanceDnsServersOperation.DeserializeUpdateManagedInstanceDnsServersOperation(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the virtual cluster. + /// The cancellation token to use. + /// or is null. + public Response UpdateDnsServers(string resourceGroupName, string virtualClusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (virtualClusterName == null) + { + throw new ArgumentNullException(nameof(virtualClusterName)); + } + + using var message = CreateUpdateDnsServersRequest(resourceGroupName, virtualClusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UpdateManagedInstanceDnsServersOperation value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = UpdateManagedInstanceDnsServersOperation.DeserializeUpdateManagedInstanceDnsServersOperation(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + internal HttpMessage CreateListRequest() { var message = _pipeline.CreateMessage(); @@ -53,7 +137,7 @@ internal HttpMessage CreateListRequest() uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Sql/virtualClusters", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -111,7 +195,7 @@ internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/virtualClusters", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -184,7 +268,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string virtualCl uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/virtualClusters/", false); uri.AppendPath(virtualClusterName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -267,7 +351,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string virtua uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/virtualClusters/", false); uri.AppendPath(virtualClusterName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -343,7 +427,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string virtua uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Sql/virtualClusters/", false); uri.AppendPath(virtualClusterName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -356,7 +440,7 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string virtua /// Updates a virtual cluster. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the virtual cluster. - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// The cancellation token to use. /// , , or is null. public async Task UpdateAsync(string resourceGroupName, string virtualClusterName, VirtualClusterUpdate parameters, CancellationToken cancellationToken = default) @@ -389,7 +473,7 @@ public async Task UpdateAsync(string resourceGroupName, string virtual /// Updates a virtual cluster. /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. /// The name of the virtual cluster. - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// The cancellation token to use. /// , , or is null. public Response Update(string resourceGroupName, string virtualClusterName, VirtualClusterUpdate parameters, CancellationToken cancellationToken = default) diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualNetworkRulesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualNetworkRulesRestOperations.cs index defdd77afc035..1c8b6c12e96ac 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualNetworkRulesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/VirtualNetworkRulesRestOperations.cs @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(serverName, true); uri.AppendPath("/virtualNetworkRules/", false); uri.AppendPath(virtualNetworkRuleName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -153,7 +153,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(serverName, true); uri.AppendPath("/virtualNetworkRules/", false); uri.AppendPath(virtualNetworkRuleName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -256,7 +256,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(serverName, true); uri.AppendPath("/virtualNetworkRules/", false); uri.AppendPath(virtualNetworkRuleName, true); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -343,7 +343,7 @@ internal HttpMessage CreateListByServerRequest(string resourceGroupName, string uri.AppendPath("/providers/Microsoft.Sql/servers/", false); uri.AppendPath(serverName, true); uri.AppendPath("/virtualNetworkRules", false); - uri.AppendQuery("api-version", "2015-05-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifiersRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifiersRestOperations.cs index a77d7a226de74..0252c908858d1 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifiersRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadClassifiersRestOperations.cs @@ -62,7 +62,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(workloadGroupName, true); uri.AppendPath("/workloadClassifiers/", false); uri.AppendPath(workloadClassifierName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -181,7 +181,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(workloadGroupName, true); uri.AppendPath("/workloadClassifiers/", false); uri.AppendPath(workloadClassifierName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -308,7 +308,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(workloadGroupName, true); uri.AppendPath("/workloadClassifiers/", false); uri.AppendPath(workloadClassifierName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -419,7 +419,7 @@ internal HttpMessage CreateListByWorkloadGroupRequest(string resourceGroupName, uri.AppendPath("/workloadGroups/", false); uri.AppendPath(workloadGroupName, true); uri.AppendPath("/workloadClassifiers", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupsRestOperations.cs index a00cd2775d4c5..9dba8835f4a22 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupsRestOperations.cs @@ -60,7 +60,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string serverNam uri.AppendPath(databaseName, true); uri.AppendPath("/workloadGroups/", false); uri.AppendPath(workloadGroupName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -167,7 +167,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin uri.AppendPath(databaseName, true); uri.AppendPath("/workloadGroups/", false); uri.AppendPath(workloadGroupName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -282,7 +282,7 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string server uri.AppendPath(databaseName, true); uri.AppendPath("/workloadGroups/", false); uri.AppendPath(workloadGroupName, true); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; return message; } @@ -381,7 +381,7 @@ internal HttpMessage CreateListByDatabaseRequest(string resourceGroupName, strin uri.AppendPath("/databases/", false); uri.AppendPath(databaseName, true); uri.AppendPath("/workloadGroups", false); - uri.AppendQuery("api-version", "2019-06-01-preview", true); + uri.AppendQuery("api-version", "2020-11-01-preview", true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index e09ea8c1d6ebc..467ab594f297b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md @@ -5,7 +5,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/50a94ccd66f49aed78efa24ceefd0d5c1186c8db/specification/sql/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/6eecb8004e9a47c98328dbe18676e95addcc78cf/specification/sql/resource-manager/readme.md modelerfour: lenient-model-deduplication: true