From c63d7ee0b8271cffbcf244c489375ede9224e370 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 May 2021 19:55:49 +0000 Subject: [PATCH] CodeGen from PR 14251 in Azure/azure-rest-api-specs Merge 1ada54ea7098a18242b7674a36785d8a2a814525 into a394eccc2ce26369cacbc113cf0c3a9c9501e689 --- ...kupShortTermRetentionPoliciesOperations.cs | 8 +- .../src/Generated/CapabilitiesOperations.cs | 2 +- .../DataWarehouseUserActivitiesOperations.cs | 641 +++++++++ ...ouseUserActivitiesOperationsExtensions.cs} | 80 +- .../Generated/DatabaseAdvisorsOperations.cs | 706 ++++++++++ .../DatabaseAdvisorsOperationsExtensions.cs | 195 +++ .../DatabaseAutomaticTuningOperations.cs | 4 +- .../DatabaseBlobAuditingPoliciesOperations.cs | 6 +- .../Generated/DatabaseColumnsOperations.cs | 1146 ++++++++++++++++ .../DatabaseColumnsOperationsExtensions.cs | 298 +++++ .../Generated/DatabaseExtensionsOperations.cs | 886 +++++++++++++ .../DatabaseExtensionsOperationsExtensions.cs | 278 ++++ .../src/Generated/DatabaseOperations.cs | 4 +- .../DatabaseRecommendedActionsOperations.cs | 725 ++++++++++ ...eRecommendedActionsOperationsExtensions.cs | 207 +++ .../Generated/DatabaseSchemasOperations.cs | 657 +++++++++ .../DatabaseSchemasOperationsExtensions.cs | 168 +++ ...DatabaseSecurityAlertPoliciesOperations.cs | 881 +++++++++++++ ...curityAlertPoliciesOperationsExtensions.cs | 209 +++ .../src/Generated/DatabaseTablesOperations.cs | 675 ++++++++++ .../DatabaseTablesOperationsExtensions.cs | 180 +++ .../src/Generated/DatabaseUsagesOperations.cs | 195 ++- .../DatabaseUsagesOperationsExtensions.cs | 44 +- ...bilityAssessmentRuleBaselinesOperations.cs | 6 +- ...eVulnerabilityAssessmentScansOperations.cs | 66 +- ...lityAssessmentScansOperationsExtensions.cs | 54 +- ...abaseVulnerabilityAssessmentsOperations.cs | 8 +- .../src/Generated/DatabasesOperations.cs | 705 ++++++---- .../DatabasesOperationsExtensions.cs | 224 +++- .../src/Generated/DeletedServersOperations.cs | 1171 +++++++++++++++++ .../DeletedServersOperationsExtensions.cs | 275 ++++ .../src/Generated/ElasticPoolOperations.cs | 4 +- .../src/Generated/ElasticPoolsOperations.cs | 12 +- .../EncryptionProtectorsOperations.cs | 154 +-- ...ncryptionProtectorsOperationsExtensions.cs | 86 +- ...dDatabaseBlobAuditingPoliciesOperations.cs | 6 +- ...dedServerBlobAuditingPoliciesOperations.cs | 6 +- .../src/Generated/FailoverGroupsOperations.cs | 14 +- .../src/Generated/FirewallRulesOperations.cs | 473 ++++++- .../FirewallRulesOperationsExtensions.cs | 118 +- .../IDataWarehouseUserActivitiesOperations.cs | 112 ++ .../Generated/IDatabaseAdvisorsOperations.cs | 129 ++ .../Generated/IDatabaseColumnsOperations.cs | 191 +++ .../IDatabaseExtensionsOperations.cs | 181 +++ .../IDatabaseRecommendedActionsOperations.cs | 135 ++ .../Generated/IDatabaseSchemasOperations.cs | 116 ++ ...DatabaseSecurityAlertPoliciesOperations.cs | 145 ++ .../Generated/IDatabaseTablesOperations.cs | 122 ++ .../Generated/IDatabaseUsagesOperations.cs | 26 +- ...eVulnerabilityAssessmentScansOperations.cs | 24 +- .../src/Generated/IDatabasesOperations.cs | 134 +- .../Generated/IDeletedServersOperations.cs | 187 +++ .../IEncryptionProtectorsOperations.cs | 48 +- .../src/Generated/IFirewallRulesOperations.cs | 65 +- .../IMaintenanceWindowOptionsOperations.cs | 60 + ...ns.cs => IMaintenanceWindowsOperations.cs} | 28 +- .../IManagedDatabaseColumnsOperations.cs | 191 +++ .../IManagedDatabaseQueriesOperations.cs | 123 ++ ...eRecommendedSensitivityLabelsOperations.cs | 57 + .../IManagedDatabaseSchemasOperations.cs | 116 ++ ...anagedDatabaseSecurityEventsOperations.cs} | 43 +- ...agedDatabaseSensitivityLabelsOperations.cs | 42 +- .../IManagedDatabaseTablesOperations.cs | 122 ++ ...baseTransparentDataEncryptionOperations.cs | 145 ++ ...eVulnerabilityAssessmentScansOperations.cs | 38 +- .../Generated/IManagedInstanceOperations.cs | 22 +- ...ncePrivateEndpointConnectionsOperations.cs | 220 ++++ ...dInstancePrivateLinkResourcesOperations.cs | 106 ++ .../Generated/IManagedInstancesOperations.cs | 68 +- ...kupShortTermRetentionPoliciesOperations.cs | 16 +- .../Generated/IOperationsHealthOperations.cs | 71 + ...IRecommendedSensitivityLabelsOperations.cs | 57 + .../IRestorableDroppedDatabasesOperations.cs | 36 +- .../src/Generated/IRestorePointsOperations.cs | 24 +- .../Generated/ISensitivityLabelsOperations.cs | 42 +- ...ations.cs => IServerAdvisorsOperations.cs} | 30 +- .../Generated/IServerDnsAliasesOperations.cs | 24 +- .../src/Generated/IServerKeysOperations.cs | 8 +- .../src/Generated/IServerOperations.cs | 76 ++ .../src/Generated/IServersOperations.cs | 45 +- ...rtOperations.cs => ISqlAgentOperations.cs} | 30 +- .../src/Generated/ISqlManagementClient.cs | 400 ++++-- .../src/Generated/ITimeZonesOperations.cs | 93 ++ .../Generated/IVirtualClustersOperations.cs | 32 +- .../InstanceFailoverGroupsOperations.cs | 12 +- .../src/Generated/InstancePoolsOperations.cs | 12 +- .../src/Generated/JobAgentsOperations.cs | 10 +- .../src/Generated/JobCredentialsOperations.cs | 8 +- .../src/Generated/JobExecutionsOperations.cs | 12 +- .../Generated/JobStepExecutionsOperations.cs | 4 +- .../src/Generated/JobStepsOperations.cs | 12 +- .../JobTargetExecutionsOperations.cs | 6 +- .../Generated/JobTargetGroupsOperations.cs | 8 +- .../src/Generated/JobVersionsOperations.cs | 4 +- .../src/Generated/JobsOperations.cs | 8 +- ...tentionManagedInstanceBackupsOperations.cs | 20 +- ... => MaintenanceWindowOptionsOperations.cs} | 81 +- ...enanceWindowOptionsOperationsExtensions.cs | 79 ++ ...ons.cs => MaintenanceWindowsOperations.cs} | 123 +- ...MaintenanceWindowsOperationsExtensions.cs} | 57 +- ...kupShortTermRetentionPoliciesOperations.cs | 8 +- .../ManagedDatabaseColumnsOperations.cs | 1146 ++++++++++++++++ ...agedDatabaseColumnsOperationsExtensions.cs | 298 +++++ .../ManagedDatabaseQueriesOperations.cs | 676 ++++++++++ ...agedDatabaseQueriesOperationsExtensions.cs | 183 +++ ...eRecommendedSensitivityLabelsOperations.cs | 251 ++++ ...edSensitivityLabelsOperationsExtensions.cs | 76 ++ ...ManagedDatabaseRestoreDetailsOperations.cs | 2 +- .../ManagedDatabaseSchemasOperations.cs | 657 +++++++++ ...agedDatabaseSchemasOperationsExtensions.cs | 168 +++ ...DatabaseSecurityAlertPoliciesOperations.cs | 6 +- ...ManagedDatabaseSecurityEventsOperations.cs | 453 +++++++ ...abaseSecurityEventsOperationsExtensions.cs | 122 ++ ...agedDatabaseSensitivityLabelsOperations.cs | 242 +++- ...seSensitivityLabelsOperationsExtensions.cs | 81 +- .../ManagedDatabaseTablesOperations.cs | 675 ++++++++++ ...nagedDatabaseTablesOperationsExtensions.cs | 180 +++ ...baseTransparentDataEncryptionOperations.cs | 884 +++++++++++++ ...arentDataEncryptionOperationsExtensions.cs | 215 +++ ...bilityAssessmentRuleBaselinesOperations.cs | 6 +- ...eVulnerabilityAssessmentScansOperations.cs | 166 +-- ...lityAssessmentScansOperationsExtensions.cs | 86 +- ...abaseVulnerabilityAssessmentsOperations.cs | 8 +- .../Generated/ManagedDatabasesOperations.cs | 14 +- ...ManagedInstanceAdministratorsOperations.cs | 8 +- ...nceAzureADOnlyAuthenticationsOperations.cs | 8 +- ...dInstanceEncryptionProtectorsOperations.cs | 8 +- .../ManagedInstanceKeysOperations.cs | 8 +- ...anceLongTermRetentionPoliciesOperations.cs | 6 +- .../Generated/ManagedInstanceOperations.cs | 92 +- .../ManagedInstanceOperationsExtensions.cs | 50 +- ...ncePrivateEndpointConnectionsOperations.cs | 1080 +++++++++++++++ ...EndpointConnectionsOperationsExtensions.cs | 335 +++++ ...dInstancePrivateLinkResourcesOperations.cs | 626 +++++++++ ...rivateLinkResourcesOperationsExtensions.cs | 149 +++ ...anagedInstanceTdeCertificatesOperations.cs | 2 +- ...tanceVulnerabilityAssessmentsOperations.cs | 8 +- .../Generated/ManagedInstancesOperations.cs | 432 +++--- .../ManagedInstancesOperationsExtensions.cs | 140 +- ...kupShortTermRetentionPoliciesOperations.cs | 24 +- ...rmRetentionPoliciesOperationsExtensions.cs | 32 +- ...edServerSecurityAlertPoliciesOperations.cs | 6 +- .../src/Generated/Models/AdministratorType.cs | 21 + .../src/Generated/Models/Advisor.cs | 172 +++ .../src/Generated/Models/AdvisorStatus.cs | 72 + .../src/Generated/Models/AutoExecuteStatus.cs | 66 + .../Models/AutoExecuteStatusInheritedFrom.cs | 78 ++ .../src/Generated/Models/ColumnDataType.cs | 54 + .../Models/DataWarehouseUserActivities.cs | 61 + .../Models/DatabaseBlobAuditingPolicy.cs | 142 +- .../src/Generated/Models/DatabaseColumn.cs | 101 ++ .../Generated/Models/DatabaseExtensions.cs | 110 ++ .../src/Generated/Models/DatabaseSchema.cs | 46 + .../Models/DatabaseSecurityAlertPolicy.cs | 101 +- .../src/Generated/Models/DatabaseTable.cs | 70 + .../src/Generated/Models/DatabaseUsage.cs | 63 +- .../Models/DatabaseVulnerabilityAssessment.cs | 12 +- .../src/Generated/Models/DayOfWeek.cs | 27 + .../src/Generated/Models/DeletedServer.cs | 85 ++ .../Generated/Models/EncryptionProtector.cs | 11 +- .../ExtendedDatabaseBlobAuditingPolicy.cs | 142 +- .../ExtendedServerBlobAuditingPolicy.cs | 187 ++- .../src/Generated/Models/FirewallRule.cs | 57 +- .../src/Generated/Models/FirewallRuleList.cs | 51 + .../Generated/Models/ImplementationMethod.cs | 60 + .../ImportExportExtensionsOperationResult.cs | 108 ++ .../src/Generated/Models/IsRetryable.cs | 60 + .../src/Generated/Models/JobSchedule.cs | 4 +- .../Models/MaintenanceWindowOptions.cs | 119 ++ .../Models/MaintenanceWindowTimeRange.cs | 73 + .../Generated/Models/MaintenanceWindows.cs | 58 + .../ManagedDatabaseSecurityAlertPolicy.cs | 4 +- .../src/Generated/Models/ManagedInstance.cs | 33 +- .../ManagedInstanceEncryptionProtector.cs | 11 +- .../ManagedInstanceExternalAdministrator.cs | 100 ++ .../Generated/Models/ManagedInstanceKey.cs | 11 +- .../ManagedInstanceLongTermRetentionBackup.cs | 13 +- ...anagedInstancePrivateEndpointConnection.cs | 92 ++ .../Models/ManagedInstancePrivateLink.cs | 56 + .../ManagedInstancePrivateLinkProperties.cs | 64 + .../Generated/Models/ManagedInstanceQuery.cs | 58 + .../Generated/Models/ManagedInstanceUpdate.cs | 33 +- .../ManagedInstanceVulnerabilityAssessment.cs | 12 +- .../ManagedServerSecurityAlertPolicy.cs | 22 +- .../ManagedTransparentDataEncryption.cs | 71 + .../src/Generated/Models/OperationsHealth.cs | 76 ++ .../src/Generated/Models/PrincipalType.cs | 23 + .../Models/PrivateLinkResourceProperties.cs | 11 +- .../Models/ProxyResourceWithWritableName.cs | 48 + .../src/Generated/Models/QueryStatistics.cs | 95 ++ .../src/Generated/Models/RecommendedAction.cs | 320 +++++ .../Models/RecommendedActionCurrentState.cs | 34 + .../Models/RecommendedActionErrorInfo.cs | 67 + .../Models/RecommendedActionImpactRecord.cs | 98 ++ .../RecommendedActionImplementationInfo.cs | 68 + .../Models/RecommendedActionInitiatedBy.cs | 60 + .../Models/RecommendedActionMetricInfo.cs | 93 ++ .../Models/RecommendedActionStateInfo.cs | 128 ++ .../Models/RecommendedElasticPool.cs | 153 --- .../Models/RecommendedElasticPoolMetric.cs | 72 - .../src/Generated/Models/RecommendedIndex.cs | 171 --- .../Models/RecommendedIndexAction.cs | 66 - .../Generated/Models/RecommendedIndexState.cs | 114 -- .../Generated/Models/RecommendedIndexType.cs | 72 - .../RecommendedSensitivityLabelUpdate.cs | 106 ++ .../RecommendedSensitivityLabelUpdateKind.cs | 60 + .../RecommendedSensitivityLabelUpdateList.cs | 53 + ...urceIdentityWithUserAssignedIdentities.cs} | 24 +- .../Models/ResourceWithWritableName.cs | 69 + .../Models/RestorableDroppedDatabase.cs | 92 +- ...efault.cs => SecurityAlertsPolicyState.cs} | 22 +- .../src/Generated/Models/SecurityEvent.cs | 132 ++ ...tyEventSqlInjectionAdditionalProperties.cs | 103 ++ .../src/Generated/Models/SecurityEventType.cs | 66 + .../Models/SecurityEventsFilterParameters.cs | 62 + .../src/Generated/Models/SensitivityLabel.cs | 35 +- .../Models/SensitivityLabelUpdate.cs | 113 ++ .../Models/SensitivityLabelUpdateKind.cs | 60 + .../Models/SensitivityLabelUpdateList.cs | 51 + .../src/Generated/Models/Server.cs | 44 +- .../Models/ServerBlobAuditingPolicy.cs | 181 ++- .../Models/ServerDnsAliasAcquisition.cs | 18 +- .../Models/ServerExternalAdministrator.cs | 100 ++ .../src/Generated/Models/ServerKey.cs | 31 +- .../src/Generated/Models/ServerOperation.cs | 164 +++ .../Models/ServerSecurityAlertPolicy.cs | 22 +- .../src/Generated/Models/ServerUpdate.cs | 50 +- .../Models/ServerVulnerabilityAssessment.cs | 12 +- .../Models/ServerWorkspaceFeature.cs | 22 + .../Generated/Models/ServiceTierAdvisor.cs | 246 ---- .../Generated/Models/SqlAgentConfiguration.cs | 60 + .../src/Generated/Models/SyncGroup.cs | 41 +- .../src/Generated/Models/SystemData.cs | 56 +- ...ticPoolEdition.cs => TableTemporalType.cs} | 12 +- .../src/Generated/Models/TimeZone.cs | 66 + ...s.cs => TransparentDataEncryptionState.cs} | 22 +- ...pdateManagedInstanceDnsServersOperation.cs | 62 + .../src/Generated/Models/UserIdentity.cs | 61 + .../src/Generated/Models/VirtualCluster.cs | 12 +- .../Generated/Models/VirtualClusterUpdate.cs | 12 +- .../Generated/Models/VirtualNetworkRule.cs | 7 +- .../Models/VirtualNetworkRuleState.cs | 1 + .../src/Generated/Operations.cs | 2 +- .../Generated/OperationsHealthOperations.cs | 412 ++++++ .../OperationsHealthOperationsExtensions.cs | 93 ++ .../PrivateLinkResourcesOperations.cs | 4 +- .../RecommendedSensitivityLabelsOperations.cs | 251 ++++ ...edSensitivityLabelsOperationsExtensions.cs | 76 ++ .../RecoverableManagedDatabasesOperations.cs | 4 +- .../RestorableDroppedDatabasesOperations.cs | 239 +++- ...bleDroppedDatabasesOperationsExtensions.cs | 72 +- ...orableDroppedManagedDatabasesOperations.cs | 4 +- .../src/Generated/RestorePointsOperations.cs | 187 ++- .../RestorePointsOperationsExtensions.cs | 40 +- .../Generated/SdkInfo_SqlManagementClient.cs | 180 +-- .../Generated/SensitivityLabelsOperations.cs | 242 +++- .../SensitivityLabelsOperationsExtensions.cs | 81 +- ...rations.cs => ServerAdvisorsOperations.cs} | 134 +- ... => ServerAdvisorsOperationsExtensions.cs} | 68 +- .../ServerAutomaticTuningOperations.cs | 4 +- .../ServerAzureADAdministratorsOperations.cs | 56 +- ...verAzureADOnlyAuthenticationsOperations.cs | 8 +- .../ServerBlobAuditingPoliciesOperations.cs | 6 +- .../ServerDevOpsAuditSettingsOperations.cs | 6 +- .../Generated/ServerDnsAliasesOperations.cs | 57 +- .../ServerDnsAliasesOperationsExtensions.cs | 50 +- .../src/Generated/ServerKeysOperations.cs | 20 +- .../ServerKeysOperationsExtensions.cs | 24 +- .../src/Generated/ServerOperations.cs | 422 ++++++ .../Generated/ServerOperationsExtensions.cs | 101 ++ .../ServerSecurityAlertPoliciesOperations.cs | 6 +- .../Generated/ServerTrustGroupsOperations.cs | 10 +- ...erverVulnerabilityAssessmentsOperations.cs | 8 +- .../src/Generated/ServersOperations.cs | 98 +- .../Generated/ServersOperationsExtensions.cs | 102 +- ...iesOperations.cs => SqlAgentOperations.cs} | 119 +- ...ons.cs => SqlAgentOperationsExtensions.cs} | 64 +- .../src/Generated/SqlManagementClient.cs | 534 +++++--- .../Generated/SubscriptionUsagesOperations.cs | 4 +- .../src/Generated/SyncAgentsOperations.cs | 12 +- .../src/Generated/SyncGroupsOperations.cs | 26 +- .../src/Generated/SyncMembersOperations.cs | 14 +- .../Generated/TdeCertificatesOperations.cs | 2 +- .../src/Generated/TimeZonesOperations.cs | 603 +++++++++ .../TimeZonesOperationsExtensions.cs | 127 ++ .../Generated/VirtualClustersOperations.cs | 210 ++- .../VirtualClustersOperationsExtensions.cs | 52 +- .../VirtualNetworkRulesOperations.cs | 8 +- .../WorkloadClassifiersOperations.cs | 8 +- .../src/Generated/WorkloadGroupsOperations.cs | 8 +- 290 files changed, 33291 insertions(+), 4107 deletions(-) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{ServiceTierAdvisorsOperationsExtensions.cs => DataWarehouseUserActivitiesOperationsExtensions.cs} (52%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataWarehouseUserActivitiesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseAdvisorsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseColumnsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseExtensionsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseRecommendedActionsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSchemasOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSecurityAlertPoliciesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseTablesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDeletedServersOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowOptionsOperations.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{IServiceTierAdvisorsOperations.cs => IMaintenanceWindowsOperations.cs} (70%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseColumnsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseQueriesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseRecommendedSensitivityLabelsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSchemasOperations.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{IDatabaseThreatDetectionPoliciesOperations.cs => IManagedDatabaseSecurityEventsOperations.cs} (60%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTablesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTransparentDataEncryptionOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateEndpointConnectionsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateLinkResourcesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOperationsHealthOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedSensitivityLabelsOperations.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{IRecommendedElasticPoolsOperations.cs => IServerAdvisorsOperations.cs} (72%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerOperations.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{IImportExportOperations.cs => ISqlAgentOperations.cs} (66%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITimeZonesOperations.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{ImportExportOperations.cs => MaintenanceWindowOptionsOperations.cs} (74%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperationsExtensions.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{ServiceTierAdvisorsOperations.cs => MaintenanceWindowsOperations.cs} (83%) rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{DatabaseThreatDetectionPoliciesOperationsExtensions.cs => MaintenanceWindowsOperationsExtensions.cs} (57%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdministratorType.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Advisor.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdvisorStatus.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatus.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ColumnDataType.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataWarehouseUserActivities.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseColumn.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSchema.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseTable.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DayOfWeek.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DeletedServer.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRuleList.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImplementationMethod.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IsRetryable.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowOptions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindows.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceQuery.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationsHealth.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrincipalType.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/QueryStatistics.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedAction.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionCurrentState.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionStateInfo.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPool.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndex.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexAction.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexState.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexType.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/{ResourceIdentity.cs => ResourceIdentityWithUserAssignedIdentities.cs} (66%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceWithWritableName.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/{SecurityAlertPolicyUseServerDefault.cs => SecurityAlertsPolicyState.cs} (62%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEvent.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventType.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdate.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerExternalAdministrator.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerOperation.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerWorkspaceFeature.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceTierAdvisor.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SqlAgentConfiguration.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/{ElasticPoolEdition.cs => TableTemporalType.cs} (55%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TimeZone.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/{SecurityAlertPolicyEmailAccountAdmins.cs => TransparentDataEncryptionState.cs} (55%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UserIdentity.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperationsExtensions.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperationsExtensions.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{RecommendedElasticPoolsOperations.cs => ServerAdvisorsOperations.cs} (87%) rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{RecommendedElasticPoolsOperationsExtensions.cs => ServerAdvisorsOperationsExtensions.cs} (61%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperationsExtensions.cs rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{DatabaseThreatDetectionPoliciesOperations.cs => SqlAgentOperations.cs} (79%) rename sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/{ImportExportOperationsExtensions.cs => SqlAgentOperationsExtensions.cs} (50%) create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperations.cs create mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperationsExtensions.cs diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupShortTermRetentionPoliciesOperations.cs index b4519b7cbb988..dc43a012367e5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/BackupShortTermRetentionPoliciesOperations.cs @@ -103,7 +103,7 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,7 +367,7 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -579,7 +579,7 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -800,7 +800,7 @@ internal BackupShortTermRetentionPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/CapabilitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/CapabilitiesOperations.cs index 72cf135164d94..40283bad0a1ba 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/CapabilitiesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/CapabilitiesOperations.cs @@ -93,7 +93,7 @@ internal CapabilitiesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs new file mode 100644 index 0000000000000..9f0b7ec3cde0b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperations.cs @@ -0,0 +1,641 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataWarehouseUserActivitiesOperations operations. + /// + internal partial class DataWarehouseUserActivitiesOperations : IServiceOperations, IDataWarehouseUserActivitiesOperations + { + /// + /// Initializes a new instance of the DataWarehouseUserActivitiesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DataWarehouseUserActivitiesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string dataWarehouseUserActivityName = "current"; + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("dataWarehouseUserActivityName", dataWarehouseUserActivityName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{dataWarehouseUserActivityName}", System.Uri.EscapeDataString(dataWarehouseUserActivityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataWarehouseUserActivities").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the user activities of a data warehouse which includes running and + /// suspended queries + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperationsExtensions.cs similarity index 52% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperationsExtensions.cs index 251b52dc94702..7a9e1e8ce98fb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DataWarehouseUserActivitiesOperationsExtensions.cs @@ -13,18 +13,17 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; /// - /// Extension methods for ServiceTierAdvisorsOperations. + /// Extension methods for DataWarehouseUserActivitiesOperations. /// - public static partial class ServiceTierAdvisorsOperationsExtensions + public static partial class DataWarehouseUserActivitiesOperationsExtensions { /// - /// Gets a service tier advisor. + /// Gets the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The operations group for this extension method. @@ -37,18 +36,16 @@ public static partial class ServiceTierAdvisorsOperationsExtensions /// The name of the server. /// /// - /// The name of database. + /// The name of the database. /// - /// - /// The name of service tier advisor. - /// - public static ServiceTierAdvisor Get(this IServiceTierAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName) + public static DataWarehouseUserActivities Get(this IDataWarehouseUserActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Gets a service tier advisor. + /// Gets the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The operations group for this extension method. @@ -61,24 +58,22 @@ public static ServiceTierAdvisor Get(this IServiceTierAdvisorsOperations operati /// The name of the server. /// /// - /// The name of database. - /// - /// - /// The name of service tier advisor. + /// The name of the database. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IServiceTierAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IDataWarehouseUserActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns service tier advisors for specified database. + /// List the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The operations group for this extension method. @@ -91,15 +86,16 @@ public static ServiceTierAdvisor Get(this IServiceTierAdvisorsOperations operati /// The name of the server. /// /// - /// The name of database. + /// The name of the database. /// - public static IEnumerable ListByDatabase(this IServiceTierAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this IDataWarehouseUserActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName) { return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Returns service tier advisors for specified database. + /// List the user activities of a data warehouse which includes running and + /// suspended queries /// /// /// The operations group for this extension method. @@ -112,12 +108,12 @@ public static IEnumerable ListByDatabase(this IServiceTierAd /// The name of the server. /// /// - /// The name of database. + /// The name of the database. /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IServiceTierAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDataWarehouseUserActivitiesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { @@ -125,5 +121,41 @@ public static IEnumerable ListByDatabase(this IServiceTierAd } } + /// + /// List the user activities of a data warehouse which includes running and + /// suspended queries + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDataWarehouseUserActivitiesOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the user activities of a data warehouse which includes running and + /// suspended queries + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDataWarehouseUserActivitiesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperations.cs new file mode 100644 index 0000000000000..bcd08ee711c77 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperations.cs @@ -0,0 +1,706 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseAdvisorsOperations operations. + /// + internal partial class DatabaseAdvisorsOperations : IServiceOperations, IDatabaseAdvisorsOperations + { + /// + /// Initializes a new instance of the DatabaseAdvisorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseAdvisorsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperationsExtensions.cs new file mode 100644 index 0000000000000..d4dfab76c1551 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAdvisorsOperationsExtensions.cs @@ -0,0 +1,195 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseAdvisorsOperations. + /// + public static partial class DatabaseAdvisorsOperationsExtensions + { + /// + /// Gets a list of database advisors. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static IList ListByDatabase(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string expand = default(string)) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of database advisors. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task> ListByDatabaseAsync(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a database advisor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static Advisor Get(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, advisorName).GetAwaiter().GetResult(); + } + + /// + /// Gets a database advisor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a database advisor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static Advisor Update(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters) + { + return operations.UpdateAsync(resourceGroupName, serverName, databaseName, advisorName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a database advisor. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task UpdateAsync(this IDatabaseAdvisorsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAutomaticTuningOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAutomaticTuningOperations.cs index 4c469aa37322e..41a64b324d201 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAutomaticTuningOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseAutomaticTuningOperations.cs @@ -102,7 +102,7 @@ internal DatabaseAutomaticTuningOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -313,7 +313,7 @@ internal DatabaseAutomaticTuningOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseBlobAuditingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseBlobAuditingPoliciesOperations.cs index 4637ddb70005f..3b6ca4f05a6c4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseBlobAuditingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseBlobAuditingPoliciesOperations.cs @@ -103,7 +103,7 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -321,7 +321,7 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -552,7 +552,7 @@ internal DatabaseBlobAuditingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperations.cs new file mode 100644 index 0000000000000..4d685a3e7c491 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperations.cs @@ -0,0 +1,1146 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseColumnsOperations operations. + /// + internal partial class DatabaseColumnsOperations : IServiceOperations, IDatabaseColumnsOperations + { + /// + /// Initializes a new instance of the DatabaseColumnsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseColumnsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schema", schema); + tracingParameters.Add("table", table); + tracingParameters.Add("column", column); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/columns").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (schema != null) + { + if (schema.Count == 0) + { + _queryParameters.Add(string.Format("schema={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in schema) + { + _queryParameters.Add(string.Format("schema={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (table != null) + { + if (table.Count == 0) + { + _queryParameters.Add(string.Format("table={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in table) + { + _queryParameters.Add(string.Format("table={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (column != null) + { + if (column.Count == 0) + { + _queryParameters.Add(string.Format("column={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in column) + { + _queryParameters.Add(string.Format("column={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (orderBy != null) + { + if (orderBy.Count == 0) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in orderBy) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTableWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTable", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTableNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperationsExtensions.cs new file mode 100644 index 0000000000000..f6ed91d081e8e --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseColumnsOperationsExtensions.cs @@ -0,0 +1,298 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseColumnsOperations. + /// + public static partial class DatabaseColumnsOperationsExtensions + { + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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 opaque token that identifies a starting point in the collection. + /// + public static IPage ListByDatabase(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string)) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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 opaque token that identifies a starting point in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByTable(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByTableAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTableAsync(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get database column + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static DatabaseColumn Get(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + } + + /// + /// Get database column + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IDatabaseColumnsOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDatabaseColumnsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDatabaseColumnsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByTableNext(this IDatabaseColumnsOperations operations, string nextPageLink) + { + return operations.ListByTableNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTableNextAsync(this IDatabaseColumnsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs new file mode 100644 index 0000000000000..e3101c5c1b674 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperations.cs @@ -0,0 +1,886 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseExtensionsOperations operations. + /// + internal partial class DatabaseExtensionsOperations : IServiceOperations, IDatabaseExtensionsOperations + { + /// + /// Initializes a new instance of the DatabaseExtensionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseExtensionsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (extensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("extensionName", extensionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{extensionName}", System.Uri.EscapeDataString(extensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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 database import request parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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 database import request parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (extensionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "extensionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("extensionName", extensionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{extensionName}", System.Uri.EscapeDataString(extensionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database extension. This will return an empty list as it is not + /// supported. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperationsExtensions.cs new file mode 100644 index 0000000000000..d3803beced06a --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseExtensionsOperationsExtensions.cs @@ -0,0 +1,278 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseExtensionsOperations. + /// + public static partial class DatabaseExtensionsOperationsExtensions + { + /// + /// Gets a database extension. This will return resource not found as it is not + /// supported. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// + public static void Get(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName) + { + operations.GetAsync(resourceGroupName, serverName, databaseName, extensionName).GetAwaiter().GetResult(); + } + + /// + /// Gets a database extension. This will return resource not found as it is not + /// supported. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, extensionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Perform a database extension operation, like polybase import + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static ImportExportExtensionsOperationResult CreateOrUpdate(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Perform a database extension operation, like polybase import + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task CreateOrUpdateAsync(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database extension. This will return an empty list as it is not + /// supported. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static IPage ListByDatabase(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// List database extension. This will return an empty list as it is not + /// supported. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task> ListByDatabaseAsync(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Perform a database extension operation, like polybase import + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static ImportExportExtensionsOperationResult BeginCreateOrUpdate(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Perform a database extension operation, like polybase import + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task BeginCreateOrUpdateAsync(this IDatabaseExtensionsOperations operations, string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database extension. This will return an empty list as it is not + /// supported. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDatabaseExtensionsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database extension. This will return an empty list as it is not + /// supported. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDatabaseExtensionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseOperations.cs index ebedc7aca5bd6..b276a6a2afea5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseOperations.cs @@ -102,7 +102,7 @@ internal DatabaseOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -290,7 +290,7 @@ internal DatabaseOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs new file mode 100644 index 0000000000000..eb32a4d3101d3 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperations.cs @@ -0,0 +1,725 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseRecommendedActionsOperations operations. + /// + internal partial class DatabaseRecommendedActionsOperations : IServiceOperations, IDatabaseRecommendedActionsOperations + { + /// + /// Initializes a new instance of the DatabaseRecommendedActionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseRecommendedActionsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseAdvisorWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseAdvisor", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (recommendedActionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "recommendedActionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("recommendedActionName", recommendedActionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{recommendedActionName}", System.Uri.EscapeDataString(recommendedActionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (recommendedActionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "recommendedActionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("recommendedActionName", recommendedActionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{recommendedActionName}", System.Uri.EscapeDataString(recommendedActionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperationsExtensions.cs new file mode 100644 index 0000000000000..cd6895363f77b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseRecommendedActionsOperationsExtensions.cs @@ -0,0 +1,207 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseRecommendedActionsOperations. + /// + public static partial class DatabaseRecommendedActionsOperationsExtensions + { + /// + /// Gets list of Database Recommended Actions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static IList ListByDatabaseAdvisor(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName) + { + return operations.ListByDatabaseAdvisorAsync(resourceGroupName, serverName, databaseName, advisorName).GetAwaiter().GetResult(); + } + + /// + /// Gets list of Database Recommended Actions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task> ListByDatabaseAdvisorAsync(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseAdvisorWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a database recommended action. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static RecommendedAction Get(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName).GetAwaiter().GetResult(); + } + + /// + /// Gets a database recommended action. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a database recommended action. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static RecommendedAction Update(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters) + { + return operations.UpdateAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a database recommended action. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task UpdateAsync(this IDatabaseRecommendedActionsOperations operations, string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperations.cs new file mode 100644 index 0000000000000..04d4681096386 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperations.cs @@ -0,0 +1,657 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseSchemasOperations operations. + /// + internal partial class DatabaseSchemasOperations : IServiceOperations, IDatabaseSchemasOperations + { + /// + /// Initializes a new instance of the DatabaseSchemasOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseSchemasOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database schemas + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperationsExtensions.cs new file mode 100644 index 0000000000000..311a849923046 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSchemasOperationsExtensions.cs @@ -0,0 +1,168 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseSchemasOperations. + /// + public static partial class DatabaseSchemasOperationsExtensions + { + /// + /// List database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByDatabase(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get database schema + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static DatabaseSchema Get(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, schemaName).GetAwaiter().GetResult(); + } + + /// + /// Get database schema + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IDatabaseSchemasOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDatabaseSchemasOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDatabaseSchemasOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs new file mode 100644 index 0000000000000..c765f5ab87649 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperations.cs @@ -0,0 +1,881 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseSecurityAlertPoliciesOperations operations. + /// + internal partial class DatabaseSecurityAlertPoliciesOperations : IServiceOperations, IDatabaseSecurityAlertPoliciesOperations + { + /// + /// Initializes a new instance of the DatabaseSecurityAlertPoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseSecurityAlertPoliciesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string securityAlertPolicyName = "default"; + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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 database security alert policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string securityAlertPolicyName = "default"; + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperationsExtensions.cs new file mode 100644 index 0000000000000..937a0739cb2f7 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseSecurityAlertPoliciesOperationsExtensions.cs @@ -0,0 +1,209 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseSecurityAlertPoliciesOperations. + /// + public static partial class DatabaseSecurityAlertPoliciesOperationsExtensions + { + /// + /// Gets a database's security alert policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static DatabaseSecurityAlertPolicy Get(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a database's security alert policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a database's security alert policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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 database security alert policy. + /// + public static DatabaseSecurityAlertPolicy CreateOrUpdate(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a database's security alert policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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 database security alert policy. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static IPage ListByDatabase(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + { + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task> ListByDatabaseAsync(this IDatabaseSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDatabaseSecurityAlertPoliciesOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDatabaseSecurityAlertPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperations.cs new file mode 100644 index 0000000000000..87a6940e4f045 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperations.cs @@ -0,0 +1,675 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseTablesOperations operations. + /// + internal partial class DatabaseTablesOperations : IServiceOperations, IDatabaseTablesOperations + { + /// + /// Initializes a new instance of the DatabaseTablesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseTablesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchema", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List database tables + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySchemaNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchemaNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperationsExtensions.cs new file mode 100644 index 0000000000000..3435ed84370b5 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseTablesOperationsExtensions.cs @@ -0,0 +1,180 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseTablesOperations. + /// + public static partial class DatabaseTablesOperationsExtensions + { + /// + /// List database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListBySchema(this IDatabaseTablesOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListBySchemaAsync(resourceGroupName, serverName, databaseName, schemaName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySchemaAsync(this IDatabaseTablesOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get database table + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static DatabaseTable Get(this IDatabaseTablesOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, schemaName, tableName).GetAwaiter().GetResult(); + } + + /// + /// Get database table + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IDatabaseTablesOperations operations, string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySchemaNext(this IDatabaseTablesOperations operations, string nextPageLink) + { + return operations.ListBySchemaNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySchemaNextAsync(this IDatabaseTablesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs index 3a7c09cb55923..3dafbdc792d28 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperations.cs @@ -51,7 +51,7 @@ internal DatabaseUsagesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Returns database usages. + /// Gets database usages. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -84,12 +84,8 @@ internal DatabaseUsagesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -102,7 +98,11 @@ internal DatabaseUsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -110,20 +110,20 @@ internal DatabaseUsagesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/usages").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -222,7 +222,180 @@ internal DatabaseUsagesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets database usages. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -235,7 +408,7 @@ internal DatabaseUsagesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperationsExtensions.cs index c6c2c68f544c6..7c929e47e73bd 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseUsagesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -24,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class DatabaseUsagesOperationsExtensions { /// - /// Returns database usages. + /// Gets database usages. /// /// /// The operations group for this extension method. @@ -39,13 +37,13 @@ public static partial class DatabaseUsagesOperationsExtensions /// /// The name of the database. /// - public static IEnumerable ListByDatabase(this IDatabaseUsagesOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this IDatabaseUsagesOperations operations, string resourceGroupName, string serverName, string databaseName) { return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Returns database usages. + /// Gets database usages. /// /// /// The operations group for this extension method. @@ -63,7 +61,7 @@ public static IEnumerable ListByDatabase(this IDatabaseUsagesOper /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IDatabaseUsagesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDatabaseUsagesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { @@ -71,5 +69,39 @@ public static IEnumerable ListByDatabase(this IDatabaseUsagesOper } } + /// + /// Gets database usages. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IDatabaseUsagesOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets database usages. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IDatabaseUsagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs index 6af06a2cb7b10..542549f9a3db6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs @@ -116,7 +116,7 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -351,7 +351,7 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -579,7 +579,7 @@ internal DatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManagementCli throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperations.cs index 2b7ab1bf71fc6..3cbc1a6b496ce 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperations.cs @@ -50,6 +50,35 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie /// public SqlManagementClient Client { get; private set; } + /// + /// 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 vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Lists the vulnerability assessment scans of a database. /// @@ -103,7 +132,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -317,7 +346,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -473,35 +502,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie return _result; } - /// - /// 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 vulnerability assessment scan Id of the scan to retrieve. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Convert an existing scan result to a human readable format. If already /// exists nothing happens @@ -563,7 +563,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -794,7 +794,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperationsExtensions.cs index e583bfef5abdc..b4eb4b2cad53f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentScansOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class DatabaseVulnerabilityAssessmentScansOperationsExtensions { /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The operations group for this extension method. @@ -37,13 +37,16 @@ public static partial class DatabaseVulnerabilityAssessmentScansOperationsExtens /// /// The name of the database. /// - public static IPage ListByDatabase(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + public static void InitiateScan(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId) { - return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + operations.InitiateScanAsync(resourceGroupName, serverName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The operations group for this extension method. @@ -58,19 +61,19 @@ public static IPage ListByDatabase(this IData /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task InitiateScanAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Gets a vulnerability assessment scan record of a database. + /// Lists the vulnerability assessment scans of a database. /// /// /// The operations group for this extension method. @@ -85,16 +88,13 @@ public static IPage ListByDatabase(this IData /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// - public static VulnerabilityAssessmentScanRecord Get(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId) + public static IPage ListByDatabase(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } /// - /// Gets a vulnerability assessment scan record of a database. + /// Lists the vulnerability assessment scans of a database. /// /// /// The operations group for this extension method. @@ -109,22 +109,19 @@ public static VulnerabilityAssessmentScanRecord Get(this IDatabaseVulnerabilityA /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// The cancellation token. /// - public static async Task GetAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Executes a Vulnerability Assessment database scan. + /// Gets a vulnerability assessment scan record of a database. /// /// /// The operations group for this extension method. @@ -142,13 +139,13 @@ public static VulnerabilityAssessmentScanRecord Get(this IDatabaseVulnerabilityA /// /// The vulnerability assessment scan Id of the scan to retrieve. /// - public static void InitiateScan(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId) + public static VulnerabilityAssessmentScanRecord Get(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId) { - operations.InitiateScanAsync(resourceGroupName, serverName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// Executes a Vulnerability Assessment database scan. + /// Gets a vulnerability assessment scan record of a database. /// /// /// The operations group for this extension method. @@ -169,9 +166,12 @@ public static void InitiateScan(this IDatabaseVulnerabilityAssessmentScansOperat /// /// The cancellation token. /// - public static async Task InitiateScanAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string serverName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentsOperations.cs index 1b1ced93379fb..fca14544f7812 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseVulnerabilityAssessmentsOperations.cs @@ -103,7 +103,7 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -317,7 +317,7 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -546,7 +546,7 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -735,7 +735,7 @@ internal DatabaseVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs index c127e57aeb8ad..26357fb31fc78 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperations.cs @@ -470,35 +470,6 @@ internal DatabasesOperations(SqlManagementClient client) return _result; } - /// - /// 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. - /// - /// - /// The database export request parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Gets a list of databases. /// @@ -1690,6 +1661,35 @@ internal DatabasesOperations(SqlManagementClient client) return _result; } + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Exports a database. /// @@ -1707,209 +1707,16 @@ internal DatabasesOperations(SqlManagementClient client) /// The database export request parameters. /// /// - /// Headers that will be added to request. + /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2020-02-02-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginExport", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; + // Send request + AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -3336,6 +3143,450 @@ internal DatabasesOperations(SqlManagementClient client) return _result; } + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginImport", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The database export request parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginExport", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets a list of databases. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs index 4593e4f9f6789..010097369b8a5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabasesOperationsExtensions.cs @@ -125,60 +125,6 @@ public static IEnumerable ListMetricDefinitions(this IDatabase } } - /// - /// Exports a database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the 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 export request parameters. - /// - public static ImportExportOperationResult Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) - { - return operations.ExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Exports a database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the 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 export request parameters. - /// - /// - /// The cancellation token. - /// - public static async Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Gets a list of databases. /// @@ -757,6 +703,60 @@ public static void Rename(this IDatabasesOperations operations, string resourceG (await operations.RenameWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Imports a bacpac into a new database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static ImportExportOperationResult Import(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) + { + return operations.ImportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Imports a bacpac into a new database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task ImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Exports a database. /// @@ -776,9 +776,9 @@ public static void Rename(this IDatabasesOperations operations, string resourceG /// /// The database export request parameters. /// - public static ImportExportOperationResult BeginExport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) + public static ImportExportOperationResult Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) { - return operations.BeginExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return operations.ExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// @@ -803,9 +803,9 @@ public static ImportExportOperationResult BeginExport(this IDatabasesOperations /// /// The cancellation token. /// - public static async Task BeginExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -1158,6 +1158,114 @@ public static void BeginUpgradeDataWarehouse(this IDatabasesOperations operation (await operations.BeginUpgradeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Imports a bacpac into a new database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static ImportExportOperationResult BeginImport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) + { + return operations.BeginImportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Imports a bacpac into a new database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task BeginImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Exports a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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 export request parameters. + /// + public static ImportExportOperationResult BeginExport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters) + { + return operations.BeginExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Exports a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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 export request parameters. + /// + /// + /// The cancellation token. + /// + public static async Task BeginExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets a list of databases. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperations.cs new file mode 100644 index 0000000000000..18cf1b67e73cf --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperations.cs @@ -0,0 +1,1171 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedServersOperations operations. + /// + internal partial class DeletedServersOperations : IServiceOperations, IDeletedServersOperations + { + /// + /// Initializes a new instance of the DeletedServersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeletedServersOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (deletedServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deletedServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("deletedServerName", deletedServerName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName}").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{deletedServerName}", System.Uri.EscapeDataString(deletedServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Recovers a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RecoverWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRecoverWithHttpMessagesAsync(locationName, deletedServerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Recovers a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginRecoverWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (deletedServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deletedServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("deletedServerName", deletedServerName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRecover", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers/{deletedServerName}/recover").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{deletedServerName}", System.Uri.EscapeDataString(deletedServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperationsExtensions.cs new file mode 100644 index 0000000000000..c22369d18716a --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DeletedServersOperationsExtensions.cs @@ -0,0 +1,275 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DeletedServersOperations. + /// + public static partial class DeletedServersOperationsExtensions + { + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IDeletedServersOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDeletedServersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + public static DeletedServer Get(this IDeletedServersOperations operations, string locationName, string deletedServerName) + { + return operations.GetAsync(locationName, deletedServerName).GetAwaiter().GetResult(); + } + + /// + /// Gets a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDeletedServersOperations operations, string locationName, string deletedServerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, deletedServerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + public static IPage ListByLocation(this IDeletedServersOperations operations, string locationName) + { + return operations.ListByLocationAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IDeletedServersOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Recovers a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + public static DeletedServer Recover(this IDeletedServersOperations operations, string locationName, string deletedServerName) + { + return operations.RecoverAsync(locationName, deletedServerName).GetAwaiter().GetResult(); + } + + /// + /// Recovers a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The cancellation token. + /// + public static async Task RecoverAsync(this IDeletedServersOperations operations, string locationName, string deletedServerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RecoverWithHttpMessagesAsync(locationName, deletedServerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Recovers a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + public static DeletedServer BeginRecover(this IDeletedServersOperations operations, string locationName, string deletedServerName) + { + return operations.BeginRecoverAsync(locationName, deletedServerName).GetAwaiter().GetResult(); + } + + /// + /// Recovers a deleted server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRecoverAsync(this IDeletedServersOperations operations, string locationName, string deletedServerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRecoverWithHttpMessagesAsync(locationName, deletedServerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDeletedServersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDeletedServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IDeletedServersOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IDeletedServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolOperations.cs index 313d1a22cc51d..53cf0d0f15864 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolOperations.cs @@ -101,7 +101,7 @@ internal ElasticPoolOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -288,7 +288,7 @@ internal ElasticPoolOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs index 4ca474cdc7836..785f56f27acbd 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ElasticPoolsOperations.cs @@ -518,7 +518,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -725,7 +725,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1050,7 +1050,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1276,7 +1276,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1469,7 +1469,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1677,7 +1677,7 @@ internal ElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperations.cs index ccf56854ff71c..5e8b79108b111 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperations.cs @@ -50,29 +50,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// public SqlManagementClient Client { get; private set; } - /// - /// 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 headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task RevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginRevalidateWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Gets a list of server encryption protectors /// @@ -118,7 +95,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -314,7 +291,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string encryptionProtectorName = "current"; - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -503,6 +480,32 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// The name of the server. /// /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevalidateWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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 requested encryption protector resource state. + /// + /// /// Headers that will be added to request. /// /// @@ -511,6 +514,9 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -520,7 +526,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -530,12 +536,20 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string encryptionProtectorName = "current"; - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -546,13 +560,14 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("encryptionProtectorName", encryptionProtectorName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginRevalidate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{encryptionProtectorName}", System.Uri.EscapeDataString(encryptionProtectorName)); @@ -569,7 +584,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -600,6 +615,12 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -655,13 +676,31 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -670,7 +709,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) } /// - /// Updates an existing encryption protector. + /// Revalidates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -679,9 +718,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The requested encryption protector resource state. - /// /// /// Headers that will be added to request. /// @@ -691,9 +727,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -703,7 +736,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -713,20 +746,12 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string encryptionProtectorName = "current"; - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -737,14 +762,13 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("encryptionProtectorName", encryptionProtectorName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevalidate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{encryptionProtectorName}", System.Uri.EscapeDataString(encryptionProtectorName)); @@ -761,7 +785,7 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -792,12 +816,6 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -853,31 +871,13 @@ internal EncryptionProtectorsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperationsExtensions.cs index 2c36752cae665..a5410bcc1a5ff 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/EncryptionProtectorsOperationsExtensions.cs @@ -21,45 +21,6 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class EncryptionProtectorsOperationsExtensions { - /// - /// Revalidates an existing encryption protector. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the server. - /// - public static void Revalidate(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName) - { - operations.RevalidateAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Revalidates an existing encryption protector. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group 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. - /// - public static async Task RevalidateAsync(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.RevalidateWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// Gets a list of server encryption protectors /// @@ -205,9 +166,9 @@ public static EncryptionProtector CreateOrUpdate(this IEncryptionProtectorsOpera /// /// The name of the server. /// - public static void BeginRevalidate(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName) + public static void Revalidate(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName) { - operations.BeginRevalidateAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + operations.RevalidateAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// @@ -226,9 +187,9 @@ public static void BeginRevalidate(this IEncryptionProtectorsOperations operatio /// /// The cancellation token. /// - public static async Task BeginRevalidateAsync(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RevalidateAsync(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginRevalidateWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.RevalidateWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -279,6 +240,45 @@ public static EncryptionProtector BeginCreateOrUpdate(this IEncryptionProtectors } } + /// + /// Revalidates an existing encryption protector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + public static void BeginRevalidate(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName) + { + operations.BeginRevalidateAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Revalidates an existing encryption protector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group 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. + /// + public static async Task BeginRevalidateAsync(this IEncryptionProtectorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevalidateWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets a list of server encryption protectors /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesOperations.cs index 31b9feff5f686..fa780931433ac 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedDatabaseBlobAuditingPoliciesOperations.cs @@ -103,7 +103,7 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -321,7 +321,7 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -552,7 +552,7 @@ internal ExtendedDatabaseBlobAuditingPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesOperations.cs index f82314c69e2e3..3b32da5af6afc 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ExtendedServerBlobAuditingPoliciesOperations.cs @@ -96,7 +96,7 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -319,7 +319,7 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -526,7 +526,7 @@ internal ExtendedServerBlobAuditingPoliciesOperations(SqlManagementClient client throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FailoverGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FailoverGroupsOperations.cs index 38be0bb5beea9..372f4ff814444 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FailoverGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FailoverGroupsOperations.cs @@ -102,7 +102,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -383,7 +383,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -649,7 +649,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -875,7 +875,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1068,7 +1068,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1279,7 +1279,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1484,7 +1484,7 @@ internal FailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperations.cs index b447cfb267e6b..0ae1643694c14 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperations.cs @@ -50,6 +50,210 @@ internal FirewallRulesOperations(SqlManagementClient client) /// public SqlManagementClient Client { get; private set; } + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (firewallRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("firewallRuleName", firewallRuleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Creates or updates a firewall rule. /// @@ -89,10 +293,6 @@ internal FirewallRulesOperations(SqlManagementClient client) /// public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -109,11 +309,11 @@ internal FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (parameters != null) + if (Client.SubscriptionId == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -121,21 +321,21 @@ internal FirewallRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -323,10 +523,6 @@ internal FirewallRulesOperations(SqlManagementClient client) /// public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -339,7 +535,11 @@ internal FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } - string apiVersion = "2014-04-01"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -347,20 +547,20 @@ internal FirewallRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -474,7 +674,7 @@ internal FirewallRulesOperations(SqlManagementClient client) } /// - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -483,9 +683,6 @@ internal FirewallRulesOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// Headers that will be added to request. /// @@ -507,12 +704,8 @@ internal FirewallRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -521,11 +714,11 @@ internal FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (firewallRuleName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -533,20 +726,18 @@ internal FirewallRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("firewallRuleName", firewallRuleName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -645,7 +836,7 @@ internal FirewallRulesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -658,7 +849,7 @@ internal FirewallRulesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -678,7 +869,7 @@ internal FirewallRulesOperations(SqlManagementClient client) } /// - /// Returns a list of firewall rules. + /// Replaces all firewall rules on the server. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -687,6 +878,8 @@ internal FirewallRulesOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// /// /// Headers that will be added to request. /// @@ -708,12 +901,8 @@ internal FirewallRulesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ReplaceWithHttpMessagesAsync(string resourceGroupName, string serverName, FirewallRuleList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -722,7 +911,15 @@ internal FirewallRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2014-04-01"; + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -730,18 +927,19 @@ internal FirewallRulesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Replace", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -754,6 +952,185 @@ internal FirewallRulesOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of firewall rules. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers @@ -840,7 +1217,7 @@ internal FirewallRulesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -853,7 +1230,7 @@ internal FirewallRulesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperationsExtensions.cs index f742b64361e66..347a30adc9a39 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/FirewallRulesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -23,6 +21,54 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class FirewallRulesOperationsExtensions { + /// + /// Gets a firewall rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static FirewallRule Get(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + { + return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + } + + /// + /// Gets a firewall rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates a firewall rule. /// @@ -123,7 +169,7 @@ public static void Delete(this IFirewallRulesOperations operations, string resou } /// - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// /// /// The operations group for this extension method. @@ -135,16 +181,13 @@ public static void Delete(this IFirewallRulesOperations operations, string resou /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// - public static FirewallRule Get(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + public static IPage ListByServer(this IFirewallRulesOperations operations, string resourceGroupName, string serverName) { - return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// /// /// The operations group for this extension method. @@ -156,22 +199,19 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// The cancellation token. /// - public static async Task GetAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns a list of firewall rules. + /// Replaces all firewall rules on the server. /// /// /// The operations group for this extension method. @@ -183,13 +223,15 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string /// /// The name of the server. /// - public static IEnumerable ListByServer(this IFirewallRulesOperations operations, string resourceGroupName, string serverName) + /// + /// + public static FirewallRule Replace(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, FirewallRuleList parameters) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.ReplaceAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } /// - /// Returns a list of firewall rules. + /// Replaces all firewall rules on the server. /// /// /// The operations group for this extension method. @@ -201,12 +243,48 @@ public static IEnumerable ListByServer(this IFirewallRulesOperatio /// /// The name of the server. /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ReplaceAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, FirewallRuleList parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ReplaceWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of firewall rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IFirewallRulesOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of firewall rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IFirewallRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataWarehouseUserActivitiesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataWarehouseUserActivitiesOperations.cs new file mode 100644 index 0000000000000..d5fc224c479ac --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDataWarehouseUserActivitiesOperations.cs @@ -0,0 +1,112 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataWarehouseUserActivitiesOperations operations. + /// + public partial interface IDataWarehouseUserActivitiesOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the user activities of a data warehouse which includes running + /// and suspended queries + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseAdvisorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseAdvisorsOperations.cs new file mode 100644 index 0000000000000..d03dd7947ca2b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseAdvisorsOperations.cs @@ -0,0 +1,129 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseAdvisorsOperations operations. + /// + public partial interface IDatabaseAdvisorsOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Advisor parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseColumnsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseColumnsOperations.cs new file mode 100644 index 0000000000000..422286104f561 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseColumnsOperations.cs @@ -0,0 +1,191 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseColumnsOperations operations. + /// + public partial interface IDatabaseColumnsOperations + { + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTableWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseExtensionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseExtensionsOperations.cs new file mode 100644 index 0000000000000..8d95be3ed3844 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseExtensionsOperations.cs @@ -0,0 +1,181 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseExtensionsOperations operations. + /// + public partial interface IDatabaseExtensionsOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 database import request parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 database import request parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string extensionName, DatabaseExtensions parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database extension. This will return an empty list as it is + /// not supported. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseRecommendedActionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseRecommendedActionsOperations.cs new file mode 100644 index 0000000000000..71b56d2b53279 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseRecommendedActionsOperations.cs @@ -0,0 +1,135 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseRecommendedActionsOperations operations. + /// + public partial interface IDatabaseRecommendedActionsOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseAdvisorWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string advisorName, string recommendedActionName, RecommendedAction parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSchemasOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSchemasOperations.cs new file mode 100644 index 0000000000000..38091cb9738c0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSchemasOperations.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseSchemasOperations operations. + /// + public partial interface IDatabaseSchemasOperations + { + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database schemas + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSecurityAlertPoliciesOperations.cs new file mode 100644 index 0000000000000..55ebba8681d66 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseSecurityAlertPoliciesOperations.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseSecurityAlertPoliciesOperations operations. + /// + public partial interface IDatabaseSecurityAlertPoliciesOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 database security alert policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of database's security alert policies. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseTablesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseTablesOperations.cs new file mode 100644 index 0000000000000..81491671ff478 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseTablesOperations.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseTablesOperations operations. + /// + public partial interface IDatabaseTablesOperations + { + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string schemaName, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List database tables + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySchemaNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseUsagesOperations.cs index bcec0cbe3391b..d51b105d102b0 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseUsagesOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IDatabaseUsagesOperations { /// - /// Returns database usages. + /// Gets database usages. /// /// /// The name of the resource group that contains the resource. You can @@ -52,6 +52,28 @@ public partial interface IDatabaseUsagesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets database usages. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseVulnerabilityAssessmentScansOperations.cs index b311a0ba7e0eb..5172fa305d443 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseVulnerabilityAssessmentScansOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IDatabaseVulnerabilityAssessmentScansOperations { /// - /// 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 @@ -37,6 +37,9 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// /// /// The headers that will be added to request. /// @@ -46,15 +49,12 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -67,9 +67,6 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// The headers that will be added to request. /// @@ -85,9 +82,9 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -112,10 +109,13 @@ public partial interface IDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Convert an existing scan result to a human readable format. If /// already exists nothing happens diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs index 99538f63d6044..dbad0bfa9ef00 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabasesOperations.cs @@ -88,39 +88,6 @@ public partial interface IDatabasesOperations /// Task>> ListMetricDefinitionsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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. - /// - /// - /// The database export request parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Gets a list of databases. /// /// @@ -476,6 +443,39 @@ public partial interface IDatabasesOperations /// Task RenameWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Exports a database. /// /// @@ -507,7 +507,7 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a new database or updates an existing database. /// @@ -720,6 +720,72 @@ public partial interface IDatabasesOperations /// Task BeginUpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The database export request parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets a list of databases. /// /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDeletedServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDeletedServersOperations.cs new file mode 100644 index 0000000000000..b73490e3caf6e --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDeletedServersOperations.cs @@ -0,0 +1,187 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedServersOperations operations. + /// + public partial interface IDeletedServersOperations + { + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Recovers a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RecoverWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Recovers a deleted server. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The name of the deleted server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginRecoverWithHttpMessagesAsync(string locationName, string deletedServerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all deleted servers in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of deleted servers for a location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IEncryptionProtectorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IEncryptionProtectorsOperations.cs index 954fcdf643915..039c28d941333 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IEncryptionProtectorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IEncryptionProtectorsOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IEncryptionProtectorsOperations { /// - /// Revalidates an existing encryption protector. + /// Gets a list of server encryption protectors /// /// /// The name of the resource group that contains the resource. You can @@ -43,12 +43,15 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task RevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of server encryption protectors + /// Gets a server encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -73,9 +76,9 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a server encryption protector. + /// Updates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -85,6 +88,9 @@ public partial interface IEncryptionProtectorsOperations /// /// The name of the server. /// + /// + /// The requested encryption protector resource state. + /// /// /// The headers that will be added to request. /// @@ -100,9 +106,9 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates an existing encryption protector. + /// Revalidates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -112,9 +118,6 @@ public partial interface IEncryptionProtectorsOperations /// /// The name of the server. /// - /// - /// The requested encryption protector resource state. - /// /// /// The headers that will be added to request. /// @@ -124,15 +127,12 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Revalidates an existing encryption protector. + /// Updates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -142,6 +142,9 @@ public partial interface IEncryptionProtectorsOperations /// /// The name of the server. /// + /// + /// The requested encryption protector resource state. + /// /// /// The headers that will be added to request. /// @@ -151,12 +154,15 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task BeginRevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates an existing encryption protector. + /// Revalidates an existing encryption protector. /// /// /// The name of the resource group that contains the resource. You can @@ -166,9 +172,6 @@ public partial interface IEncryptionProtectorsOperations /// /// The name of the server. /// - /// - /// The requested encryption protector resource state. - /// /// /// The headers that will be added to request. /// @@ -178,13 +181,10 @@ public partial interface IEncryptionProtectorsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, EncryptionProtector parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginRevalidateWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of server encryption protectors /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IFirewallRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IFirewallRulesOperations.cs index a8f402658f934..14ce7a8209f8a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IFirewallRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IFirewallRulesOperations.cs @@ -23,6 +23,36 @@ namespace Microsoft.Azure.Management.Sql /// public partial interface IFirewallRulesOperations { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a firewall rule. /// @@ -84,7 +114,7 @@ public partial interface IFirewallRulesOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a firewall rule. + /// Gets a list of firewall rules. /// /// /// The name of the resource group that contains the resource. You can @@ -94,9 +124,6 @@ public partial interface IFirewallRulesOperations /// /// The name of the server. /// - /// - /// The name of the firewall rule. - /// /// /// The headers that will be added to request. /// @@ -112,9 +139,9 @@ public partial interface IFirewallRulesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns a list of firewall rules. + /// Replaces all firewall rules on the server. /// /// /// The name of the resource group that contains the resource. You can @@ -124,6 +151,30 @@ public partial interface IFirewallRulesOperations /// /// The name of the server. /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ReplaceWithHttpMessagesAsync(string resourceGroupName, string serverName, FirewallRuleList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of firewall rules. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The headers that will be added to request. /// @@ -139,6 +190,6 @@ public partial interface IFirewallRulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowOptionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowOptionsOperations.cs new file mode 100644 index 0000000000000..5f9104bef2dbd --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowOptionsOperations.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MaintenanceWindowOptionsOperations operations. + /// + public partial interface IMaintenanceWindowOptionsOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceTierAdvisorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowsOperations.cs similarity index 70% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceTierAdvisorsOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowsOperations.cs index 58bc6e583f64b..5b17eb33c52a4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServiceTierAdvisorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IMaintenanceWindowsOperations.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServiceTierAdvisorsOperations operations. + /// MaintenanceWindowsOperations operations. /// - public partial interface IServiceTierAdvisorsOperations + public partial interface IMaintenanceWindowsOperations { /// - /// Gets a service tier advisor. + /// Gets maintenance windows settings for a database. /// /// /// The name of the resource group that contains the resource. You can @@ -35,10 +35,10 @@ public partial interface IServiceTierAdvisorsOperations /// The name of the server. /// /// - /// The name of database. + /// The name of the database to get maintenance windows for. /// - /// - /// The name of service tier advisor. + /// + /// Maintenance window name. /// /// /// The headers that will be added to request. @@ -55,9 +55,9 @@ public partial interface IServiceTierAdvisorsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns service tier advisors for specified database. + /// Sets maintenance windows settings for a database. /// /// /// The name of the resource group that contains the resource. You can @@ -68,7 +68,12 @@ public partial interface IServiceTierAdvisorsOperations /// The name of the server. /// /// - /// The name of database. + /// The name of the database to set maintenance windows for. + /// + /// + /// Maintenance window name. + /// + /// /// /// /// The headers that will be added to request. @@ -79,12 +84,9 @@ public partial interface IServiceTierAdvisorsOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseColumnsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseColumnsOperations.cs new file mode 100644 index 0000000000000..4182457c18e55 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseColumnsOperations.cs @@ -0,0 +1,191 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseColumnsOperations operations. + /// + public partial interface IManagedDatabaseColumnsOperations + { + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTableWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByTableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseQueriesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseQueriesOperations.cs new file mode 100644 index 0000000000000..f7ed60b84147b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseQueriesOperations.cs @@ -0,0 +1,123 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseQueriesOperations operations. + /// + public partial interface IManagedDatabaseQueriesOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// + /// Start time for observed period. + /// + /// + /// End time for observed period. + /// + /// + /// The time step to be used to summarize the metric values. Possible + /// values include: 'PT1H', 'P1D' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByQueryWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = default(string), string endTime = default(string), string interval = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get query execution statistics by query id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByQueryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseRecommendedSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseRecommendedSensitivityLabelsOperations.cs new file mode 100644 index 0000000000000..dfcc7455253d4 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseRecommendedSensitivityLabelsOperations.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseRecommendedSensitivityLabelsOperations operations. + /// + public partial interface IManagedDatabaseRecommendedSensitivityLabelsOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSchemasOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSchemasOperations.cs new file mode 100644 index 0000000000000..af0088a48da90 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSchemasOperations.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseSchemasOperations operations. + /// + public partial interface IManagedDatabaseSchemasOperations + { + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed database schemas + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseThreatDetectionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSecurityEventsOperations.cs similarity index 60% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseThreatDetectionPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSecurityEventsOperations.cs index d40ebd0c11b61..9a0980c928ac4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IDatabaseThreatDetectionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSecurityEventsOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.Sql { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Collections; using System.Collections.Generic; @@ -19,24 +20,30 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// DatabaseThreatDetectionPoliciesOperations operations. + /// ManagedDatabaseSecurityEventsOperations operations. /// - public partial interface IDatabaseThreatDetectionPoliciesOperations + public partial interface IManagedDatabaseSecurityEventsOperations { /// - /// Gets a database's threat detection policy. + /// 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 server. + /// + /// The name of the managed instance. /// /// - /// The name of the database for which database Threat Detection policy - /// is defined. + /// The name of the managed database for which the security events are + /// retrieved. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// An opaque token that identifies a starting point in the collection. /// /// /// The headers that will be added to request. @@ -53,24 +60,12 @@ public partial interface IDatabaseThreatDetectionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates a database's threat detection policy. + /// 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 server. - /// - /// - /// The name of the database for which database Threat Detection policy - /// is defined. - /// - /// - /// The database Threat Detection policy. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// The headers that will be added to request. @@ -87,6 +82,6 @@ public partial interface IDatabaseThreatDetectionPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs index c63e8601974e0..be59cc99b7bc7 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseSensitivityLabelsOperations.cs @@ -235,6 +235,10 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// The headers that will be added to request. /// @@ -250,7 +254,37 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// @@ -268,11 +302,11 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// The headers that will be added to request. /// @@ -288,7 +322,7 @@ public partial interface IManagedDatabaseSensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTablesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTablesOperations.cs new file mode 100644 index 0000000000000..e5ed7fd9f9cf2 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTablesOperations.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseTablesOperations operations. + /// + public partial interface IManagedDatabaseTablesOperations + { + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List managed database tables + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySchemaNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTransparentDataEncryptionOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTransparentDataEncryptionOperations.cs new file mode 100644 index 0000000000000..86510b1f0406a --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseTransparentDataEncryptionOperations.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseTransparentDataEncryptionOperations operations. + /// + public partial interface IManagedDatabaseTransparentDataEncryptionOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 database transparent data encryption. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ManagedTransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseVulnerabilityAssessmentScansOperations.cs index 1a5ca097c376c..0857647fa5742 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedDatabaseVulnerabilityAssessmentScansOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations { /// - /// 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 @@ -37,6 +37,9 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// /// /// The headers that will be added to request. /// @@ -46,15 +49,13 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -65,10 +66,10 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// The name of the managed instance. /// /// - /// The name of the database. + /// The name of the scanned database. /// /// - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// /// /// The headers that will be added to request. @@ -85,9 +86,9 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ExportWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -100,9 +101,6 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// The headers that will be added to request. /// @@ -112,13 +110,15 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -129,10 +129,10 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// The name of the managed instance. /// /// - /// The name of the scanned database. + /// The name of the database. /// /// - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// /// /// The headers that will be added to request. @@ -149,7 +149,7 @@ public partial interface IManagedDatabaseVulnerabilityAssessmentScansOperations /// /// Thrown when a required parameter is null /// - Task> ExportWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Executes a Vulnerability Assessment database scan. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceOperations.cs index 59ad2243810f7..ba0f47d7a8409 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstanceOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IManagedInstanceOperations { /// - /// 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 @@ -34,8 +34,6 @@ public partial interface IManagedInstanceOperations /// /// The name of the managed instance. /// - /// - /// /// /// The headers that will be added to request. /// @@ -45,12 +43,15 @@ public partial interface IManagedInstanceOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -60,6 +61,8 @@ public partial interface IManagedInstanceOperations /// /// The name of the managed instance. /// + /// + /// /// /// The headers that will be added to request. /// @@ -75,9 +78,9 @@ public partial interface IManagedInstanceOperations /// /// Thrown when a required parameter is null /// - Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -98,13 +101,10 @@ public partial interface IManagedInstanceOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of operations performed on the managed instance. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateEndpointConnectionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..b08a5f11ed820 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateEndpointConnectionsOperations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstancePrivateEndpointConnectionsOperations operations. + /// + public partial interface IManagedInstancePrivateEndpointConnectionsOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateLinkResourcesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..524381ac025b6 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancePrivateLinkResourcesOperations.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstancePrivateLinkResourcesOperations operations. + /// + public partial interface IManagedInstancePrivateLinkResourcesOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs index 22d58340a52f2..36420cc7522b2 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedInstancesOperations.cs @@ -34,6 +34,31 @@ public partial interface IManagedInstancesOperations /// /// The instance pool name. /// + /// + /// The child resources to include in the response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -49,7 +74,7 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of managed instances in a resource group. /// @@ -58,6 +83,9 @@ public partial interface IManagedInstancesOperations /// obtain this value from the Azure Resource Manager API or the /// portal. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -73,7 +101,7 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a managed instance. /// @@ -85,6 +113,9 @@ public partial interface IManagedInstancesOperations /// /// The name of the managed instance. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -100,7 +131,7 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a managed instance. /// @@ -266,25 +297,6 @@ public partial interface IManagedInstancesOperations /// Task FailoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string replicaType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Creates or updates a managed instance. /// /// @@ -419,7 +431,7 @@ public partial interface IManagedInstancesOperations /// Task>> ListByInstancePoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -439,9 +451,9 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get top resource consuming queries of a managed instance. + /// Gets a list of managed instances in a resource group. /// /// /// The NextLink from the previous successful call to List operation. @@ -461,9 +473,9 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// /// /// The NextLink from the previous successful call to List operation. @@ -483,6 +495,6 @@ public partial interface IManagedInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs index 262e36247210e..9d1a736d24dc9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs @@ -53,7 +53,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -66,7 +66,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -85,7 +85,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -98,7 +98,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -146,7 +146,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// Task>> ListByRestorableDroppedDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -159,7 +159,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -178,7 +178,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// 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 @@ -191,7 +191,7 @@ public partial interface IManagedRestorableDroppedDatabaseBackupShortTermRetenti /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOperationsHealthOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOperationsHealthOperations.cs new file mode 100644 index 0000000000000..a0e5940019b3a --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IOperationsHealthOperations.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationsHealthOperations operations. + /// + public partial interface IOperationsHealthOperations + { + /// + /// Gets a service operation health status. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a service operation health status. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedSensitivityLabelsOperations.cs new file mode 100644 index 0000000000000..51b7acd4b03d6 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedSensitivityLabelsOperations.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RecommendedSensitivityLabelsOperations operations. + /// + public partial interface IRecommendedSensitivityLabelsOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorableDroppedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorableDroppedDatabasesOperations.cs index 5ec52bad2f2c2..62e67d9341340 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorableDroppedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorableDroppedDatabasesOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql public partial interface IRestorableDroppedDatabasesOperations { /// - /// Gets a deleted database that can be restored + /// Gets a list of restorable dropped databases. /// /// /// The name of the resource group that contains the resource. You can @@ -34,10 +34,6 @@ public partial interface IRestorableDroppedDatabasesOperations /// /// The name of the server. /// - /// - /// The id of the deleted database in the form of - /// databaseName,deletionTimeInFileTimeFormat - /// /// /// The headers that will be added to request. /// @@ -53,9 +49,9 @@ public partial interface IRestorableDroppedDatabasesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string restorableDroppededDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a list of deleted databases that can be restored + /// Gets a restorable dropped database. /// /// /// The name of the resource group that contains the resource. You can @@ -65,6 +61,30 @@ public partial interface IRestorableDroppedDatabasesOperations /// /// The name of the server. /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string restorableDroppedDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of restorable dropped databases. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The headers that will be added to request. /// @@ -80,6 +100,6 @@ public partial interface IRestorableDroppedDatabasesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorePointsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorePointsOperations.cs index b68a63292c1f1..2ce3f914bf402 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorePointsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRestorePointsOperations.cs @@ -52,7 +52,7 @@ public partial interface IRestorePointsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a restore point for a data warehouse. /// @@ -182,5 +182,27 @@ public partial interface IRestorePointsOperations /// Thrown when a required parameter is null /// Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, CreateDatabaseRestorePointDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of database restore points. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs index bc4c9920da284..ad73f817a9835 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISensitivityLabelsOperations.cs @@ -41,6 +41,10 @@ public partial interface ISensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// The headers that will be added to request. /// @@ -56,7 +60,37 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the sensitivity labels of a given database /// @@ -74,11 +108,11 @@ public partial interface ISensitivityLabelsOperations /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// The headers that will be added to request. /// @@ -94,7 +128,7 @@ public partial interface ISensitivityLabelsOperations /// /// Thrown when a required parameter is null /// - Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Enables sensitivity recommendations on a given column /// (recommendations are enabled by default on all columns) diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerAdvisorsOperations.cs similarity index 72% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedElasticPoolsOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerAdvisorsOperations.cs index 77e7dd819296b..827ee7026f6fb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IRecommendedElasticPoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerAdvisorsOperations.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// RecommendedElasticPoolsOperations operations. + /// ServerAdvisorsOperations operations. /// - public partial interface IRecommendedElasticPoolsOperations + public partial interface IServerAdvisorsOperations { /// - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// /// /// The name of the resource group that contains the resource. You can @@ -34,8 +34,8 @@ public partial interface IRecommendedElasticPoolsOperations /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The child resources to include in the response. /// /// /// The headers that will be added to request. @@ -52,9 +52,9 @@ public partial interface IRecommendedElasticPoolsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns recommended elastic pools. + /// Gets a server advisor. /// /// /// The name of the resource group that contains the resource. You can @@ -64,6 +64,9 @@ public partial interface IRecommendedElasticPoolsOperations /// /// The name of the server. /// + /// + /// The name of the Server Advisor. + /// /// /// The headers that will be added to request. /// @@ -79,9 +82,9 @@ public partial interface IRecommendedElasticPoolsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// /// /// The name of the resource group that contains the resource. You can @@ -91,8 +94,11 @@ public partial interface IRecommendedElasticPoolsOperations /// /// 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 headers that will be added to request. @@ -109,6 +115,6 @@ public partial interface IRecommendedElasticPoolsOperations /// /// Thrown when a required parameter is null /// - Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string advisorName, Advisor parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerDnsAliasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerDnsAliasesOperations.cs index 900258bc9aeed..f6ab85e1a643e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerDnsAliasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerDnsAliasesOperations.cs @@ -35,7 +35,7 @@ public partial interface IServerDnsAliasesOperations /// 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 headers that will be added to request. @@ -54,7 +54,7 @@ public partial interface IServerDnsAliasesOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The name of the resource group that contains the resource. You can @@ -65,7 +65,7 @@ public partial interface IServerDnsAliasesOperations /// 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 headers that will be added to request. @@ -95,7 +95,7 @@ public partial interface IServerDnsAliasesOperations /// 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 headers that will be added to request. @@ -162,12 +162,15 @@ public partial interface IServerDnsAliasesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task AcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The name of the resource group that contains the resource. You can @@ -178,7 +181,7 @@ public partial interface IServerDnsAliasesOperations /// 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 headers that will be added to request. @@ -208,7 +211,7 @@ public partial interface IServerDnsAliasesOperations /// 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 headers that will be added to request. @@ -248,10 +251,13 @@ public partial interface IServerDnsAliasesOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of server DNS aliases for a server. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerKeysOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerKeysOperations.cs index a64b4dbeb5176..d5d088798d8f6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerKeysOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerKeysOperations.cs @@ -95,9 +95,9 @@ public partial interface IServerKeysOperations /// 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, + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. @@ -160,9 +160,9 @@ public partial interface IServerKeysOperations /// 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, + /// https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, /// then the server key name should be formatted as: - /// YourVaultName_YourKeyName_01234567890123456789012345678901 + /// YourVaultName_YourKeyName_YourKeyVersion /// /// /// The requested server key resource state. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerOperations.cs new file mode 100644 index 0000000000000..e71dd1acac1bb --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServerOperations.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServerOperations operations. + /// + public partial interface IServerOperations + { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of operations performed on the server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs index 591f10e968ab8..af2e8ec990768 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IServersOperations.cs @@ -31,6 +31,9 @@ public partial interface IServersOperations /// obtain this value from the Azure Resource Manager API or the /// portal. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -46,7 +49,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a server. /// @@ -58,6 +61,9 @@ public partial interface IServersOperations /// /// The name of the server. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -73,7 +79,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a server. /// @@ -161,6 +167,9 @@ public partial interface IServersOperations /// /// Gets a list of all servers in the subscription. /// + /// + /// The child resources to include in the response. + /// /// /// The headers that will be added to request. /// @@ -176,13 +185,20 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Determines whether a resource can be created with the specified - /// name. + /// 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 availability request parameters. + /// The database import request parameters. /// /// /// The headers that will be added to request. @@ -199,20 +215,13 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Imports a bacpac into a new database. + /// Determines whether a resource can be created with the specified + /// 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 database import request parameters. + /// The name availability request parameters. /// /// /// The headers that will be added to request. @@ -229,7 +238,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a server. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IImportExportOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlAgentOperations.cs similarity index 66% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IImportExportOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlAgentOperations.cs index 7fe33a73c74d0..bd09e50b6f468 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IImportExportOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlAgentOperations.cs @@ -19,26 +19,20 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ImportExportOperations operations. + /// SqlAgentOperations operations. /// - public partial interface IImportExportOperations + public partial interface ISqlAgentOperations { /// - /// Imports a bacpac into a new database. + /// 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 server. - /// - /// - /// The name of the database. - /// - /// - /// The database import request parameters. + /// + /// The name of the managed instance. /// /// /// The headers that will be added to request. @@ -55,23 +49,19 @@ public partial interface IImportExportOperations /// /// Thrown when a required parameter is null /// - Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Imports a bacpac into a new database. + /// 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 server. - /// - /// - /// The name of the database. + /// + /// The name of the managed instance. /// /// - /// The database import request parameters. /// /// /// The headers that will be added to request. @@ -88,6 +78,6 @@ public partial interface IImportExportOperations /// /// Thrown when a required parameter is null /// - Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs index 0f57e4aa7fe3d..afd7f6233c125 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ISqlManagementClient.cs @@ -72,21 +72,11 @@ public partial interface ISqlManagementClient : System.IDisposable /// IRecoverableDatabasesOperations RecoverableDatabases { get; } - /// - /// Gets the IRestorableDroppedDatabasesOperations. - /// - IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; } - /// /// Gets the IServerConnectionPoliciesOperations. /// IServerConnectionPoliciesOperations ServerConnectionPolicies { get; } - /// - /// Gets the IDatabaseThreatDetectionPoliciesOperations. - /// - IDatabaseThreatDetectionPoliciesOperations DatabaseThreatDetectionPolicies { get; } - /// /// Gets the IDataMaskingPoliciesOperations. /// @@ -97,11 +87,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IDataMaskingRulesOperations DataMaskingRules { get; } - /// - /// Gets the IFirewallRulesOperations. - /// - IFirewallRulesOperations FirewallRules { get; } - /// /// Gets the IGeoBackupPoliciesOperations. /// @@ -117,11 +102,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IElasticPoolsOperations ElasticPools { get; } - /// - /// Gets the IRecommendedElasticPoolsOperations. - /// - IRecommendedElasticPoolsOperations RecommendedElasticPools { get; } - /// /// Gets the IReplicationLinksOperations. /// @@ -147,11 +127,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// IElasticPoolDatabaseActivitiesOperations ElasticPoolDatabaseActivities { get; } - /// - /// Gets the IServiceTierAdvisorsOperations. - /// - IServiceTierAdvisorsOperations ServiceTierAdvisors { get; } - /// /// Gets the ITransparentDataEncryptionsOperations. /// @@ -168,74 +143,84 @@ public partial interface ISqlManagementClient : System.IDisposable IServerUsagesOperations ServerUsages { get; } /// - /// Gets the IDatabaseUsagesOperations. + /// Gets the IUsagesOperations. /// - IDatabaseUsagesOperations DatabaseUsages { get; } + IUsagesOperations Usages { get; } /// - /// Gets the IDatabaseAutomaticTuningOperations. + /// Gets the IBackupShortTermRetentionPoliciesOperations. /// - IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { get; } + IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; } /// - /// Gets the IEncryptionProtectorsOperations. + /// Gets the IExtendedDatabaseBlobAuditingPoliciesOperations. /// - IEncryptionProtectorsOperations EncryptionProtectors { get; } + IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; } /// - /// Gets the IFailoverGroupsOperations. + /// Gets the IExtendedServerBlobAuditingPoliciesOperations. /// - IFailoverGroupsOperations FailoverGroups { get; } + IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; } /// - /// Gets the IOperations. + /// Gets the IServerBlobAuditingPoliciesOperations. /// - IOperations Operations { get; } + IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; } /// - /// Gets the IServerKeysOperations. + /// Gets the IDatabaseBlobAuditingPoliciesOperations. /// - IServerKeysOperations ServerKeys { get; } + IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; } /// - /// Gets the ISyncAgentsOperations. + /// Gets the IDatabaseAdvisorsOperations. /// - ISyncAgentsOperations SyncAgents { get; } + IDatabaseAdvisorsOperations DatabaseAdvisors { get; } /// - /// Gets the ISubscriptionUsagesOperations. + /// Gets the IDatabaseAutomaticTuningOperations. /// - ISubscriptionUsagesOperations SubscriptionUsages { get; } + IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { get; } /// - /// Gets the IVirtualClustersOperations. + /// Gets the IDatabaseColumnsOperations. /// - IVirtualClustersOperations VirtualClusters { get; } + IDatabaseColumnsOperations DatabaseColumns { get; } /// - /// Gets the IVirtualNetworkRulesOperations. + /// Gets the IDatabaseExtensionsOperations. /// - IVirtualNetworkRulesOperations VirtualNetworkRules { get; } + IDatabaseExtensionsOperations DatabaseExtensions { get; } /// - /// Gets the IExtendedDatabaseBlobAuditingPoliciesOperations. + /// Gets the IDatabaseOperations. /// - IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; } + IDatabaseOperations DatabaseOperations { get; } /// - /// Gets the IExtendedServerBlobAuditingPoliciesOperations. + /// Gets the IDatabaseRecommendedActionsOperations. /// - IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; } + IDatabaseRecommendedActionsOperations DatabaseRecommendedActions { get; } /// - /// Gets the IServerBlobAuditingPoliciesOperations. + /// Gets the IDatabaseSchemasOperations. /// - IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; } + IDatabaseSchemasOperations DatabaseSchemas { get; } /// - /// Gets the IDatabaseBlobAuditingPoliciesOperations. + /// Gets the IDatabaseSecurityAlertPoliciesOperations. /// - IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; } + IDatabaseSecurityAlertPoliciesOperations DatabaseSecurityAlertPolicies { get; } + + /// + /// Gets the IDatabaseTablesOperations. + /// + IDatabaseTablesOperations DatabaseTables { get; } + + /// + /// Gets the IDatabaseUsagesOperations. + /// + IDatabaseUsagesOperations DatabaseUsages { get; } /// /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. @@ -247,6 +232,51 @@ public partial interface ISqlManagementClient : System.IDisposable /// IDatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments { get; } + /// + /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. + /// + IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; } + + /// + /// Gets the IDataWarehouseUserActivitiesOperations. + /// + IDataWarehouseUserActivitiesOperations DataWarehouseUserActivities { get; } + + /// + /// Gets the IDeletedServersOperations. + /// + IDeletedServersOperations DeletedServers { get; } + + /// + /// Gets the IElasticPoolOperations. + /// + IElasticPoolOperations ElasticPoolOperations { get; } + + /// + /// Gets the IEncryptionProtectorsOperations. + /// + IEncryptionProtectorsOperations EncryptionProtectors { get; } + + /// + /// Gets the IFailoverGroupsOperations. + /// + IFailoverGroupsOperations FailoverGroups { get; } + + /// + /// Gets the IFirewallRulesOperations. + /// + IFirewallRulesOperations FirewallRules { get; } + + /// + /// Gets the IInstanceFailoverGroupsOperations. + /// + IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; } + + /// + /// Gets the IInstancePoolsOperations. + /// + IInstancePoolsOperations InstancePools { get; } + /// /// Gets the IJobAgentsOperations. /// @@ -293,84 +323,99 @@ public partial interface ISqlManagementClient : System.IDisposable IJobVersionsOperations JobVersions { get; } /// - /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. + /// Gets the ICapabilitiesOperations. /// - IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; } + ICapabilitiesOperations Capabilities { get; } /// - /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. + /// Gets the ILongTermRetentionBackupsOperations. /// - IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; } + ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; } /// - /// Gets the IServerAutomaticTuningOperations. + /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. /// - IServerAutomaticTuningOperations ServerAutomaticTuning { get; } + ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; } /// - /// Gets the IServerDnsAliasesOperations. + /// Gets the ILongTermRetentionPoliciesOperations. /// - IServerDnsAliasesOperations ServerDnsAliases { get; } + ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; } /// - /// Gets the IServerSecurityAlertPoliciesOperations. + /// Gets the IMaintenanceWindowOptionsOperations. /// - IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; } + IMaintenanceWindowOptionsOperations MaintenanceWindowOptions { get; } /// - /// Gets the IRestorableDroppedManagedDatabasesOperations. + /// Gets the IMaintenanceWindowsOperations. /// - IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; } + IMaintenanceWindowsOperations MaintenanceWindows { get; } /// - /// Gets the IRestorePointsOperations. + /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. /// - IRestorePointsOperations RestorePoints { get; } + IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; } /// - /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseColumnsOperations. /// - IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; } + IManagedDatabaseColumnsOperations ManagedDatabaseColumns { get; } /// - /// Gets the IManagedServerSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseQueriesOperations. /// - IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; } + IManagedDatabaseQueriesOperations ManagedDatabaseQueries { get; } /// - /// Gets the ISensitivityLabelsOperations. + /// Gets the IManagedDatabaseRestoreDetailsOperations. /// - ISensitivityLabelsOperations SensitivityLabels { get; } + IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; } /// - /// Gets the IManagedInstanceAdministratorsOperations. + /// Gets the IManagedDatabasesOperations. /// - IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; } + IManagedDatabasesOperations ManagedDatabases { get; } /// - /// Gets the IDatabaseOperations. + /// Gets the IManagedDatabaseSchemasOperations. /// - IDatabaseOperations DatabaseOperations { get; } + IManagedDatabaseSchemasOperations ManagedDatabaseSchemas { get; } /// - /// Gets the IElasticPoolOperations. + /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. /// - IElasticPoolOperations ElasticPoolOperations { get; } + IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; } /// - /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. + /// Gets the IManagedDatabaseSecurityEventsOperations. /// - IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; } + IManagedDatabaseSecurityEventsOperations ManagedDatabaseSecurityEvents { get; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. + /// Gets the IManagedDatabaseSensitivityLabelsOperations. /// - IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; } + IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. + /// Gets the IManagedDatabaseRecommendedSensitivityLabelsOperations. /// - IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; } + IManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels { get; } + + /// + /// Gets the IManagedDatabaseTablesOperations. + /// + IManagedDatabaseTablesOperations ManagedDatabaseTables { get; } + + /// + /// Gets the IManagedDatabaseTransparentDataEncryptionOperations. + /// + IManagedDatabaseTransparentDataEncryptionOperations ManagedDatabaseTransparentDataEncryption { get; } + + /// + /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. + /// + IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; } /// /// Gets the IManagedDatabaseVulnerabilityAssessmentsOperations. @@ -378,19 +423,24 @@ public partial interface ISqlManagementClient : System.IDisposable IManagedDatabaseVulnerabilityAssessmentsOperations ManagedDatabaseVulnerabilityAssessments { get; } /// - /// Gets the IInstanceFailoverGroupsOperations. + /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. /// - IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; } + IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; } /// - /// Gets the ITdeCertificatesOperations. + /// Gets the IManagedInstanceAdministratorsOperations. /// - ITdeCertificatesOperations TdeCertificates { get; } + IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; } /// - /// Gets the IManagedInstanceTdeCertificatesOperations. + /// Gets the IManagedInstanceAzureADOnlyAuthenticationsOperations. /// - IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; } + IManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications { get; } + + /// + /// Gets the IManagedInstanceEncryptionProtectorsOperations. + /// + IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; } /// /// Gets the IManagedInstanceKeysOperations. @@ -398,19 +448,34 @@ public partial interface ISqlManagementClient : System.IDisposable IManagedInstanceKeysOperations ManagedInstanceKeys { get; } /// - /// Gets the IManagedInstanceEncryptionProtectorsOperations. + /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. /// - IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; } + IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; } /// - /// Gets the IRecoverableManagedDatabasesOperations. + /// Gets the IManagedInstanceOperations. /// - IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; } + IManagedInstanceOperations ManagedInstanceOperations { get; } /// - /// Gets the IBackupShortTermRetentionPoliciesOperations. + /// Gets the IManagedInstancePrivateEndpointConnectionsOperations. /// - IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; } + IManagedInstancePrivateEndpointConnectionsOperations ManagedInstancePrivateEndpointConnections { get; } + + /// + /// Gets the IManagedInstancePrivateLinkResourcesOperations. + /// + IManagedInstancePrivateLinkResourcesOperations ManagedInstancePrivateLinkResources { get; } + + /// + /// Gets the IManagedInstancesOperations. + /// + IManagedInstancesOperations ManagedInstances { get; } + + /// + /// Gets the IManagedInstanceTdeCertificatesOperations. + /// + IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; } /// /// Gets the IManagedInstanceVulnerabilityAssessmentsOperations. @@ -418,24 +483,29 @@ public partial interface ISqlManagementClient : System.IDisposable IManagedInstanceVulnerabilityAssessmentsOperations ManagedInstanceVulnerabilityAssessments { get; } /// - /// Gets the IServerVulnerabilityAssessmentsOperations. + /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. /// - IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; } + IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; } /// - /// Gets the IManagedDatabaseSensitivityLabelsOperations. + /// Gets the IManagedServerSecurityAlertPoliciesOperations. /// - IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; } + IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; } /// - /// Gets the IInstancePoolsOperations. + /// Gets the IOperations. /// - IInstancePoolsOperations InstancePools { get; } + IOperations Operations { get; } /// - /// Gets the IUsagesOperations. + /// Gets the IOperationsHealthOperations. /// - IUsagesOperations Usages { get; } + IOperationsHealthOperations OperationsHealth { get; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } /// /// Gets the IPrivateLinkResourcesOperations. @@ -443,84 +513,84 @@ public partial interface ISqlManagementClient : System.IDisposable IPrivateLinkResourcesOperations PrivateLinkResources { get; } /// - /// Gets the IServersOperations. + /// Gets the IRecoverableManagedDatabasesOperations. /// - IServersOperations Servers { get; } + IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; } /// - /// Gets the ICapabilitiesOperations. + /// Gets the IRestorableDroppedDatabasesOperations. /// - ICapabilitiesOperations Capabilities { get; } + IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; } /// - /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. + /// Gets the IRestorableDroppedManagedDatabasesOperations. /// - ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; } + IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; } /// - /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. + /// Gets the IRestorePointsOperations. /// - IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; } + IRestorePointsOperations RestorePoints { get; } /// - /// Gets the IWorkloadGroupsOperations. + /// Gets the ISensitivityLabelsOperations. /// - IWorkloadGroupsOperations WorkloadGroups { get; } + ISensitivityLabelsOperations SensitivityLabels { get; } /// - /// Gets the IWorkloadClassifiersOperations. + /// Gets the IRecommendedSensitivityLabelsOperations. /// - IWorkloadClassifiersOperations WorkloadClassifiers { get; } + IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; } /// - /// Gets the IManagedInstanceOperations. + /// Gets the IServerAdvisorsOperations. /// - IManagedInstanceOperations ManagedInstanceOperations { get; } + IServerAdvisorsOperations ServerAdvisors { get; } /// - /// Gets the IServerAzureADAdministratorsOperations. + /// Gets the IServerAutomaticTuningOperations. /// - IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; } + IServerAutomaticTuningOperations ServerAutomaticTuning { get; } /// - /// Gets the ISyncGroupsOperations. + /// Gets the IServerAzureADAdministratorsOperations. /// - ISyncGroupsOperations SyncGroups { get; } + IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; } /// - /// Gets the ISyncMembersOperations. + /// Gets the IServerAzureADOnlyAuthenticationsOperations. /// - ISyncMembersOperations SyncMembers { get; } + IServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications { get; } /// - /// Gets the IImportExportOperations. + /// Gets the IServerDevOpsAuditSettingsOperations. /// - IImportExportOperations ImportExport { get; } + IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; } /// - /// Gets the IManagedDatabasesOperations. + /// Gets the IServerDnsAliasesOperations. /// - IManagedDatabasesOperations ManagedDatabases { get; } + IServerDnsAliasesOperations ServerDnsAliases { get; } /// - /// Gets the IManagedDatabaseRestoreDetailsOperations. + /// Gets the IServerKeysOperations. /// - IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; } + IServerKeysOperations ServerKeys { get; } /// - /// Gets the IServerAzureADOnlyAuthenticationsOperations. + /// Gets the IServerOperations. /// - IServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications { get; } + IServerOperations ServerOperations { get; } /// - /// Gets the IManagedInstancesOperations. + /// Gets the IServersOperations. /// - IManagedInstancesOperations ManagedInstances { get; } + IServersOperations Servers { get; } /// - /// Gets the IManagedInstanceAzureADOnlyAuthenticationsOperations. + /// Gets the IServerSecurityAlertPoliciesOperations. /// - IManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications { get; } + IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; } /// /// Gets the IServerTrustGroupsOperations. @@ -528,24 +598,64 @@ public partial interface ISqlManagementClient : System.IDisposable IServerTrustGroupsOperations ServerTrustGroups { get; } /// - /// Gets the IServerDevOpsAuditSettingsOperations. + /// Gets the IServerVulnerabilityAssessmentsOperations. /// - IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; } + IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; } /// - /// Gets the ILongTermRetentionBackupsOperations. + /// Gets the ISqlAgentOperations. /// - ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; } + ISqlAgentOperations SqlAgent { get; } /// - /// Gets the ILongTermRetentionPoliciesOperations. + /// Gets the ISubscriptionUsagesOperations. /// - ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; } + ISubscriptionUsagesOperations SubscriptionUsages { get; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the ISyncAgentsOperations. /// - IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + ISyncAgentsOperations SyncAgents { get; } + + /// + /// Gets the ISyncGroupsOperations. + /// + ISyncGroupsOperations SyncGroups { get; } + + /// + /// Gets the ISyncMembersOperations. + /// + ISyncMembersOperations SyncMembers { get; } + + /// + /// Gets the ITdeCertificatesOperations. + /// + ITdeCertificatesOperations TdeCertificates { get; } + + /// + /// Gets the ITimeZonesOperations. + /// + ITimeZonesOperations TimeZones { get; } + + /// + /// Gets the IVirtualClustersOperations. + /// + IVirtualClustersOperations VirtualClusters { get; } + + /// + /// Gets the IVirtualNetworkRulesOperations. + /// + IVirtualNetworkRulesOperations VirtualNetworkRules { get; } + + /// + /// Gets the IWorkloadClassifiersOperations. + /// + IWorkloadClassifiersOperations WorkloadClassifiers { get; } + + /// + /// Gets the IWorkloadGroupsOperations. + /// + IWorkloadGroupsOperations WorkloadGroups { get; } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITimeZonesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITimeZonesOperations.cs new file mode 100644 index 0000000000000..98239ccf0fc8c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ITimeZonesOperations.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TimeZonesOperations operations. + /// + public partial interface ITimeZonesOperations + { + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a managed instance time zone. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string locationName, string timeZoneId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IVirtualClustersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IVirtualClustersOperations.cs index 23a69eddfd987..65bb4f5d51a6c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IVirtualClustersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/IVirtualClustersOperations.cs @@ -23,6 +23,34 @@ namespace Microsoft.Azure.Management.Sql /// public partial interface IVirtualClustersOperations { + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateDnsServersWithHttpMessagesAsync(string resourceGroupName, string virtualClusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of all virtualClusters in the subscription. /// @@ -129,7 +157,7 @@ public partial interface IVirtualClustersOperations /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The headers that will be added to request. @@ -183,7 +211,7 @@ public partial interface IVirtualClustersOperations /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The headers that will be added to request. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstanceFailoverGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstanceFailoverGroupsOperations.cs index 2596e4085a075..ae4cccd2ccf7a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstanceFailoverGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstanceFailoverGroupsOperations.cs @@ -102,7 +102,7 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +354,7 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -621,7 +621,7 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -847,7 +847,7 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1034,7 +1034,7 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1239,7 +1239,7 @@ internal InstanceFailoverGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstancePoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstancePoolsOperations.cs index c8d461ed5c3a8..4c0cfa698ef09 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstancePoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/InstancePoolsOperations.cs @@ -95,7 +95,7 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -358,7 +358,7 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -536,7 +536,7 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -738,7 +738,7 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -955,7 +955,7 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1139,7 +1139,7 @@ internal InstancePoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobAgentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobAgentsOperations.cs index 1dd2de8a01872..b705f63649482 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobAgentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobAgentsOperations.cs @@ -95,7 +95,7 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -297,7 +297,7 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -596,7 +596,7 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -822,7 +822,7 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1015,7 +1015,7 @@ internal JobAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobCredentialsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobCredentialsOperations.cs index e030fd0a02274..e88edc8fd0fdb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobCredentialsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobCredentialsOperations.cs @@ -102,7 +102,7 @@ internal JobCredentialsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -313,7 +313,7 @@ internal JobCredentialsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -537,7 +537,7 @@ internal JobCredentialsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -772,7 +772,7 @@ internal JobCredentialsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperations.cs index ce9b96d7b30fb..ea15030d5d0f5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobExecutionsOperations.cs @@ -127,7 +127,7 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -373,7 +373,7 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -624,7 +624,7 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -875,7 +875,7 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1122,7 +1122,7 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1338,7 +1338,7 @@ internal JobExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperations.cs index 9af657b8e1468..e21049039d3b7 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepExecutionsOperations.cs @@ -137,7 +137,7 @@ internal JobStepExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -397,7 +397,7 @@ internal JobStepExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepsOperations.cs index 1bc81f5513c00..55a738edddc37 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobStepsOperations.cs @@ -112,7 +112,7 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -337,7 +337,7 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -554,7 +554,7 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -774,7 +774,7 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1008,7 +1008,7 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1252,7 +1252,7 @@ internal JobStepsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperations.cs index d4817fd08a08e..7f41f5ea19771 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetExecutionsOperations.cs @@ -137,7 +137,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -422,7 +422,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -687,7 +687,7 @@ internal JobTargetExecutionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetGroupsOperations.cs index 38240af52680c..f0be5c6995261 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobTargetGroupsOperations.cs @@ -102,7 +102,7 @@ internal JobTargetGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -313,7 +313,7 @@ internal JobTargetGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -537,7 +537,7 @@ internal JobTargetGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -772,7 +772,7 @@ internal JobTargetGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobVersionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobVersionsOperations.cs index 95c25514ce534..673c8084e64c4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobVersionsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobVersionsOperations.cs @@ -109,7 +109,7 @@ internal JobVersionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -325,7 +325,7 @@ internal JobVersionsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobsOperations.cs index c332ef3b62aec..858e343249a09 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/JobsOperations.cs @@ -102,7 +102,7 @@ internal JobsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -313,7 +313,7 @@ internal JobsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -533,7 +533,7 @@ internal JobsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -768,7 +768,7 @@ internal JobsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs index 67eb9ce021611..45b7097649d16 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/LongTermRetentionManagedInstanceBackupsOperations.cs @@ -108,7 +108,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -348,7 +348,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -561,7 +561,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -766,7 +766,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -990,7 +990,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1244,7 +1244,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1467,7 +1467,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1682,7 +1682,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1897,7 +1897,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2096,7 +2096,7 @@ internal LongTermRetentionManagedInstanceBackupsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs similarity index 74% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs index 669d67e32d6b8..0d98ebeede606 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ImportExportOperations operations. + /// MaintenanceWindowOptionsOperations operations. /// - internal partial class ImportExportOperations : IServiceOperations, IImportExportOperations + internal partial class MaintenanceWindowOptionsOperations : IServiceOperations, IMaintenanceWindowOptionsOperations { /// - /// Initializes a new instance of the ImportExportOperations class. + /// Initializes a new instance of the MaintenanceWindowOptionsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ImportExportOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ImportExportOperations(SqlManagementClient client) + internal MaintenanceWindowOptionsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,7 @@ internal ImportExportOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Imports a bacpac into a new database. + /// Gets a list of available maintenance windows. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -61,39 +61,10 @@ internal ImportExportOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of the database. + /// The name of the database to get maintenance windows options for. /// - /// - /// The database import request parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).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. + /// + /// Maintenance window options name. /// /// /// Headers that will be added to request. @@ -116,7 +87,7 @@ internal ImportExportOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -130,19 +101,15 @@ internal ImportExportOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (parameters == null) + if (maintenanceWindowOptionsName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "maintenanceWindowOptionsName"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -153,19 +120,23 @@ internal ImportExportOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("maintenanceWindowOptionsName", maintenanceWindowOptionsName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginImport", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/import").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindowOptions/current").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (maintenanceWindowOptionsName != null) + { + _queryParameters.Add(string.Format("maintenanceWindowOptionsName={0}", System.Uri.EscapeDataString(maintenanceWindowOptionsName))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -177,7 +148,7 @@ internal ImportExportOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -208,12 +179,6 @@ internal ImportExportOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -234,7 +199,7 @@ internal ImportExportOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -269,7 +234,7 @@ internal ImportExportOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -282,7 +247,7 @@ internal ImportExportOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperationsExtensions.cs new file mode 100644 index 0000000000000..559a2b79077b6 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowOptionsOperationsExtensions.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MaintenanceWindowOptionsOperations. + /// + public static partial class MaintenanceWindowOptionsOperationsExtensions + { + /// + /// Gets a list of available maintenance windows. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static MaintenanceWindowOptions Get(this IMaintenanceWindowOptionsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName) + { + return operations.GetAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of available maintenance windows. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task GetAsync(this IMaintenanceWindowOptionsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowOptionsName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperations.cs similarity index 83% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperations.cs index 0ae12e2249e01..1b0a17df6643a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServiceTierAdvisorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// ServiceTierAdvisorsOperations operations. + /// MaintenanceWindowsOperations operations. /// - internal partial class ServiceTierAdvisorsOperations : IServiceOperations, IServiceTierAdvisorsOperations + internal partial class MaintenanceWindowsOperations : IServiceOperations, IMaintenanceWindowsOperations { /// - /// Initializes a new instance of the ServiceTierAdvisorsOperations class. + /// Initializes a new instance of the MaintenanceWindowsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ServiceTierAdvisorsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ServiceTierAdvisorsOperations(SqlManagementClient client) + internal MaintenanceWindowsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a service tier advisor. + /// Gets maintenance windows settings for a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -61,10 +61,10 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of database. + /// The name of the database to get maintenance windows for. /// - /// - /// The name of service tier advisor. + /// + /// Maintenance window name. /// /// /// Headers that will be added to request. @@ -87,12 +87,8 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string serviceTierAdvisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -105,11 +101,15 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (serviceTierAdvisorName == null) + if (maintenanceWindowName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serviceTierAdvisorName"); + throw new ValidationException(ValidationRules.CannotBeNull, "maintenanceWindowName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -117,23 +117,26 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("serviceTierAdvisorName", serviceTierAdvisorName); + tracingParameters.Add("maintenanceWindowName", maintenanceWindowName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindows/current").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{serviceTierAdvisorName}", System.Uri.EscapeDataString(serviceTierAdvisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (maintenanceWindowName != null) + { + _queryParameters.Add(string.Format("maintenanceWindowName={0}", System.Uri.EscapeDataString(maintenanceWindowName))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -231,7 +234,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -244,7 +247,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -264,7 +267,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) } /// - /// Returns service tier advisors for specified database. + /// Sets maintenance windows settings for a database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -274,7 +277,12 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) /// The name of the server. /// /// - /// The name of database. + /// The name of the database to set maintenance windows for. + /// + /// + /// Maintenance window name. + /// + /// /// /// /// Headers that will be added to request. @@ -285,9 +293,6 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -297,12 +302,8 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -315,7 +316,19 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2014-04-01"; + if (maintenanceWindowName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "maintenanceWindowName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -323,21 +336,27 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("maintenanceWindowName", maintenanceWindowName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/maintenanceWindows/current").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (maintenanceWindowName != null) + { + _queryParameters.Add(string.Format("maintenanceWindowName={0}", System.Uri.EscapeDataString(maintenanceWindowName))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -349,7 +368,7 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -380,6 +399,12 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -435,31 +460,13 @@ internal ServiceTierAdvisorsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperationsExtensions.cs similarity index 57% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperationsExtensions.cs index 18c50c663a90b..f19d63b13c963 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/MaintenanceWindowsOperationsExtensions.cs @@ -17,12 +17,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for DatabaseThreatDetectionPoliciesOperations. + /// Extension methods for MaintenanceWindowsOperations. /// - public static partial class DatabaseThreatDetectionPoliciesOperationsExtensions + public static partial class MaintenanceWindowsOperationsExtensions { /// - /// Gets a database's threat detection policy. + /// Gets maintenance windows settings for a database. /// /// /// The operations group for this extension method. @@ -35,16 +35,18 @@ public static partial class DatabaseThreatDetectionPoliciesOperationsExtensions /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database to get maintenance windows for. /// - public static DatabaseSecurityAlertPolicy Get(this IDatabaseThreatDetectionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName) + /// + /// Maintenance window name. + /// + public static MaintenanceWindows Get(this IMaintenanceWindowsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName) { - return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName).GetAwaiter().GetResult(); } /// - /// Gets a database's threat detection policy. + /// Gets maintenance windows settings for a database. /// /// /// The operations group for this extension method. @@ -57,22 +59,24 @@ public static DatabaseSecurityAlertPolicy Get(this IDatabaseThreatDetectionPolic /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database to get maintenance windows for. + /// + /// + /// Maintenance window name. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IDatabaseThreatDetectionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IMaintenanceWindowsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates or updates a database's threat detection policy. + /// Sets maintenance windows settings for a database. /// /// /// The operations group for this extension method. @@ -85,19 +89,20 @@ public static DatabaseSecurityAlertPolicy Get(this IDatabaseThreatDetectionPolic /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database to set maintenance windows for. + /// + /// + /// Maintenance window name. /// /// - /// The database Threat Detection policy. /// - public static DatabaseSecurityAlertPolicy CreateOrUpdate(this IDatabaseThreatDetectionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters) + public static void CreateOrUpdate(this IMaintenanceWindowsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters).GetAwaiter().GetResult(); } /// - /// Creates or updates a database's threat detection policy. + /// Sets maintenance windows settings for a database. /// /// /// The operations group for this extension method. @@ -110,21 +115,19 @@ public static DatabaseSecurityAlertPolicy CreateOrUpdate(this IDatabaseThreatDet /// The name of the server. /// /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// The name of the database to set maintenance windows for. + /// + /// + /// Maintenance window name. /// /// - /// The database Threat Detection policy. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IDatabaseThreatDetectionPoliciesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IMaintenanceWindowsOperations operations, string resourceGroupName, string serverName, string databaseName, string maintenanceWindowName, MaintenanceWindows parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesOperations.cs index e61053122762c..7c7674f8fa194 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedBackupShortTermRetentionPoliciesOperations.cs @@ -103,7 +103,7 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,7 +367,7 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -579,7 +579,7 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -800,7 +800,7 @@ internal ManagedBackupShortTermRetentionPoliciesOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs new file mode 100644 index 0000000000000..adf05430fafbb --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperations.cs @@ -0,0 +1,1146 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseColumnsOperations operations. + /// + internal partial class ManagedDatabaseColumnsOperations : IServiceOperations, IManagedDatabaseColumnsOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseColumnsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseColumnsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schema", schema); + tracingParameters.Add("table", table); + tracingParameters.Add("column", column); + tracingParameters.Add("orderBy", orderBy); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/columns").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (schema != null) + { + if (schema.Count == 0) + { + _queryParameters.Add(string.Format("schema={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in schema) + { + _queryParameters.Add(string.Format("schema={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (table != null) + { + if (table.Count == 0) + { + _queryParameters.Add(string.Format("table={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in table) + { + _queryParameters.Add(string.Format("table={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (column != null) + { + if (column.Count == 0) + { + _queryParameters.Add(string.Format("column={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in column) + { + _queryParameters.Add(string.Format("column={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (orderBy != null) + { + if (orderBy.Count == 0) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString(string.Empty))); + } + else + { + foreach (var _item in orderBy) + { + _queryParameters.Add(string.Format("orderBy={0}", System.Uri.EscapeDataString("" + _item))); + } + } + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTableWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTable", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (columnName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "columnName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("columnName", columnName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{columnName}", System.Uri.EscapeDataString(columnName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed database columns + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByTableNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByTableNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperationsExtensions.cs new file mode 100644 index 0000000000000..6133264edb2bf --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseColumnsOperationsExtensions.cs @@ -0,0 +1,298 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseColumnsOperations. + /// + public static partial class ManagedDatabaseColumnsOperationsExtensions + { + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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 opaque token that identifies a starting point in the collection. + /// + public static IPage ListByDatabase(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string)) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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 opaque token that identifies a starting point in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, IList schema = default(IList), IList table = default(IList), IList column = default(IList), IList orderBy = default(IList), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByTable(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByTableAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTableAsync(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get managed database column + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static DatabaseColumn Get(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName).GetAwaiter().GetResult(); + } + + /// + /// Get managed database column + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task GetAsync(this IManagedDatabaseColumnsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, string columnName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseColumnsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IManagedDatabaseColumnsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByTableNext(this IManagedDatabaseColumnsOperations operations, string nextPageLink) + { + return operations.ListByTableNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List managed database columns + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByTableNextAsync(this IManagedDatabaseColumnsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByTableNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs new file mode 100644 index 0000000000000..73627d7d5f6cc --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperations.cs @@ -0,0 +1,676 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseQueriesOperations operations. + /// + internal partial class ManagedDatabaseQueriesOperations : IServiceOperations, IManagedDatabaseQueriesOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseQueriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseQueriesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (queryId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "queryId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("queryId", queryId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/queries/{queryId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{queryId}", System.Uri.EscapeDataString(queryId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// + /// Start time for observed period. + /// + /// + /// End time for observed period. + /// + /// + /// The time step to be used to summarize the metric values. Possible values + /// include: 'PT1H', 'P1D' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByQueryWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = default(string), string endTime = default(string), string interval = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (queryId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "queryId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("queryId", queryId); + tracingParameters.Add("startTime", startTime); + tracingParameters.Add("endTime", endTime); + tracingParameters.Add("interval", interval); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByQuery", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/queries/{queryId}/statistics").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{queryId}", System.Uri.EscapeDataString(queryId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (startTime != null) + { + _queryParameters.Add(string.Format("startTime={0}", System.Uri.EscapeDataString(startTime))); + } + if (endTime != null) + { + _queryParameters.Add(string.Format("endTime={0}", System.Uri.EscapeDataString(endTime))); + } + if (interval != null) + { + _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(interval))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByQueryNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByQueryNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperationsExtensions.cs new file mode 100644 index 0000000000000..13a1a4fdad354 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseQueriesOperationsExtensions.cs @@ -0,0 +1,183 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseQueriesOperations. + /// + public static partial class ManagedDatabaseQueriesOperationsExtensions + { + /// + /// Get query by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + public static ManagedInstanceQuery Get(this IManagedDatabaseQueriesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string queryId) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, queryId).GetAwaiter().GetResult(); + } + + /// + /// Get query by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task GetAsync(this IManagedDatabaseQueriesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, queryId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + /// + /// Start time for observed period. + /// + /// + /// End time for observed period. + /// + /// + /// The time step to be used to summarize the metric values. Possible values + /// include: 'PT1H', 'P1D' + /// + public static IPage ListByQuery(this IManagedDatabaseQueriesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = default(string), string endTime = default(string), string interval = default(string)) + { + return operations.ListByQueryAsync(resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval).GetAwaiter().GetResult(); + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + /// + /// Start time for observed period. + /// + /// + /// End time for observed period. + /// + /// + /// The time step to be used to summarize the metric values. Possible values + /// include: 'PT1H', 'P1D' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByQueryAsync(this IManagedDatabaseQueriesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string queryId, string startTime = default(string), string endTime = default(string), string interval = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByQueryWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByQueryNext(this IManagedDatabaseQueriesOperations operations, string nextPageLink) + { + return operations.ListByQueryNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get query execution statistics by query id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByQueryNextAsync(this IManagedDatabaseQueriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByQueryNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs new file mode 100644 index 0000000000000..83420a3c4ec1c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperations.cs @@ -0,0 +1,251 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseRecommendedSensitivityLabelsOperations operations. + /// + internal partial class ManagedDatabaseRecommendedSensitivityLabelsOperations : IServiceOperations, IManagedDatabaseRecommendedSensitivityLabelsOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseRecommendedSensitivityLabelsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseRecommendedSensitivityLabelsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions.cs new file mode 100644 index 0000000000000..4877ec87a8580 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseRecommendedSensitivityLabelsOperations. + /// + public static partial class ManagedDatabaseRecommendedSensitivityLabelsOperationsExtensions + { + /// + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + public static void Update(this IManagedDatabaseRecommendedSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters) + { + operations.UpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task UpdateAsync(this IManagedDatabaseRecommendedSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs index 2cd4ac21902cc..b20fe3978d238 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseRestoreDetailsOperations.cs @@ -103,7 +103,7 @@ internal ManagedDatabaseRestoreDetailsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string restoreDetailsName = "Default"; - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs new file mode 100644 index 0000000000000..83db03275f35e --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperations.cs @@ -0,0 +1,657 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseSchemasOperations operations. + /// + internal partial class ManagedDatabaseSchemasOperations : IServiceOperations, IManagedDatabaseSchemasOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseSchemasOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseSchemasOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed database schemas + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperationsExtensions.cs new file mode 100644 index 0000000000000..e0170f3e81e59 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSchemasOperationsExtensions.cs @@ -0,0 +1,168 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseSchemasOperations. + /// + public static partial class ManagedDatabaseSchemasOperationsExtensions + { + /// + /// List managed database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByDatabase(this IManagedDatabaseSchemasOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List managed database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IManagedDatabaseSchemasOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get managed database schema + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static DatabaseSchema Get(this IManagedDatabaseSchemasOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName).GetAwaiter().GetResult(); + } + + /// + /// Get managed database schema + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task GetAsync(this IManagedDatabaseSchemasOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseSchemasOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List managed database schemas + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IManagedDatabaseSchemasOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs index 5bbbf04b97057..6d3c3007cdaf5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityAlertPoliciesOperations.cs @@ -104,7 +104,7 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string securityAlertPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -323,7 +323,7 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string securityAlertPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -555,7 +555,7 @@ internal ManagedDatabaseSecurityAlertPoliciesOperations(SqlManagementClient clie { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs new file mode 100644 index 0000000000000..8ee3f6f60a3a3 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperations.cs @@ -0,0 +1,453 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseSecurityEventsOperations operations. + /// + internal partial class ManagedDatabaseSecurityEventsOperations : IServiceOperations, IManagedDatabaseSecurityEventsOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseSecurityEventsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseSecurityEventsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityEvents").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of security events. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperationsExtensions.cs new file mode 100644 index 0000000000000..2b3853c378e37 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSecurityEventsOperationsExtensions.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseSecurityEventsOperations. + /// + public static partial class ManagedDatabaseSecurityEventsOperationsExtensions + { + /// + /// Gets a list of security events. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + public static IPage ListByDatabase(this IManagedDatabaseSecurityEventsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string)) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of security events. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// An opaque token that identifies a starting point in the collection. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IManagedDatabaseSecurityEventsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of security events. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseSecurityEventsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of security events. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IManagedDatabaseSecurityEventsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs index 04ed1a2032b9f..2ad06b5467fb3 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperations.cs @@ -128,7 +128,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -369,7 +369,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "current"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -625,7 +625,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "current"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -838,7 +838,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "recommended"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1052,7 +1052,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "recommended"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1210,6 +1210,10 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// Headers that will be added to request. /// @@ -1231,7 +1235,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1249,7 +1253,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1261,6 +1265,8 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("count", count); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabase", tracingParameters); @@ -1281,6 +1287,14 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _queryParameters.Add(_odataFilter); } } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (count != null) + { + _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1410,6 +1424,202 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) return _result; } + /// + /// 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. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets the sensitivity labels of a given database /// @@ -1426,11 +1636,11 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// Headers that will be added to request. /// @@ -1452,7 +1662,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1470,7 +1680,7 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1482,8 +1692,8 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabase", tracingParameters); @@ -1504,14 +1714,14 @@ internal ManagedDatabaseSensitivityLabelsOperations(SqlManagementClient client) _queryParameters.Add(_odataFilter); } } - if (includeDisabledRecommendations != null) - { - _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); - } if (skipToken != null) { _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); } + if (includeDisabledRecommendations != null) + { + _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs index b619b09ab8b96..c69fc7581d307 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseSensitivityLabelsOperationsExtensions.cs @@ -378,9 +378,13 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// OData parameters to apply to the operation. /// - public static IPage ListCurrentByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) + /// + /// + /// + /// + public static IPage ListCurrentByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?)) { - return operations.ListCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery).GetAwaiter().GetResult(); + return operations.ListCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, count).GetAwaiter().GetResult(); } /// @@ -402,17 +406,70 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListCurrentByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListCurrentByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, count, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + public static void Update(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters) + { + operations.UpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task UpdateAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets the sensitivity labels of a given database /// @@ -432,14 +489,14 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// - public static IPage ListRecommendedByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string)) + public static IPage ListRecommendedByDatabase(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?)) { - return operations.ListRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, includeDisabledRecommendations, skipToken).GetAwaiter().GetResult(); + return operations.ListRecommendedByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, includeDisabledRecommendations).GetAwaiter().GetResult(); } /// @@ -461,17 +518,17 @@ public static void EnableRecommendation(this IManagedDatabaseSensitivityLabelsOp /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// The cancellation token. /// - public static async Task> ListRecommendedByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListRecommendedByDatabaseAsync(this IManagedDatabaseSensitivityLabelsOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, includeDisabledRecommendations, skipToken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, odataQuery, skipToken, includeDisabledRecommendations, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperations.cs new file mode 100644 index 0000000000000..a23e3f6493396 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperations.cs @@ -0,0 +1,675 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseTablesOperations operations. + /// + internal partial class ManagedDatabaseTablesOperations : IServiceOperations, IManagedDatabaseTablesOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseTablesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseTablesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySchemaWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchema", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (schemaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "schemaName"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("schemaName", schemaName); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{schemaName}", System.Uri.EscapeDataString(schemaName)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List managed database tables + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySchemaNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySchemaNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperationsExtensions.cs new file mode 100644 index 0000000000000..1a597d451bf0d --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTablesOperationsExtensions.cs @@ -0,0 +1,180 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseTablesOperations. + /// + public static partial class ManagedDatabaseTablesOperationsExtensions + { + /// + /// List managed database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListBySchema(this IManagedDatabaseTablesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListBySchemaAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// List managed database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySchemaAsync(this IManagedDatabaseTablesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get managed database table + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static DatabaseTable Get(this IManagedDatabaseTablesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName).GetAwaiter().GetResult(); + } + + /// + /// Get managed database table + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task GetAsync(this IManagedDatabaseTablesOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string schemaName, string tableName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List managed database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySchemaNext(this IManagedDatabaseTablesOperations operations, string nextPageLink) + { + return operations.ListBySchemaNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List managed database tables + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySchemaNextAsync(this IManagedDatabaseTablesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySchemaNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs new file mode 100644 index 0000000000000..17181861daf94 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperations.cs @@ -0,0 +1,884 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedDatabaseTransparentDataEncryptionOperations operations. + /// + internal partial class ManagedDatabaseTransparentDataEncryptionOperations : IServiceOperations, IManagedDatabaseTransparentDataEncryptionOperations + { + /// + /// Initializes a new instance of the ManagedDatabaseTransparentDataEncryptionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedDatabaseTransparentDataEncryptionOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string tdeName = "current"; + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("tdeName", tdeName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption/{tdeName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{tdeName}", System.Uri.EscapeDataString(tdeName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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 database transparent data encryption. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, ManagedTransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string tdeName = "current"; + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("tdeName", tdeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption/{tdeName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{tdeName}", System.Uri.EscapeDataString(tdeName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperationsExtensions.cs new file mode 100644 index 0000000000000..3542c16e7d919 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseTransparentDataEncryptionOperationsExtensions.cs @@ -0,0 +1,215 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedDatabaseTransparentDataEncryptionOperations. + /// + public static partial class ManagedDatabaseTransparentDataEncryptionOperationsExtensions + { + /// + /// Gets a managed database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static ManagedTransparentDataEncryption Get(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a managed database's transparent data encryption. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task GetAsync(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a database's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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 database transparent data encryption. + /// + public static ManagedTransparentDataEncryption CreateOrUpdate(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ManagedTransparentDataEncryption parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a database's transparent data encryption configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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 database transparent data encryption. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, ManagedTransparentDataEncryption parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static IPage ListByDatabase(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) + { + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task> ListByDatabaseAsync(this IManagedDatabaseTransparentDataEncryptionOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IManagedDatabaseTransparentDataEncryptionOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed database's transparent data encryptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IManagedDatabaseTransparentDataEncryptionOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs index b0a6e8a3a629e..2d8c85830d394 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations.cs @@ -116,7 +116,7 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -351,7 +351,7 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -579,7 +579,7 @@ internal ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(SqlManage throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs index 7c3f7bc05a57a..f76dec6b4d548 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperations.cs @@ -51,7 +51,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie public SqlManagementClient Client { get; private set; } /// - /// 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 @@ -63,6 +63,39 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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 scanned database. + /// + /// + /// The vulnerability assessment scan Id. + /// /// /// Headers that will be added to request. /// @@ -84,7 +117,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -98,12 +131,16 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + if (scanId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,17 +152,19 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); + tracingParameters.Add("scanId", scanId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Export", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); + _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -139,7 +178,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -190,7 +229,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -225,7 +264,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -238,7 +277,25 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -258,7 +315,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie } /// - /// 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 @@ -270,9 +327,6 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// Headers that will be added to request. /// @@ -294,7 +348,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -308,16 +362,12 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - if (scanId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -329,19 +379,17 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName); - tracingParameters.Add("scanId", scanId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); _url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName)); - _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -441,7 +489,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -454,7 +502,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -474,7 +522,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie } /// - /// 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 @@ -490,36 +538,6 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// The vulnerability assessment scan Id of the scan to retrieve. /// /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task InitiateScanWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// 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 scanned database. - /// - /// - /// The vulnerability assessment scan Id. - /// - /// /// Headers that will be added to request. /// /// @@ -540,7 +558,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie /// /// A response object containing the response body and response headers. /// - public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string databaseName, string scanId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -563,7 +581,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -578,11 +596,11 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie tracingParameters.Add("scanId", scanId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Export", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); @@ -601,7 +619,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -652,7 +670,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -687,7 +705,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -700,25 +718,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -794,7 +794,7 @@ internal ManagedDatabaseVulnerabilityAssessmentScansOperations(SqlManagementClie throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions.cs index cb7615d9e2390..cb2abfd3b76d7 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class ManagedDatabaseVulnerabilityAssessmentScansOperationsExtensions { /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The operations group for this extension method. @@ -37,13 +37,16 @@ public static partial class ManagedDatabaseVulnerabilityAssessmentScansOperation /// /// The name of the database. /// - public static IPage ListByDatabase(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// + public static void InitiateScan(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) { - return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); + operations.InitiateScanAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// Lists the vulnerability assessment scans of a database. + /// Executes a Vulnerability Assessment database scan. /// /// /// The operations group for this extension method. @@ -58,19 +61,20 @@ public static IPage ListByDatabase(this IMana /// /// The name of the database. /// + /// + /// The vulnerability assessment scan Id of the scan to retrieve. + /// /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task InitiateScanAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// 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 operations group for this extension method. @@ -83,18 +87,19 @@ public static IPage ListByDatabase(this IMana /// The name of the managed instance. /// /// - /// The name of the database. + /// The name of the scanned database. /// /// - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// - public static VulnerabilityAssessmentScanRecord Get(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) + public static DatabaseVulnerabilityAssessmentScansExport Export(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) { - return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.ExportAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// 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 operations group for this extension method. @@ -107,24 +112,24 @@ public static VulnerabilityAssessmentScanRecord Get(this IManagedDatabaseVulnera /// The name of the managed instance. /// /// - /// The name of the database. + /// The name of the scanned database. /// /// - /// The vulnerability assessment scan Id of the scan to retrieve. + /// The vulnerability assessment scan Id. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExportAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Executes a Vulnerability Assessment database scan. + /// Lists the vulnerability assessment scans of a database. /// /// /// The operations group for this extension method. @@ -139,16 +144,13 @@ public static VulnerabilityAssessmentScanRecord Get(this IManagedDatabaseVulnera /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// - public static void InitiateScan(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) + public static IPage ListByDatabase(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName) { - operations.InitiateScanAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.ListByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName).GetAwaiter().GetResult(); } /// - /// Executes a Vulnerability Assessment database scan. + /// Lists the vulnerability assessment scans of a database. /// /// /// The operations group for this extension method. @@ -163,20 +165,19 @@ public static void InitiateScan(this IManagedDatabaseVulnerabilityAssessmentScan /// /// The name of the database. /// - /// - /// The vulnerability assessment scan Id of the scan to retrieve. - /// /// /// The cancellation token. /// - public static async Task InitiateScanAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.InitiateScanWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// 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 operations group for this extension method. @@ -189,19 +190,18 @@ public static void InitiateScan(this IManagedDatabaseVulnerabilityAssessmentScan /// The name of the managed instance. /// /// - /// The name of the scanned database. + /// The name of the database. /// /// - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// - public static DatabaseVulnerabilityAssessmentScansExport Export(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) + public static VulnerabilityAssessmentScanRecord Get(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId) { - return operations.ExportAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName, databaseName, scanId).GetAwaiter().GetResult(); } /// - /// 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 operations group for this extension method. @@ -214,17 +214,17 @@ public static DatabaseVulnerabilityAssessmentScansExport Export(this IManagedDat /// The name of the managed instance. /// /// - /// The name of the scanned database. + /// The name of the database. /// /// - /// The vulnerability assessment scan Id. + /// The vulnerability assessment scan Id of the scan to retrieve. /// /// /// The cancellation token. /// - public static async Task ExportAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IManagedDatabaseVulnerabilityAssessmentScansOperations operations, string resourceGroupName, string managedInstanceName, string databaseName, string scanId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, databaseName, scanId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsOperations.cs index eb9d3a9926a45..7ed1452e8248b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentsOperations.cs @@ -103,7 +103,7 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -317,7 +317,7 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -546,7 +546,7 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -734,7 +734,7 @@ internal ManagedDatabaseVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabasesOperations.cs index de5e314814e1b..997ff334f6229 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedDatabasesOperations.cs @@ -95,7 +95,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -297,7 +297,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -607,7 +607,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -820,7 +820,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1046,7 +1046,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1239,7 +1239,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1458,7 +1458,7 @@ internal ManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs index 9fe6d8dd70984..71684b717e0c6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAdministratorsOperations.cs @@ -95,7 +95,7 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -291,7 +291,7 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string administratorName = "ActiveDirectory"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -549,7 +549,7 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string administratorName = "ActiveDirectory"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -769,7 +769,7 @@ internal ManagedInstanceAdministratorsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string administratorName = "ActiveDirectory"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs index 563938213255c..7da840e355be5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceAzureADOnlyAuthenticationsOperations.cs @@ -96,7 +96,7 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -344,7 +344,7 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -553,7 +553,7 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -773,7 +773,7 @@ internal ManagedInstanceAzureADOnlyAuthenticationsOperations(SqlManagementClient throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceEncryptionProtectorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceEncryptionProtectorsOperations.cs index d092627564571..8af5672a8c21e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceEncryptionProtectorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceEncryptionProtectorsOperations.cs @@ -118,7 +118,7 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -314,7 +314,7 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string encryptionProtectorName = "current"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -535,7 +535,7 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string encryptionProtectorName = "current"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -726,7 +726,7 @@ internal ManagedInstanceEncryptionProtectorsOperations(SqlManagementClient clien throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string encryptionProtectorName = "current"; - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceKeysOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceKeysOperations.cs index b56d54762d3ff..cca7b967eff47 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceKeysOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceKeysOperations.cs @@ -98,7 +98,7 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -305,7 +305,7 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -577,7 +577,7 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -803,7 +803,7 @@ internal ManagedInstanceKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs index 4d53c404517e2..3506f35e001cb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceLongTermRetentionPoliciesOperations.cs @@ -103,7 +103,7 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -338,7 +338,7 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -550,7 +550,7 @@ internal ManagedInstanceLongTermRetentionPoliciesOperations(SqlManagementClient throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperations.cs index a142ed7b62546..12555ad20da95 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperations.cs @@ -51,7 +51,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// 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 @@ -60,8 +60,6 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// The name of the managed instance. /// - /// - /// /// /// Headers that will be added to request. /// @@ -71,6 +69,9 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -80,7 +81,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -94,7 +95,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -104,17 +105,15 @@ internal ManagedInstanceOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); - tracingParameters.Add("operationId", operationId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}/cancel").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); - _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -128,7 +127,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -214,13 +213,31 @@ internal ManagedInstanceOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -229,7 +246,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) } /// - /// 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 @@ -238,6 +255,8 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// The name of the managed instance. /// + /// + /// /// /// Headers that will be added to request. /// @@ -259,7 +278,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -273,7 +292,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -283,15 +302,17 @@ internal ManagedInstanceOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("operationId", operationId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -391,7 +412,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -404,7 +425,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -424,7 +445,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) } /// - /// 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 @@ -444,9 +465,6 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -456,7 +474,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -470,7 +488,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -483,11 +501,11 @@ internal ManagedInstanceOperations(SqlManagementClient client) tracingParameters.Add("operationId", operationId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/operations/{operationId}/cancel").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"'))); @@ -504,7 +522,7 @@ internal ManagedInstanceOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -590,31 +608,13 @@ internal ManagedInstanceOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperationsExtensions.cs index 7598f83f77db0..a7ed94f3e074b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class ManagedInstanceOperationsExtensions { /// - /// Cancels the asynchronous operation on the managed instance. + /// Gets a list of operations performed on the managed instance. /// /// /// The operations group for this extension method. @@ -34,15 +34,13 @@ public static partial class ManagedInstanceOperationsExtensions /// /// The name of the managed instance. /// - /// - /// - public static void Cancel(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId) + public static IPage ListByManagedInstance(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName) { - operations.CancelAsync(resourceGroupName, managedInstanceName, operationId).GetAwaiter().GetResult(); + return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); } /// - /// Cancels the asynchronous operation on the managed instance. + /// Gets a list of operations performed on the managed instance. /// /// /// The operations group for this extension method. @@ -54,18 +52,19 @@ public static void Cancel(this IManagedInstanceOperations operations, string res /// /// The name of the managed instance. /// - /// - /// /// /// The cancellation token. /// - public static async Task CancelAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByManagedInstanceAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.CancelWithHttpMessagesAsync(resourceGroupName, managedInstanceName, operationId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Gets a list of operations performed on the managed instance. + /// Gets a management operation on a managed instance. /// /// /// The operations group for this extension method. @@ -77,13 +76,15 @@ public static void Cancel(this IManagedInstanceOperations operations, string res /// /// The name of the managed instance. /// - public static IPage ListByManagedInstance(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName) + /// + /// + public static ManagedInstanceOperation Get(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId) { - return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName, operationId).GetAwaiter().GetResult(); } /// - /// Gets a list of operations performed on the managed instance. + /// Gets a management operation on a managed instance. /// /// /// The operations group for this extension method. @@ -95,19 +96,21 @@ public static IPage ListByManagedInstance(this IManage /// /// The name of the managed instance. /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListByManagedInstanceAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, operationId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// /// /// The operations group for this extension method. @@ -121,13 +124,13 @@ public static IPage ListByManagedInstance(this IManage /// /// /// - public static ManagedInstanceOperation Get(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId) + public static void Cancel(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId) { - return operations.GetAsync(resourceGroupName, managedInstanceName, operationId).GetAwaiter().GetResult(); + operations.CancelAsync(resourceGroupName, managedInstanceName, operationId).GetAwaiter().GetResult(); } /// - /// Gets a management operation on a managed instance. + /// Cancels the asynchronous operation on the managed instance. /// /// /// The operations group for this extension method. @@ -144,12 +147,9 @@ public static ManagedInstanceOperation Get(this IManagedInstanceOperations opera /// /// The cancellation token. /// - public static async Task GetAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CancelAsync(this IManagedInstanceOperations operations, string resourceGroupName, string managedInstanceName, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, operationId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.CancelWithHttpMessagesAsync(resourceGroupName, managedInstanceName, operationId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..ed82b020cf4ee --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperations.cs @@ -0,0 +1,1080 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstancePrivateEndpointConnectionsOperations operations. + /// + internal partial class ManagedInstancePrivateEndpointConnectionsOperations : IServiceOperations, IManagedInstancePrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the ManagedInstancePrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedInstancePrivateEndpointConnectionsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 0000000000000..d6db30fc0241c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,335 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedInstancePrivateEndpointConnectionsOperations. + /// + public static partial class ManagedInstancePrivateEndpointConnectionsOperationsExtensions + { + /// + /// Gets a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static ManagedInstancePrivateEndpointConnection Get(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task GetAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + /// + /// + public static ManagedInstancePrivateEndpointConnection CreateOrUpdate(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task CreateOrUpdateAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + public static void Delete(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) + { + operations.DeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task DeleteAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static IPage ListByManagedInstance(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName) + { + return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task> ListByManagedInstanceAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + /// + /// + public static ManagedInstancePrivateEndpointConnection BeginCreateOrUpdate(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Approve or reject a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task BeginCreateOrUpdateAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, ManagedInstancePrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + /// + /// + public static void BeginDelete(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName) + { + operations.BeginDeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection with a given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task BeginDeleteAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string resourceGroupName, string managedInstanceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagedInstanceNext(this IManagedInstancePrivateEndpointConnectionsOperations operations, string nextPageLink) + { + return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all private endpoint connections on a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedInstanceNextAsync(this IManagedInstancePrivateEndpointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..3ccfc1d79613b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperations.cs @@ -0,0 +1,626 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedInstancePrivateLinkResourcesOperations operations. + /// + internal partial class ManagedInstancePrivateLinkResourcesOperations : IServiceOperations, IManagedInstancePrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the ManagedInstancePrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedInstancePrivateLinkResourcesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstance", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateLinkResources").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (groupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("groupName", groupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/privateLinkResources/{groupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 0000000000000..fe5787a00e1bd --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancePrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,149 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedInstancePrivateLinkResourcesOperations. + /// + public static partial class ManagedInstancePrivateLinkResourcesOperationsExtensions + { + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static IPage ListByManagedInstance(this IManagedInstancePrivateLinkResourcesOperations operations, string resourceGroupName, string managedInstanceName) + { + return operations.ListByManagedInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task> ListByManagedInstanceAsync(this IManagedInstancePrivateLinkResourcesOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a private link resource for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static ManagedInstancePrivateLink Get(this IManagedInstancePrivateLinkResourcesOperations operations, string resourceGroupName, string managedInstanceName, string groupName) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, groupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a private link resource for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task GetAsync(this IManagedInstancePrivateLinkResourcesOperations operations, string resourceGroupName, string managedInstanceName, string groupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, groupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagedInstanceNext(this IManagedInstancePrivateLinkResourcesOperations operations, string nextPageLink) + { + return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources for SQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedInstanceNextAsync(this IManagedInstancePrivateLinkResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceTdeCertificatesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceTdeCertificatesOperations.cs index 35957338cd6dc..3f4dd2a6c4240 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceTdeCertificatesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceTdeCertificatesOperations.cs @@ -129,7 +129,7 @@ internal ManagedInstanceTdeCertificatesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs index 4a276e802c646..2954c6cbdf32f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstanceVulnerabilityAssessmentsOperations.cs @@ -97,7 +97,7 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -307,7 +307,7 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -528,7 +528,7 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -708,7 +708,7 @@ internal ManagedInstanceVulnerabilityAssessmentsOperations(SqlManagementClient c { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs index 3bc76e76b7400..b2b25a5ff195b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperations.cs @@ -60,6 +60,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// The instance pool name. /// + /// + /// The child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -81,7 +84,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByInstancePoolWithHttpMessagesAsync(string resourceGroupName, string instancePoolName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -95,7 +98,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,6 +108,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("instancePoolName", instancePoolName); + tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInstancePool", tracingParameters); @@ -116,6 +120,194 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{instancePoolName}", System.Uri.EscapeDataString(instancePoolName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// The child resources to include in the response. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -252,6 +444,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// The 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. + /// /// /// Headers that will be added to request. /// @@ -273,7 +468,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -283,7 +478,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -292,6 +487,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); @@ -302,6 +498,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -441,6 +641,9 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// The name of the managed instance. /// + /// + /// The child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -462,7 +665,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -476,7 +679,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -486,6 +689,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -497,6 +701,10 @@ internal ManagedInstancesOperations(SqlManagementClient client) _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -771,7 +979,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -983,182 +1191,6 @@ internal ManagedInstancesOperations(SqlManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2020-02-02-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Creates or updates a managed instance. /// @@ -1215,7 +1247,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1432,7 +1464,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1616,7 +1648,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1819,7 +1851,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2130,7 +2162,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -2156,7 +2188,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2171,7 +2203,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2303,7 +2335,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Get top resource consuming queries of a managed instance. + /// Gets a list of managed instances in a resource group. /// /// /// The NextLink from the previous successful call to List operation. @@ -2329,7 +2361,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2344,7 +2376,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2443,7 +2475,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2456,7 +2488,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2476,7 +2508,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) } /// - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// /// /// The NextLink from the previous successful call to List operation. @@ -2502,7 +2534,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByManagedInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2517,7 +2549,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedInstanceNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2616,7 +2648,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2629,7 +2661,7 @@ internal ManagedInstancesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs index c4370ab74b845..76789c27981bf 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedInstancesOperationsExtensions.cs @@ -34,9 +34,12 @@ public static partial class ManagedInstancesOperationsExtensions /// /// The instance pool name. /// - public static IPage ListByInstancePool(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName) + /// + /// The child resources to include in the response. + /// + public static IPage ListByInstancePool(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, string expand = default(string)) { - return operations.ListByInstancePoolAsync(resourceGroupName, instancePoolName).GetAwaiter().GetResult(); + return operations.ListByInstancePoolAsync(resourceGroupName, instancePoolName, expand).GetAwaiter().GetResult(); } /// @@ -52,12 +55,49 @@ public static IPage ListByInstancePool(this IManagedInstancesOp /// /// The instance pool name. /// + /// + /// The child resources to include in the response. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInstancePoolAsync(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInstancePoolWithHttpMessagesAsync(resourceGroupName, instancePoolName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The child resources to include in the response. + /// + public static IPage List(this IManagedInstancesOperations operations, string expand = default(string)) + { + return operations.ListAsync(expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task> ListByInstancePoolAsync(this IManagedInstancesOperations operations, string resourceGroupName, string instancePoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IManagedInstancesOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInstancePoolWithHttpMessagesAsync(resourceGroupName, instancePoolName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -73,9 +113,12 @@ public static IPage ListByInstancePool(this IManagedInstancesOp /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// - public static IPage ListByResourceGroup(this IManagedInstancesOperations operations, string resourceGroupName) + /// + /// The child resources to include in the response. + /// + public static IPage ListByResourceGroup(this IManagedInstancesOperations operations, string resourceGroupName, string expand = default(string)) { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + return operations.ListByResourceGroupAsync(resourceGroupName, expand).GetAwaiter().GetResult(); } /// @@ -88,12 +131,15 @@ public static IPage ListByResourceGroup(this IManagedInstancesO /// The 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. /// - public static async Task> ListByResourceGroupAsync(this IManagedInstancesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IManagedInstancesOperations operations, string resourceGroupName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -112,9 +158,12 @@ public static IPage ListByResourceGroup(this IManagedInstancesO /// /// The name of the managed instance. /// - public static ManagedInstance Get(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName) + /// + /// The child resources to include in the response. + /// + public static ManagedInstance Get(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName, expand).GetAwaiter().GetResult(); } /// @@ -130,12 +179,15 @@ public static ManagedInstance Get(this IManagedInstancesOperations operations, s /// /// The name of the managed instance. /// + /// + /// The child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IManagedInstancesOperations operations, string resourceGroupName, string managedInstanceName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -415,34 +467,6 @@ public static ManagedInstance Update(this IManagedInstancesOperations operations (await operations.FailoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, replicaType, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IManagedInstancesOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IManagedInstancesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Creates or updates a managed instance. /// @@ -660,7 +684,7 @@ public static IPage ListByInstancePoolNext(this IManagedInstanc } /// - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// /// /// The operations group for this extension method. @@ -668,13 +692,13 @@ public static IPage ListByInstancePoolNext(this IManagedInstanc /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByResourceGroupNext(this IManagedInstancesOperations operations, string nextPageLink) + public static IPage ListNext(this IManagedInstancesOperations operations, string nextPageLink) { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets a list of managed instances in a resource group. + /// Gets a list of all managed instances in the subscription. /// /// /// The operations group for this extension method. @@ -685,16 +709,16 @@ public static IPage ListByResourceGroupNext(this IManagedInstan /// /// The cancellation token. /// - public static async Task> ListByResourceGroupNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get top resource consuming queries of a managed instance. + /// Gets a list of managed instances in a resource group. /// /// /// The operations group for this extension method. @@ -702,13 +726,13 @@ public static IPage ListByResourceGroupNext(this IManagedInstan /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByManagedInstanceNext(this IManagedInstancesOperations operations, string nextPageLink) + public static IPage ListByResourceGroupNext(this IManagedInstancesOperations operations, string nextPageLink) { - return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Get top resource consuming queries of a managed instance. + /// Gets a list of managed instances in a resource group. /// /// /// The operations group for this extension method. @@ -719,16 +743,16 @@ public static IPage ListByManagedInstanceNext(this IManagedInstances /// /// The cancellation token. /// - public static async Task> ListByManagedInstanceNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// /// /// The operations group for this extension method. @@ -736,13 +760,13 @@ public static IPage ListByManagedInstanceNext(this IManagedInstances /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IManagedInstancesOperations operations, string nextPageLink) + public static IPage ListByManagedInstanceNext(this IManagedInstancesOperations operations, string nextPageLink) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByManagedInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets a list of all managed instances in the subscription. + /// Get top resource consuming queries of a managed instance. /// /// /// The operations group for this extension method. @@ -753,9 +777,9 @@ public static IPage ListNext(this IManagedInstancesOperations o /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByManagedInstanceNextAsync(this IManagedInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByManagedInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs index 08ce3af3a3b7b..5cd85ae32b0a2 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations.cs @@ -102,7 +102,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -257,7 +257,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati } /// - /// 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 @@ -269,7 +269,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -285,7 +285,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati } /// - /// 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 @@ -297,7 +297,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The headers that will be added to request. @@ -363,7 +363,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -516,7 +516,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati } /// - /// 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 @@ -528,7 +528,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// Headers that will be added to request. @@ -574,7 +574,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -736,7 +736,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati } /// - /// 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 @@ -748,7 +748,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// Headers that will be added to request. @@ -794,7 +794,7 @@ internal ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperati throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs index 0f5a61659b21c..ea1bc714908da 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperationsExtensions.cs @@ -68,7 +68,7 @@ public static ManagedBackupShortTermRetentionPolicy Get(this IManagedRestorableD } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -83,7 +83,7 @@ public static ManagedBackupShortTermRetentionPolicy Get(this IManagedRestorableD /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters) { @@ -91,7 +91,7 @@ public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManaged } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -106,7 +106,7 @@ public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManaged /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The cancellation token. @@ -120,7 +120,7 @@ public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManaged } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -135,7 +135,7 @@ public static ManagedBackupShortTermRetentionPolicy CreateOrUpdate(this IManaged /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// public static ManagedBackupShortTermRetentionPolicy Update(this IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters) { @@ -143,7 +143,7 @@ public static ManagedBackupShortTermRetentionPolicy Update(this IManagedRestorab } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -158,7 +158,7 @@ public static ManagedBackupShortTermRetentionPolicy Update(this IManagedRestorab /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The cancellation token. @@ -218,7 +218,7 @@ public static IPage ListByRestorableDropp } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -233,7 +233,7 @@ public static IPage ListByRestorableDropp /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters) { @@ -241,7 +241,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IMa } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -256,7 +256,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IMa /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The cancellation token. @@ -270,7 +270,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IMa } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -285,7 +285,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginCreateOrUpdate(this IMa /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// public static ManagedBackupShortTermRetentionPolicy BeginUpdate(this IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations operations, string resourceGroupName, string managedInstanceName, string restorableDroppedDatabaseId, ManagedBackupShortTermRetentionPolicy parameters) { @@ -293,7 +293,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginUpdate(this IManagedRes } /// - /// Sets a database's long term retention policy. + /// Sets a database's short term retention policy. /// /// /// The operations group for this extension method. @@ -308,7 +308,7 @@ public static ManagedBackupShortTermRetentionPolicy BeginUpdate(this IManagedRes /// /// /// - /// The long term retention policy info. + /// The short term retention policy info. /// /// /// The cancellation token. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs index 5b323e6642f77..c70f55efcb2a0 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ManagedServerSecurityAlertPoliciesOperations.cs @@ -96,7 +96,7 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string securityAlertPolicyName = "Default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -319,7 +319,7 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -526,7 +526,7 @@ internal ManagedServerSecurityAlertPoliciesOperations(SqlManagementClient client throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string securityAlertPolicyName = "Default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdministratorType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdministratorType.cs new file mode 100644 index 0000000000000..46fed52dc35ba --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdministratorType.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + + /// + /// Defines values for AdministratorType. + /// + public static class AdministratorType + { + public const string ActiveDirectory = "ActiveDirectory"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Advisor.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Advisor.cs new file mode 100644 index 0000000000000..abb2fb75ae51c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Advisor.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Database, Server or Elastic Pool Advisor. + /// + [Rest.Serialization.JsonTransformation] + public partial class Advisor : ProxyResource + { + /// + /// Initializes a new instance of the Advisor class. + /// + public Advisor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Advisor class. + /// + /// Gets the auto-execute status + /// (whether to let the system execute the recommendations) of this + /// advisor. Possible values are 'Enabled' and 'Disabled'. Possible + /// values include: 'Enabled', 'Disabled', 'Default' + /// 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'. Possible values + /// include: 'GA', 'PublicPreview', 'LimitedPublicPreview', + /// 'PrivatePreview' + /// 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). Possible values + /// include: 'Default', 'Subscription', 'Server', 'ElasticPool', + /// 'Database' + /// 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. + public Advisor(AutoExecuteStatus autoExecuteStatus, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), AdvisorStatus? advisorStatus = default(AdvisorStatus?), AutoExecuteStatusInheritedFrom? autoExecuteStatusInheritedFrom = default(AutoExecuteStatusInheritedFrom?), string recommendationsStatus = default(string), System.DateTime? lastChecked = default(System.DateTime?), IList recommendedActions = default(IList)) + : base(id, name, type) + { + Kind = kind; + Location = location; + AdvisorStatus = advisorStatus; + AutoExecuteStatus = autoExecuteStatus; + AutoExecuteStatusInheritedFrom = autoExecuteStatusInheritedFrom; + RecommendationsStatus = recommendationsStatus; + LastChecked = lastChecked; + RecommendedActions = recommendedActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource kind. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets the status of availability of this advisor to customers. + /// Possible values are 'GA', 'PublicPreview', 'LimitedPublicPreview' + /// and 'PrivatePreview'. Possible values include: 'GA', + /// 'PublicPreview', 'LimitedPublicPreview', 'PrivatePreview' + /// + [JsonProperty(PropertyName = "properties.advisorStatus")] + public AdvisorStatus? AdvisorStatus { get; private set; } + + /// + /// Gets the auto-execute status (whether to let the system execute the + /// recommendations) of this advisor. Possible values are 'Enabled' and + /// 'Disabled'. Possible values include: 'Enabled', 'Disabled', + /// 'Default' + /// + [JsonProperty(PropertyName = "properties.autoExecuteStatus")] + 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). + /// Possible values include: 'Default', 'Subscription', 'Server', + /// 'ElasticPool', 'Database' + /// + [JsonProperty(PropertyName = "properties.autoExecuteStatusInheritedFrom")] + public AutoExecuteStatusInheritedFrom? AutoExecuteStatusInheritedFrom { get; private set; } + + /// + /// Gets that status of recommendations for this advisor and reason for + /// not having any recommendations. Possible values include, but are + /// not limited to, 'Ok' (Recommendations available),LowActivity (not + /// enough workload to analyze), 'DbSeemsTuned' (Database is doing + /// well), etc. + /// + [JsonProperty(PropertyName = "properties.recommendationsStatus")] + public string RecommendationsStatus { get; private set; } + + /// + /// Gets the time when the current resource was analyzed for + /// recommendations by this advisor. + /// + [JsonProperty(PropertyName = "properties.lastChecked")] + public System.DateTime? LastChecked { get; private set; } + + /// + /// Gets the recommended actions for this advisor. + /// + [JsonProperty(PropertyName = "properties.recommendedActions")] + public IList RecommendedActions { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RecommendedActions != null) + { + foreach (var element in RecommendedActions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdvisorStatus.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdvisorStatus.cs new file mode 100644 index 0000000000000..82abfaab68a91 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AdvisorStatus.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AdvisorStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AdvisorStatus + { + [EnumMember(Value = "GA")] + GA, + [EnumMember(Value = "PublicPreview")] + PublicPreview, + [EnumMember(Value = "LimitedPublicPreview")] + LimitedPublicPreview, + [EnumMember(Value = "PrivatePreview")] + PrivatePreview + } + internal static class AdvisorStatusEnumExtension + { + internal static string ToSerializedValue(this AdvisorStatus? value) + { + return value == null ? null : ((AdvisorStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AdvisorStatus value) + { + switch( value ) + { + case AdvisorStatus.GA: + return "GA"; + case AdvisorStatus.PublicPreview: + return "PublicPreview"; + case AdvisorStatus.LimitedPublicPreview: + return "LimitedPublicPreview"; + case AdvisorStatus.PrivatePreview: + return "PrivatePreview"; + } + return null; + } + + internal static AdvisorStatus? ParseAdvisorStatus(this string value) + { + switch( value ) + { + case "GA": + return AdvisorStatus.GA; + case "PublicPreview": + return AdvisorStatus.PublicPreview; + case "LimitedPublicPreview": + return AdvisorStatus.LimitedPublicPreview; + case "PrivatePreview": + return AdvisorStatus.PrivatePreview; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatus.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatus.cs new file mode 100644 index 0000000000000..ab1597ba6dbe8 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatus.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AutoExecuteStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AutoExecuteStatus + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled, + [EnumMember(Value = "Default")] + Default + } + internal static class AutoExecuteStatusEnumExtension + { + internal static string ToSerializedValue(this AutoExecuteStatus? value) + { + return value == null ? null : ((AutoExecuteStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AutoExecuteStatus value) + { + switch( value ) + { + case AutoExecuteStatus.Enabled: + return "Enabled"; + case AutoExecuteStatus.Disabled: + return "Disabled"; + case AutoExecuteStatus.Default: + return "Default"; + } + return null; + } + + internal static AutoExecuteStatus? ParseAutoExecuteStatus(this string value) + { + switch( value ) + { + case "Enabled": + return AutoExecuteStatus.Enabled; + case "Disabled": + return AutoExecuteStatus.Disabled; + case "Default": + return AutoExecuteStatus.Default; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs new file mode 100644 index 0000000000000..30ee7be35b628 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/AutoExecuteStatusInheritedFrom.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AutoExecuteStatusInheritedFrom. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AutoExecuteStatusInheritedFrom + { + [EnumMember(Value = "Default")] + Default, + [EnumMember(Value = "Subscription")] + Subscription, + [EnumMember(Value = "Server")] + Server, + [EnumMember(Value = "ElasticPool")] + ElasticPool, + [EnumMember(Value = "Database")] + Database + } + internal static class AutoExecuteStatusInheritedFromEnumExtension + { + internal static string ToSerializedValue(this AutoExecuteStatusInheritedFrom? value) + { + return value == null ? null : ((AutoExecuteStatusInheritedFrom)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AutoExecuteStatusInheritedFrom value) + { + switch( value ) + { + case AutoExecuteStatusInheritedFrom.Default: + return "Default"; + case AutoExecuteStatusInheritedFrom.Subscription: + return "Subscription"; + case AutoExecuteStatusInheritedFrom.Server: + return "Server"; + case AutoExecuteStatusInheritedFrom.ElasticPool: + return "ElasticPool"; + case AutoExecuteStatusInheritedFrom.Database: + return "Database"; + } + return null; + } + + internal static AutoExecuteStatusInheritedFrom? ParseAutoExecuteStatusInheritedFrom(this string value) + { + switch( value ) + { + case "Default": + return AutoExecuteStatusInheritedFrom.Default; + case "Subscription": + return AutoExecuteStatusInheritedFrom.Subscription; + case "Server": + return AutoExecuteStatusInheritedFrom.Server; + case "ElasticPool": + return AutoExecuteStatusInheritedFrom.ElasticPool; + case "Database": + return AutoExecuteStatusInheritedFrom.Database; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ColumnDataType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ColumnDataType.cs new file mode 100644 index 0000000000000..b454b0c50604e --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ColumnDataType.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + + /// + /// Defines values for ColumnDataType. + /// + public static class ColumnDataType + { + public const string Image = "image"; + public const string Text = "text"; + public const string Uniqueidentifier = "uniqueidentifier"; + public const string Date = "date"; + public const string Time = "time"; + public const string Datetime2 = "datetime2"; + public const string Datetimeoffset = "datetimeoffset"; + public const string Tinyint = "tinyint"; + public const string Smallint = "smallint"; + public const string Int = "int"; + public const string Smalldatetime = "smalldatetime"; + public const string Real = "real"; + public const string Money = "money"; + public const string Datetime = "datetime"; + public const string Float = "float"; + public const string SqlVariant = "sql_variant"; + public const string Ntext = "ntext"; + public const string Bit = "bit"; + public const string Decimal = "decimal"; + public const string Numeric = "numeric"; + public const string Smallmoney = "smallmoney"; + public const string Bigint = "bigint"; + public const string Hierarchyid = "hierarchyid"; + public const string Geometry = "geometry"; + public const string Geography = "geography"; + public const string Varbinary = "varbinary"; + public const string Varchar = "varchar"; + public const string Binary = "binary"; + public const string Char = "char"; + public const string Timestamp = "timestamp"; + public const string Nvarchar = "nvarchar"; + public const string Nchar = "nchar"; + public const string Xml = "xml"; + public const string Sysname = "sysname"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataWarehouseUserActivities.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataWarehouseUserActivities.cs new file mode 100644 index 0000000000000..55589b7c55bf8 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DataWarehouseUserActivities.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// User activities of a data warehouse + /// + [Rest.Serialization.JsonTransformation] + public partial class DataWarehouseUserActivities : ProxyResource + { + /// + /// Initializes a new instance of the DataWarehouseUserActivities + /// class. + /// + public DataWarehouseUserActivities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataWarehouseUserActivities + /// class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Count of running and suspended + /// queries. + public DataWarehouseUserActivities(string id = default(string), string name = default(string), string type = default(string), int? activeQueriesCount = default(int?)) + : base(id, name, type) + { + ActiveQueriesCount = activeQueriesCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets count of running and suspended queries. + /// + [JsonProperty(PropertyName = "properties.activeQueriesCount")] + public int? ActiveQueriesCount { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs index 639db988b9721..c49e7503cda17 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseBlobAuditingPolicy.cs @@ -34,31 +34,13 @@ public DatabaseBlobAuditingPolicy() /// /// Initializes a new instance of the DatabaseBlobAuditingPolicy class. /// - /// Specifies the state of the policy. If state is + /// Specifies the state of the audit. If state is /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are /// required. Possible values include: 'Enabled', 'Disabled' /// Resource ID. /// Resource name. /// Resource type. /// Resource kind. - /// 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 @@ -135,15 +117,13 @@ 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. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -165,19 +145,39 @@ public DatabaseBlobAuditingPolicy() /// processed. /// The default minimum value is 1000 (1 second). The maximum is /// 2,147,483,647. - public DatabaseBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?)) + /// 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. + public DatabaseBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), System.Guid? storageAccountSubscriptionId = default(System.Guid?)) : base(id, name, type) { Kind = kind; - 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; CustomInit(); } @@ -192,41 +192,6 @@ public DatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "kind")] public string Kind { get; private set; } - /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are - /// required. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public BlobAuditingPolicyState State { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). If state is Enabled, - /// storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets specifies the identifier key of the auditing storage - /// account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } - /// /// Gets or sets specifies the number of days to keep in the audit logs /// in the storage account. @@ -313,12 +278,6 @@ public DatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] public IList AuditActionsAndGroups { get; set; } - /// - /// Gets or sets specifies the blob storage subscription Id. - /// - [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] - public System.Guid? StorageAccountSubscriptionId { get; set; } - /// /// Gets or sets specifies whether storageAccountAccessKey value is the /// storage's secondary key. @@ -329,8 +288,8 @@ public DatabaseBlobAuditingPolicy() /// /// Gets or sets 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. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -360,6 +319,47 @@ public DatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.queueDelayMs")] public int? QueueDelayMs { get; set; } + /// + /// Gets or sets specifies the state of the audit. If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseColumn.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseColumn.cs new file mode 100644 index 0000000000000..9eadc11e6b273 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseColumn.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A database column resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DatabaseColumn : ProxyResource + { + /// + /// Initializes a new instance of the DatabaseColumn class. + /// + public DatabaseColumn() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseColumn class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The column data type. Possible values + /// include: 'image', 'text', 'uniqueidentifier', 'date', 'time', + /// 'datetime2', 'datetimeoffset', 'tinyint', 'smallint', 'int', + /// 'smalldatetime', 'real', 'money', 'datetime', 'float', + /// 'sql_variant', 'ntext', 'bit', 'decimal', 'numeric', 'smallmoney', + /// 'bigint', 'hierarchyid', 'geometry', 'geography', 'varbinary', + /// 'varchar', 'binary', 'char', 'timestamp', 'nvarchar', 'nchar', + /// 'xml', 'sysname' + /// The table temporal type. Possible values + /// include: 'NonTemporalTable', 'HistoryTable', + /// 'SystemVersionedTemporalTable' + /// Whether or not the column belongs to + /// a memory optimized table. + /// Whether or not the column is + /// computed. + public DatabaseColumn(string id = default(string), string name = default(string), string type = default(string), string columnType = default(string), string temporalType = default(string), bool? memoryOptimized = default(bool?), bool? isComputed = default(bool?)) + : base(id, name, type) + { + ColumnType = columnType; + TemporalType = temporalType; + MemoryOptimized = memoryOptimized; + IsComputed = isComputed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the column data type. Possible values include: + /// 'image', 'text', 'uniqueidentifier', 'date', 'time', 'datetime2', + /// 'datetimeoffset', 'tinyint', 'smallint', 'int', 'smalldatetime', + /// 'real', 'money', 'datetime', 'float', 'sql_variant', 'ntext', + /// 'bit', 'decimal', 'numeric', 'smallmoney', 'bigint', 'hierarchyid', + /// 'geometry', 'geography', 'varbinary', 'varchar', 'binary', 'char', + /// 'timestamp', 'nvarchar', 'nchar', 'xml', 'sysname' + /// + [JsonProperty(PropertyName = "properties.columnType")] + public string ColumnType { get; set; } + + /// + /// Gets or sets the table temporal type. Possible values include: + /// 'NonTemporalTable', 'HistoryTable', 'SystemVersionedTemporalTable' + /// + [JsonProperty(PropertyName = "properties.temporalType")] + public string TemporalType { get; set; } + + /// + /// Gets or sets whether or not the column belongs to a memory + /// optimized table. + /// + [JsonProperty(PropertyName = "properties.memoryOptimized")] + public bool? MemoryOptimized { get; set; } + + /// + /// Gets or sets whether or not the column is computed. + /// + [JsonProperty(PropertyName = "properties.isComputed")] + public bool? IsComputed { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseExtensions.cs new file mode 100644 index 0000000000000..8d24b91ea7d0d --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseExtensions.cs @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An export managed database operation result resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DatabaseExtensions : ProxyResource + { + /// + /// Initializes a new instance of the DatabaseExtensions class. + /// + public DatabaseExtensions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseExtensions class. + /// + /// Storage key type. Possible values + /// include: 'SharedAccessKey', 'StorageAccessKey' + /// Storage key. + /// Storage Uri. + /// Resource ID. + /// Resource name. + /// Resource type. + public DatabaseExtensions(string storageKeyType, string storageKey, string storageUri, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + StorageKeyType = storageKeyType; + StorageKey = storageKey; + StorageUri = storageUri; + CustomInit(); + } + /// + /// Static constructor for DatabaseExtensions class. + /// + static DatabaseExtensions() + { + OperationMode = "PolybaseImport"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage key type. Possible values include: + /// 'SharedAccessKey', 'StorageAccessKey' + /// + [JsonProperty(PropertyName = "properties.storageKeyType")] + public string StorageKeyType { get; set; } + + /// + /// Gets or sets storage key. + /// + [JsonProperty(PropertyName = "properties.storageKey")] + public string StorageKey { get; set; } + + /// + /// Gets or sets storage Uri. + /// + [JsonProperty(PropertyName = "properties.storageUri")] + public string StorageUri { get; set; } + + /// + /// Operation Mode. + /// + [JsonProperty(PropertyName = "properties.operationMode")] + public static string OperationMode { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageKeyType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageKeyType"); + } + if (StorageKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageKey"); + } + if (StorageUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageUri"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSchema.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSchema.cs new file mode 100644 index 0000000000000..de8057297b030 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSchema.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using System.Linq; + + /// + /// A database schema resource. + /// + public partial class DatabaseSchema : ProxyResource + { + /// + /// Initializes a new instance of the DatabaseSchema class. + /// + public DatabaseSchema() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseSchema class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + public DatabaseSchema(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs index c95ba9e6d8b92..078d50f200c67 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseSecurityAlertPolicy.cs @@ -13,10 +13,12 @@ namespace Microsoft.Azure.Management.Sql.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Contains information about a database Threat Detection policy. + /// A database security alert policy. /// [Rest.Serialization.JsonTransformation] public partial class DatabaseSecurityAlertPolicy : ProxyResource @@ -34,41 +36,36 @@ public DatabaseSecurityAlertPolicy() /// Initializes a new instance of the DatabaseSecurityAlertPolicy /// class. /// - /// Specifies the state of the policy. If state is - /// Enabled, storageEndpoint and storageAccountAccessKey are required. - /// Possible values include: 'New', 'Enabled', 'Disabled' + /// Specifies the state of the policy, whether it + /// is enabled or disabled or a policy has not been applied yet on the + /// specific database. Possible values include: 'Enabled', + /// 'Disabled' /// Resource ID. /// Resource name. /// Resource type. - /// The geo-location where the resource - /// lives - /// Resource kind. - /// 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 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. Possible values include: 'Enabled', - /// 'Disabled' + /// 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. + /// will hold all Threat Detection audit logs. /// Specifies the identifier key - /// of the Threat Detection audit storage account. If state is Enabled, - /// storageAccountAccessKey is required. + /// 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. Possible values include: 'Enabled', - /// 'Disabled' - public DatabaseSecurityAlertPolicy(SecurityAlertPolicyState state, string id = default(string), string name = default(string), string type = default(string), string location = default(string), string kind = default(string), string disabledAlerts = default(string), string emailAddresses = default(string), SecurityAlertPolicyEmailAccountAdmins? emailAccountAdmins = default(SecurityAlertPolicyEmailAccountAdmins?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), SecurityAlertPolicyUseServerDefault? useServerDefault = default(SecurityAlertPolicyUseServerDefault?)) + /// Specifies the UTC creation time of the + /// policy. + public DatabaseSecurityAlertPolicy(SecurityAlertsPolicyState state, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) : base(id, name, type) { - Location = location; - Kind = kind; + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -76,7 +73,7 @@ public DatabaseSecurityAlertPolicy() StorageEndpoint = storageEndpoint; StorageAccountAccessKey = storageAccountAccessKey; RetentionDays = retentionDays; - UseServerDefault = useServerDefault; + CreationTime = creationTime; CustomInit(); } @@ -86,61 +83,52 @@ public DatabaseSecurityAlertPolicy() partial void CustomInit(); /// - /// Gets or sets the geo-location where the resource lives - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets resource kind. + /// Gets systemData of SecurityAlertPolicyResource. /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint and storageAccountAccessKey are required. - /// Possible values include: 'New', 'Enabled', 'Disabled' + /// Gets or sets specifies the state of the policy, whether it is + /// enabled or disabled or a policy has not been applied yet on the + /// specific database. Possible values include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "properties.state")] - public SecurityAlertPolicyState State { get; set; } + public SecurityAlertsPolicyState State { get; set; } /// - /// Gets or sets 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. + /// Gets or sets specifies an array of alerts that are disabled. + /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force /// [JsonProperty(PropertyName = "properties.disabledAlerts")] - public string DisabledAlerts { get; set; } + public IList DisabledAlerts { get; set; } /// - /// Gets or sets specifies the semicolon-separated list of e-mail - /// addresses to which the alert is sent. + /// Gets or sets specifies an array of e-mail addresses to which the + /// alert is sent. /// [JsonProperty(PropertyName = "properties.emailAddresses")] - public string EmailAddresses { get; set; } + public IList EmailAddresses { get; set; } /// /// Gets or sets specifies that the alert is sent to the account - /// administrators. Possible values include: 'Enabled', 'Disabled' + /// administrators. /// [JsonProperty(PropertyName = "properties.emailAccountAdmins")] - public SecurityAlertPolicyEmailAccountAdmins? EmailAccountAdmins { get; set; } + public bool? EmailAccountAdmins { get; set; } /// /// Gets or sets 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. + /// hold all Threat Detection audit logs. /// [JsonProperty(PropertyName = "properties.storageEndpoint")] public string StorageEndpoint { get; set; } /// /// Gets or sets specifies the identifier key of the Threat Detection - /// audit storage account. If state is Enabled, storageAccountAccessKey - /// is required. + /// audit storage account. /// [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] public string StorageAccountAccessKey { get; set; } @@ -153,11 +141,10 @@ public DatabaseSecurityAlertPolicy() public int? RetentionDays { get; set; } /// - /// Gets or sets specifies whether to use the default server policy. - /// Possible values include: 'Enabled', 'Disabled' + /// Gets specifies the UTC creation time of the policy. /// - [JsonProperty(PropertyName = "properties.useServerDefault")] - public SecurityAlertPolicyUseServerDefault? UseServerDefault { get; set; } + [JsonProperty(PropertyName = "properties.creationTime")] + public System.DateTime? CreationTime { get; private set; } /// /// Validate the object. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseTable.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseTable.cs new file mode 100644 index 0000000000000..c8476f2a8a48e --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseTable.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A database table resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class DatabaseTable : ProxyResource + { + /// + /// Initializes a new instance of the DatabaseTable class. + /// + public DatabaseTable() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseTable class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The table temporal type. Possible values + /// include: 'NonTemporalTable', 'HistoryTable', + /// 'SystemVersionedTemporalTable' + /// Whether or not the table is memory + /// optimized. + public DatabaseTable(string id = default(string), string name = default(string), string type = default(string), string temporalType = default(string), bool? memoryOptimized = default(bool?)) + : base(id, name, type) + { + TemporalType = temporalType; + MemoryOptimized = memoryOptimized; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the table temporal type. Possible values include: + /// 'NonTemporalTable', 'HistoryTable', 'SystemVersionedTemporalTable' + /// + [JsonProperty(PropertyName = "properties.temporalType")] + public string TemporalType { get; set; } + + /// + /// Gets or sets whether or not the table is memory optimized. + /// + [JsonProperty(PropertyName = "properties.memoryOptimized")] + public bool? MemoryOptimized { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUsage.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUsage.cs index 763dcd923f4c3..bd2aa3fd67d2b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUsage.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseUsage.cs @@ -10,13 +10,16 @@ namespace Microsoft.Azure.Management.Sql.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; /// - /// The database usages. + /// Usage metric of a database. /// - public partial class DatabaseUsage + [Rest.Serialization.JsonTransformation] + public partial class DatabaseUsage : ProxyResource { /// /// Initializes a new instance of the DatabaseUsage class. @@ -29,24 +32,20 @@ public DatabaseUsage() /// /// Initializes a new instance of the DatabaseUsage class. /// - /// 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). - public DatabaseUsage(string name = default(string), string resourceName = default(string), string displayName = default(string), double? currentValue = default(double?), double? limit = default(double?), string unit = default(string), System.DateTime? nextResetTime = default(System.DateTime?)) + /// 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. + public DatabaseUsage(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), double? currentValue = default(double?), double? limit = default(double?), string unit = default(string)) + : base(id, name, type) { - Name = name; - ResourceName = resourceName; DisplayName = displayName; CurrentValue = currentValue; Limit = limit; Unit = unit; - NextResetTime = nextResetTime; CustomInit(); } @@ -56,46 +55,28 @@ public DatabaseUsage() partial void CustomInit(); /// - /// Gets the name of the usage metric. + /// Gets user-readable name of the metric. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the name of the resource. - /// - [JsonProperty(PropertyName = "resourceName")] - public string ResourceName { get; private set; } - - /// - /// Gets the usage metric display name. - /// - [JsonProperty(PropertyName = "displayName")] + [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; private set; } /// - /// Gets the current value of the usage metric. + /// Gets current value of the metric. /// - [JsonProperty(PropertyName = "currentValue")] + [JsonProperty(PropertyName = "properties.currentValue")] public double? CurrentValue { get; private set; } /// - /// Gets the current limit of the usage metric. + /// Gets boundary value of the metric. /// - [JsonProperty(PropertyName = "limit")] + [JsonProperty(PropertyName = "properties.limit")] public double? Limit { get; private set; } /// - /// Gets the units of the usage metric. + /// Gets unit of the metric. /// - [JsonProperty(PropertyName = "unit")] + [JsonProperty(PropertyName = "properties.unit")] public string Unit { get; private set; } - /// - /// Gets the next reset time for the usage metric (ISO8601 format). - /// - [JsonProperty(PropertyName = "nextResetTime")] - public System.DateTime? NextResetTime { get; private set; } - } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs index 4ad6c58749bf3..0fcc792208672 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DatabaseVulnerabilityAssessment.cs @@ -42,8 +42,8 @@ public DatabaseVulnerabilityAssessment() /// 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' + /// 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. @@ -75,10 +75,10 @@ public DatabaseVulnerabilityAssessment() public string StorageContainerPath { get; set; } /// - /// Gets or sets 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. + /// Gets or sets a shared access signature (SAS Key) that has write + /// access to the blob container specified in 'storageContainerPath' + /// parameter. If 'storageAccountAccessKey' isn't specified, + /// StorageContainerSasKey is required. /// [JsonProperty(PropertyName = "properties.storageContainerSasKey")] public string StorageContainerSasKey { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DayOfWeek.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DayOfWeek.cs new file mode 100644 index 0000000000000..3cfda63022f93 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DayOfWeek.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + + /// + /// Defines values for DayOfWeek. + /// + public static class DayOfWeek + { + public const string Sunday = "Sunday"; + public const string Monday = "Monday"; + public const string Tuesday = "Tuesday"; + public const string Wednesday = "Wednesday"; + public const string Thursday = "Thursday"; + public const string Friday = "Friday"; + public const string Saturday = "Saturday"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DeletedServer.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DeletedServer.cs new file mode 100644 index 0000000000000..0f11773e67212 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/DeletedServer.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A deleted server. + /// + [Rest.Serialization.JsonTransformation] + public partial class DeletedServer : ProxyResource + { + /// + /// Initializes a new instance of the DeletedServer class. + /// + public DeletedServer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeletedServer class. + /// + /// 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. + public DeletedServer(string id = default(string), string name = default(string), string type = default(string), string version = default(string), System.DateTime? deletionTime = default(System.DateTime?), string originalId = default(string), string fullyQualifiedDomainName = default(string)) + : base(id, name, type) + { + Version = version; + DeletionTime = deletionTime; + OriginalId = originalId; + FullyQualifiedDomainName = fullyQualifiedDomainName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the version of the deleted server. + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; private set; } + + /// + /// Gets the deletion time of the deleted server. + /// + [JsonProperty(PropertyName = "properties.deletionTime")] + public System.DateTime? DeletionTime { get; private set; } + + /// + /// Gets the original ID of the server before deletion. + /// + [JsonProperty(PropertyName = "properties.originalId")] + public string OriginalId { get; private set; } + + /// + /// Gets the fully qualified domain name of the server. + /// + [JsonProperty(PropertyName = "properties.fullyQualifiedDomainName")] + public string FullyQualifiedDomainName { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EncryptionProtector.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EncryptionProtector.cs index ea9fe3a5d1a58..60bf35bb1bc9c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EncryptionProtector.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/EncryptionProtector.cs @@ -46,7 +46,9 @@ public EncryptionProtector() /// The name of the server key. /// The URI of the server key. /// Thumbprint of the server key. - public EncryptionProtector(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string subregion = default(string), string serverKeyName = default(string), string uri = default(string), string thumbprint = default(string)) + /// Key auto rotation opt-in flag. + /// Either true or false. + public EncryptionProtector(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string subregion = default(string), string serverKeyName = default(string), string uri = default(string), string thumbprint = default(string), bool? autoRotationEnabled = default(bool?)) : base(id, name, type) { Kind = kind; @@ -56,6 +58,7 @@ public EncryptionProtector() ServerKeyType = serverKeyType; Uri = uri; Thumbprint = thumbprint; + AutoRotationEnabled = autoRotationEnabled; CustomInit(); } @@ -109,6 +112,12 @@ public EncryptionProtector() [JsonProperty(PropertyName = "properties.thumbprint")] public string Thumbprint { get; private set; } + /// + /// Gets or sets key auto rotation opt-in flag. Either true or false. + /// + [JsonProperty(PropertyName = "properties.autoRotationEnabled")] + public bool? AutoRotationEnabled { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs index fb45c749c8e3a..dd8150e3ac2dc 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedDatabaseBlobAuditingPolicy.cs @@ -36,7 +36,7 @@ public ExtendedDatabaseBlobAuditingPolicy() /// Initializes a new instance of the /// ExtendedDatabaseBlobAuditingPolicy class. /// - /// Specifies the state of the policy. If state is + /// Specifies the state of the audit. If state is /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are /// required. Possible values include: 'Enabled', 'Disabled' /// Resource ID. @@ -44,24 +44,6 @@ public ExtendedDatabaseBlobAuditingPolicy() /// Resource type. /// Specifies condition of where /// clause when creating an audit. - /// 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 @@ -138,15 +120,13 @@ 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. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -168,19 +148,39 @@ public ExtendedDatabaseBlobAuditingPolicy() /// processed. /// The default minimum value is 1000 (1 second). The maximum is /// 2,147,483,647. - public ExtendedDatabaseBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string predicateExpression = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?)) + /// 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. + public ExtendedDatabaseBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string predicateExpression = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), System.Guid? storageAccountSubscriptionId = default(System.Guid?)) : base(id, name, type) { 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; CustomInit(); } @@ -196,41 +196,6 @@ public ExtendedDatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.predicateExpression")] public string PredicateExpression { get; set; } - /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are - /// required. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public BlobAuditingPolicyState State { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). If state is Enabled, - /// storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets specifies the identifier key of the auditing storage - /// account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } - /// /// Gets or sets specifies the number of days to keep in the audit logs /// in the storage account. @@ -317,12 +282,6 @@ public ExtendedDatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] public IList AuditActionsAndGroups { get; set; } - /// - /// Gets or sets specifies the blob storage subscription Id. - /// - [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] - public System.Guid? StorageAccountSubscriptionId { get; set; } - /// /// Gets or sets specifies whether storageAccountAccessKey value is the /// storage's secondary key. @@ -333,8 +292,8 @@ public ExtendedDatabaseBlobAuditingPolicy() /// /// Gets or sets 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. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -364,6 +323,47 @@ public ExtendedDatabaseBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.queueDelayMs")] public int? QueueDelayMs { get; set; } + /// + /// Gets or sets specifies the state of the audit. If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs index f7e2e879b2bf7..99347d8271978 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ExtendedServerBlobAuditingPolicy.cs @@ -36,32 +36,34 @@ public ExtendedServerBlobAuditingPolicy() /// Initializes a new instance of the ExtendedServerBlobAuditingPolicy /// class. /// - /// Specifies the state of the policy. If state is + /// Specifies the state of the audit. If state is /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are /// required. Possible values include: 'Enabled', 'Disabled' /// Resource ID. /// Resource name. /// Resource type. + /// Specifies the state of devops + /// audit. If state is Enabled, devops logs will be sent to Azure + /// Monitor. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + /// 'IsDevopsAuditEnabled' as true + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'DevOpsOperationsAudit' diagnostic logs category on the master + /// database should also be created. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// /// Specifies condition of where /// clause when creating an audit. - /// 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 @@ -138,15 +140,13 @@ 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. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -168,19 +168,40 @@ public ExtendedServerBlobAuditingPolicy() /// processed. /// The default minimum value is 1000 (1 second). The maximum is /// 2,147,483,647. - public ExtendedServerBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string predicateExpression = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?)) + /// 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. + public ExtendedServerBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), bool? isDevopsAuditEnabled = default(bool?), string predicateExpression = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), System.Guid? storageAccountSubscriptionId = default(System.Guid?)) : 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; CustomInit(); } @@ -189,6 +210,30 @@ public ExtendedServerBlobAuditingPolicy() /// partial void CustomInit(); + /// + /// Gets or sets specifies the state of devops audit. If state is + /// Enabled, devops logs will be sent to Azure Monitor. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + /// 'IsDevopsAuditEnabled' as true + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'DevOpsOperationsAudit' diagnostic logs category on the master + /// database should also be created. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// + /// + [JsonProperty(PropertyName = "properties.isDevopsAuditEnabled")] + public bool? IsDevopsAuditEnabled { get; set; } + /// /// Gets or sets specifies condition of where clause when creating an /// audit. @@ -196,41 +241,6 @@ public ExtendedServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.predicateExpression")] public string PredicateExpression { get; set; } - /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are - /// required. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public BlobAuditingPolicyState State { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). If state is Enabled, - /// storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets specifies the identifier key of the auditing storage - /// account. - /// If state is Enabled and storageEndpoint is specified, not - /// specifying the storageAccountAccessKey will use SQL server - /// system-assigned managed identity to access the storage. - /// Prerequisites for using managed identity authentication: - /// 1. Assign SQL Server a system-assigned managed identity in Azure - /// Active Directory (AAD). - /// 2. Grant SQL Server identity access to the storage account by - /// adding 'Storage Blob Data Contributor' RBAC role to the server - /// identity. - /// For more information, see [Auditing to storage using Managed - /// Identity - /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) - /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } - /// /// Gets or sets specifies the number of days to keep in the audit logs /// in the storage account. @@ -317,12 +327,6 @@ public ExtendedServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] public IList AuditActionsAndGroups { get; set; } - /// - /// Gets or sets specifies the blob storage subscription Id. - /// - [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] - public System.Guid? StorageAccountSubscriptionId { get; set; } - /// /// Gets or sets specifies whether storageAccountAccessKey value is the /// storage's secondary key. @@ -333,8 +337,8 @@ public ExtendedServerBlobAuditingPolicy() /// /// Gets or sets 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. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -364,6 +368,47 @@ public ExtendedServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.queueDelayMs")] public int? QueueDelayMs { get; set; } + /// + /// Gets or sets specifies the state of the audit. If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRule.cs index 904ce6567551f..bd0e7df06d7c7 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRule.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRule.cs @@ -16,10 +16,10 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Linq; /// - /// Represents a server firewall rule. + /// A server firewall rule. /// [Rest.Serialization.JsonTransformation] - public partial class FirewallRule : ProxyResource + public partial class FirewallRule : ProxyResourceWithWritableName { /// /// Initializes a new instance of the FirewallRule class. @@ -32,25 +32,19 @@ public FirewallRule() /// /// Initializes a new instance of the FirewallRule class. /// + /// Resource ID. + /// Resource name. + /// Resource type. /// The start IP address of the firewall - /// rule. Must be IPv4 format. Use value '0.0.0.0' to represent all + /// 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' to represent all Azure-internal - /// IP addresses. - /// Resource ID. - /// Resource name. - /// Resource type. - /// Kind of server that contains this firewall - /// rule. - /// Location of the server that contains this - /// firewall rule. - public FirewallRule(string startIpAddress, string endIpAddress, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string)) + /// startIpAddress. Use value '0.0.0.0' for all Azure-internal IP + /// addresses. + public FirewallRule(string id = default(string), string name = default(string), string type = default(string), string startIpAddress = default(string), string endIpAddress = default(string)) : base(id, name, type) { - Kind = kind; - Location = location; StartIpAddress = startIpAddress; EndIpAddress = endIpAddress; CustomInit(); @@ -61,21 +55,9 @@ public FirewallRule() /// partial void CustomInit(); - /// - /// Gets kind of server that contains this firewall rule. - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } - - /// - /// Gets location of the server that contains this firewall rule. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - /// /// Gets or sets the start IP address of the firewall rule. Must be - /// IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP + /// IPv4 format. Use value '0.0.0.0' for all Azure-internal IP /// addresses. /// [JsonProperty(PropertyName = "properties.startIpAddress")] @@ -84,27 +66,10 @@ public FirewallRule() /// /// Gets or sets 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. + /// '0.0.0.0' for all Azure-internal IP addresses. /// [JsonProperty(PropertyName = "properties.endIpAddress")] public string EndIpAddress { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (StartIpAddress == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "StartIpAddress"); - } - if (EndIpAddress == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EndIpAddress"); - } - } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRuleList.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRuleList.cs new file mode 100644 index 0000000000000..f67a2e3e98641 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/FirewallRuleList.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of server firewall rules. + /// + public partial class FirewallRuleList + { + /// + /// Initializes a new instance of the FirewallRuleList class. + /// + public FirewallRuleList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallRuleList class. + /// + public FirewallRuleList(IList values = default(IList)) + { + Values = values; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImplementationMethod.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImplementationMethod.cs new file mode 100644 index 0000000000000..ee68141e4d1ca --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImplementationMethod.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ImplementationMethod. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ImplementationMethod + { + [EnumMember(Value = "TSql")] + TSql, + [EnumMember(Value = "AzurePowerShell")] + AzurePowerShell + } + internal static class ImplementationMethodEnumExtension + { + internal static string ToSerializedValue(this ImplementationMethod? value) + { + return value == null ? null : ((ImplementationMethod)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ImplementationMethod value) + { + switch( value ) + { + case ImplementationMethod.TSql: + return "TSql"; + case ImplementationMethod.AzurePowerShell: + return "AzurePowerShell"; + } + return null; + } + + internal static ImplementationMethod? ParseImplementationMethod(this string value) + { + switch( value ) + { + case "TSql": + return ImplementationMethod.TSql; + case "AzurePowerShell": + return ImplementationMethod.AzurePowerShell; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs new file mode 100644 index 0000000000000..37c40e7b1a1fd --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ImportExportExtensionsOperationResult.cs @@ -0,0 +1,108 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Extension operation result resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ImportExportExtensionsOperationResult : ProxyResource + { + /// + /// Initializes a new instance of the + /// ImportExportExtensionsOperationResult class. + /// + public ImportExportExtensionsOperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ImportExportExtensionsOperationResult class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Request Id. + /// Request type. + /// Last modified time. + /// Server name. + /// Database name. + /// Operation status. + /// Error message. + public ImportExportExtensionsOperationResult(string id = default(string), string name = default(string), string type = default(string), System.Guid? requestId = default(System.Guid?), string requestType = default(string), string lastModifiedTime = default(string), string serverName = default(string), string databaseName = default(string), string status = default(string), string errorMessage = default(string)) + : base(id, name, type) + { + RequestId = requestId; + RequestType = requestType; + LastModifiedTime = lastModifiedTime; + ServerName = serverName; + DatabaseName = databaseName; + Status = status; + ErrorMessage = errorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets request Id. + /// + [JsonProperty(PropertyName = "properties.requestId")] + public System.Guid? RequestId { get; private set; } + + /// + /// Gets request type. + /// + [JsonProperty(PropertyName = "properties.requestType")] + public string RequestType { get; private set; } + + /// + /// Gets last modified time. + /// + [JsonProperty(PropertyName = "properties.lastModifiedTime")] + public string LastModifiedTime { get; private set; } + + /// + /// Gets server name. + /// + [JsonProperty(PropertyName = "properties.serverName")] + public string ServerName { get; private set; } + + /// + /// Gets database name. + /// + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; private set; } + + /// + /// Gets operation status. + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets error message. + /// + [JsonProperty(PropertyName = "properties.errorMessage")] + public string ErrorMessage { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IsRetryable.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IsRetryable.cs new file mode 100644 index 0000000000000..5b3b688edca58 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/IsRetryable.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for IsRetryable. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum IsRetryable + { + [EnumMember(Value = "Yes")] + Yes, + [EnumMember(Value = "No")] + No + } + internal static class IsRetryableEnumExtension + { + internal static string ToSerializedValue(this IsRetryable? value) + { + return value == null ? null : ((IsRetryable)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this IsRetryable value) + { + switch( value ) + { + case IsRetryable.Yes: + return "Yes"; + case IsRetryable.No: + return "No"; + } + return null; + } + + internal static IsRetryable? ParseIsRetryable(this string value) + { + switch( value ) + { + case "Yes": + return IsRetryable.Yes; + case "No": + return IsRetryable.No; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/JobSchedule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/JobSchedule.cs index 1783bf647bac7..53e42af561215 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/JobSchedule.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/JobSchedule.cs @@ -36,7 +36,7 @@ public JobSchedule() /// Whether or not the schedule is /// enabled. /// Value of the schedule's recurring interval, - /// if the schedule type is recurring. ISO8601 duration format. + /// if the ScheduleType is recurring. ISO8601 duration format. public JobSchedule(System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), JobScheduleType? type = default(JobScheduleType?), bool? enabled = default(bool?), string interval = default(string)) { StartTime = startTime; @@ -79,7 +79,7 @@ public JobSchedule() /// /// Gets or sets value of the schedule's recurring interval, if the - /// schedule type is recurring. ISO8601 duration format. + /// ScheduleType is recurring. ISO8601 duration format. /// [JsonProperty(PropertyName = "interval")] public string Interval { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowOptions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowOptions.cs new file mode 100644 index 0000000000000..273a7183ee738 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowOptions.cs @@ -0,0 +1,119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Maintenance window options. + /// + [Rest.Serialization.JsonTransformation] + public partial class MaintenanceWindowOptions : ProxyResource + { + /// + /// Initializes a new instance of the MaintenanceWindowOptions class. + /// + public MaintenanceWindowOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceWindowOptions class. + /// + /// 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. + public MaintenanceWindowOptions(string id = default(string), string name = default(string), string type = default(string), bool? isEnabled = default(bool?), IList maintenanceWindowCycles = default(IList), int? minDurationInMinutes = default(int?), int? defaultDurationInMinutes = default(int?), int? minCycles = default(int?), int? timeGranularityInMinutes = default(int?), bool? allowMultipleMaintenanceWindowsPerCycle = default(bool?)) + : base(id, name, type) + { + IsEnabled = isEnabled; + MaintenanceWindowCycles = maintenanceWindowCycles; + MinDurationInMinutes = minDurationInMinutes; + DefaultDurationInMinutes = defaultDurationInMinutes; + MinCycles = minCycles; + TimeGranularityInMinutes = timeGranularityInMinutes; + AllowMultipleMaintenanceWindowsPerCycle = allowMultipleMaintenanceWindowsPerCycle; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether maintenance windows are enabled for the + /// database. + /// + [JsonProperty(PropertyName = "properties.isEnabled")] + public bool? IsEnabled { get; set; } + + /// + /// Gets or sets available maintenance cycles e.g. {Saturday, 0, + /// 48*60}, {Wednesday, 0, 24*60}. + /// + [JsonProperty(PropertyName = "properties.maintenanceWindowCycles")] + public IList MaintenanceWindowCycles { get; set; } + + /// + /// Gets or sets minimum duration of maintenance window. + /// + [JsonProperty(PropertyName = "properties.minDurationInMinutes")] + public int? MinDurationInMinutes { get; set; } + + /// + /// Gets or sets default duration for maintenance window. + /// + [JsonProperty(PropertyName = "properties.defaultDurationInMinutes")] + public int? DefaultDurationInMinutes { get; set; } + + /// + /// Gets or sets minimum number of maintenance windows cycles to be set + /// on the database. + /// + [JsonProperty(PropertyName = "properties.minCycles")] + public int? MinCycles { get; set; } + + /// + /// Gets or sets time granularity in minutes for maintenance windows. + /// + [JsonProperty(PropertyName = "properties.timeGranularityInMinutes")] + public int? TimeGranularityInMinutes { get; set; } + + /// + /// Gets or sets whether we allow multiple maintenance windows per + /// cycle. + /// + [JsonProperty(PropertyName = "properties.allowMultipleMaintenanceWindowsPerCycle")] + public bool? AllowMultipleMaintenanceWindowsPerCycle { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs new file mode 100644 index 0000000000000..7facd2eceb7bc --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindowTimeRange.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Maintenance window time range. + /// + public partial class MaintenanceWindowTimeRange + { + /// + /// Initializes a new instance of the MaintenanceWindowTimeRange class. + /// + public MaintenanceWindowTimeRange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceWindowTimeRange class. + /// + /// Day of maintenance window. Possible values + /// include: 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', + /// 'Friday', 'Saturday' + /// Start time minutes offset from + /// 12am. + /// Duration of maintenance window in + /// minutes. + public MaintenanceWindowTimeRange(string dayOfWeek = default(string), string startTime = default(string), string duration = default(string)) + { + DayOfWeek = dayOfWeek; + StartTime = startTime; + Duration = duration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets day of maintenance window. Possible values include: + /// 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', + /// 'Saturday' + /// + [JsonProperty(PropertyName = "dayOfWeek")] + public string DayOfWeek { get; set; } + + /// + /// Gets or sets start time minutes offset from 12am. + /// + [JsonProperty(PropertyName = "startTime")] + public string StartTime { get; set; } + + /// + /// Gets or sets duration of maintenance window in minutes. + /// + [JsonProperty(PropertyName = "duration")] + public string Duration { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindows.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindows.cs new file mode 100644 index 0000000000000..ec47bb8fc07ff --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/MaintenanceWindows.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Maintenance windows. + /// + [Rest.Serialization.JsonTransformation] + public partial class MaintenanceWindows : ProxyResource + { + /// + /// Initializes a new instance of the MaintenanceWindows class. + /// + public MaintenanceWindows() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceWindows class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + public MaintenanceWindows(string id = default(string), string name = default(string), string type = default(string), IList timeRanges = default(IList)) + : base(id, name, type) + { + TimeRanges = timeRanges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties.timeRanges")] + public IList TimeRanges { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs index a635deee61394..5f40faae050de 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedDatabaseSecurityAlertPolicy.cs @@ -46,7 +46,7 @@ public ManagedDatabaseSecurityAlertPolicy() /// Specifies an array of alerts that are /// disabled. Allowed values are: Sql_Injection, /// Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, - /// Unsafe_Action + /// Unsafe_Action, Brute_Force /// Specifies an array of e-mail addresses /// to which the alert is sent. /// Specifies that the alert is sent @@ -91,7 +91,7 @@ public ManagedDatabaseSecurityAlertPolicy() /// /// Gets or sets specifies an array of alerts that are disabled. /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - /// Access_Anomaly, Data_Exfiltration, Unsafe_Action + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force /// [JsonProperty(PropertyName = "properties.disabledAlerts")] public IList DisabledAlerts { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstance.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstance.cs index 05f56db02fc02..500c206ee3af2 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstance.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstance.cs @@ -118,7 +118,13 @@ public ManagedInstance() /// 'ZRS' /// Whether or not the multi-az is /// enabled. - public ManagedInstance(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), Sku sku = default(Sku), string provisioningState = default(string), string managedInstanceCreateMode = default(string), string fullyQualifiedDomainName = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string subnetId = default(string), string state = default(string), string licenseType = default(string), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = default(string), string dnsZone = default(string), string dnsZonePartner = default(string), bool? publicDataEndpointEnabled = default(bool?), string sourceManagedInstanceId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string proxyOverride = default(string), string timezoneId = default(string), string instancePoolId = default(string), string maintenanceConfigurationId = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string storageAccountType = default(string), bool? zoneRedundant = default(bool?)) + /// 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. + public ManagedInstance(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentityWithUserAssignedIdentities identity = default(ResourceIdentityWithUserAssignedIdentities), Sku sku = default(Sku), string provisioningState = default(string), string managedInstanceCreateMode = default(string), string fullyQualifiedDomainName = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string subnetId = default(string), string state = default(string), string licenseType = default(string), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = default(string), string dnsZone = default(string), string dnsZonePartner = default(string), bool? publicDataEndpointEnabled = default(bool?), string sourceManagedInstanceId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string proxyOverride = default(string), string timezoneId = default(string), string instancePoolId = default(string), string maintenanceConfigurationId = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string storageAccountType = default(string), bool? zoneRedundant = default(bool?), string primaryUserAssignedIdentityId = default(string), string keyId = default(string), ManagedInstanceExternalAdministrator administrators = default(ManagedInstanceExternalAdministrator)) : base(location, id, name, type, tags) { Identity = identity; @@ -147,6 +153,9 @@ public ManagedInstance() MinimalTlsVersion = minimalTlsVersion; StorageAccountType = storageAccountType; ZoneRedundant = zoneRedundant; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; CustomInit(); } @@ -160,7 +169,7 @@ public ManagedInstance() /// instance. /// [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } + public ResourceIdentityWithUserAssignedIdentities Identity { get; set; } /// /// Gets or sets managed instance SKU. Allowed values for sku.name: @@ -350,6 +359,26 @@ public ManagedInstance() [JsonProperty(PropertyName = "properties.zoneRedundant")] public bool? ZoneRedundant { get; set; } + /// + /// Gets or sets the resource id of a user assigned identity to be used + /// by default. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentityId")] + public string PrimaryUserAssignedIdentityId { get; set; } + + /// + /// Gets or sets a CMK URI of the key to use for encryption. + /// + [JsonProperty(PropertyName = "properties.keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets the Azure Active Directory administrator of the + /// server. + /// + [JsonProperty(PropertyName = "properties.administrators")] + public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs index 10a41136245f0..1900f3a295c55 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceEncryptionProtector.cs @@ -46,7 +46,9 @@ public ManagedInstanceEncryptionProtector() /// key. /// The URI of the server key. /// Thumbprint of the server key. - public ManagedInstanceEncryptionProtector(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string serverKeyName = default(string), string uri = default(string), string thumbprint = default(string)) + /// Key auto rotation opt-in flag. + /// Either true or false. + public ManagedInstanceEncryptionProtector(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string serverKeyName = default(string), string uri = default(string), string thumbprint = default(string), bool? autoRotationEnabled = default(bool?)) : base(id, name, type) { Kind = kind; @@ -54,6 +56,7 @@ public ManagedInstanceEncryptionProtector() ServerKeyType = serverKeyType; Uri = uri; Thumbprint = thumbprint; + AutoRotationEnabled = autoRotationEnabled; CustomInit(); } @@ -95,6 +98,12 @@ public ManagedInstanceEncryptionProtector() [JsonProperty(PropertyName = "properties.thumbprint")] public string Thumbprint { get; private set; } + /// + /// Gets or sets key auto rotation opt-in flag. Either true or false. + /// + [JsonProperty(PropertyName = "properties.autoRotationEnabled")] + public bool? AutoRotationEnabled { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs new file mode 100644 index 0000000000000..687498eceb437 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceExternalAdministrator.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a active directory administrator. + /// + public partial class ManagedInstanceExternalAdministrator + { + /// + /// Initializes a new instance of the + /// ManagedInstanceExternalAdministrator class. + /// + public ManagedInstanceExternalAdministrator() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedInstanceExternalAdministrator class. + /// + /// Type of the sever administrator. + /// Possible values include: 'ActiveDirectory' + /// Principal Type of the sever + /// administrator. Possible values include: 'User', 'Group', + /// 'Application' + /// Login name of the server administrator. + /// SID (object ID) of the server + /// administrator. + /// Tenant ID of the administrator. + /// Azure Active Directory only + /// Authentication enabled. + public ManagedInstanceExternalAdministrator(string administratorType = default(string), string principalType = default(string), string login = default(string), System.Guid? sid = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), bool? azureADOnlyAuthentication = default(bool?)) + { + AdministratorType = administratorType; + PrincipalType = principalType; + Login = login; + Sid = sid; + TenantId = tenantId; + AzureADOnlyAuthentication = azureADOnlyAuthentication; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the sever administrator. Possible values + /// include: 'ActiveDirectory' + /// + [JsonProperty(PropertyName = "administratorType")] + public string AdministratorType { get; set; } + + /// + /// Gets or sets principal Type of the sever administrator. Possible + /// values include: 'User', 'Group', 'Application' + /// + [JsonProperty(PropertyName = "principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets or sets login name of the server administrator. + /// + [JsonProperty(PropertyName = "login")] + public string Login { get; set; } + + /// + /// Gets or sets SID (object ID) of the server administrator. + /// + [JsonProperty(PropertyName = "sid")] + public System.Guid? Sid { get; set; } + + /// + /// Gets or sets tenant ID of the administrator. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; set; } + + /// + /// Gets or sets azure Active Directory only Authentication enabled. + /// + [JsonProperty(PropertyName = "azureADOnlyAuthentication")] + public bool? AzureADOnlyAuthentication { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceKey.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceKey.cs index da6ab159a907e..c813629cdbff5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceKey.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceKey.cs @@ -44,7 +44,9 @@ public ManagedInstanceKey() /// AzureKeyVault, then the URI is required. /// Thumbprint of the key. /// The key creation date. - public ManagedInstanceKey(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string uri = default(string), string thumbprint = default(string), System.DateTime? creationDate = default(System.DateTime?)) + /// Key auto rotation opt-in flag. + /// Either true or false. + public ManagedInstanceKey(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string uri = default(string), string thumbprint = default(string), System.DateTime? creationDate = default(System.DateTime?), bool? autoRotationEnabled = default(bool?)) : base(id, name, type) { Kind = kind; @@ -52,6 +54,7 @@ public ManagedInstanceKey() Uri = uri; Thumbprint = thumbprint; CreationDate = creationDate; + AutoRotationEnabled = autoRotationEnabled; CustomInit(); } @@ -93,6 +96,12 @@ public ManagedInstanceKey() [JsonProperty(PropertyName = "properties.creationDate")] public System.DateTime? CreationDate { get; private set; } + /// + /// Gets key auto rotation opt-in flag. Either true or false. + /// + [JsonProperty(PropertyName = "properties.autoRotationEnabled")] + public bool? AutoRotationEnabled { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs index a9b4529edcc40..d8a0ca93edcf4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceLongTermRetentionBackup.cs @@ -48,7 +48,10 @@ public ManagedInstanceLongTermRetentionBackup() /// The time the backup was taken /// The time the long term retention /// backup will expire. - public ManagedInstanceLongTermRetentionBackup(string id = default(string), string name = default(string), string type = default(string), string managedInstanceName = default(string), System.DateTime? managedInstanceCreateTime = default(System.DateTime?), string databaseName = default(string), System.DateTime? databaseDeletionTime = default(System.DateTime?), System.DateTime? backupTime = default(System.DateTime?), System.DateTime? backupExpirationTime = default(System.DateTime?)) + /// The storage redundancy type + /// of the backup. Possible values include: 'Geo', 'Local', + /// 'Zone' + public ManagedInstanceLongTermRetentionBackup(string id = default(string), string name = default(string), string type = default(string), string managedInstanceName = default(string), System.DateTime? managedInstanceCreateTime = default(System.DateTime?), string databaseName = default(string), System.DateTime? databaseDeletionTime = default(System.DateTime?), System.DateTime? backupTime = default(System.DateTime?), System.DateTime? backupExpirationTime = default(System.DateTime?), string backupStorageRedundancy = default(string)) : base(id, name, type) { ManagedInstanceName = managedInstanceName; @@ -57,6 +60,7 @@ public ManagedInstanceLongTermRetentionBackup() DatabaseDeletionTime = databaseDeletionTime; BackupTime = backupTime; BackupExpirationTime = backupExpirationTime; + BackupStorageRedundancy = backupStorageRedundancy; CustomInit(); } @@ -101,5 +105,12 @@ public ManagedInstanceLongTermRetentionBackup() [JsonProperty(PropertyName = "properties.backupExpirationTime")] public System.DateTime? BackupExpirationTime { get; private set; } + /// + /// Gets the storage redundancy type of the backup. Possible values + /// include: 'Geo', 'Local', 'Zone' + /// + [JsonProperty(PropertyName = "properties.backupStorageRedundancy")] + public string BackupStorageRedundancy { get; private set; } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs new file mode 100644 index 0000000000000..ca721689170a5 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateEndpointConnection.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A private endpoint connection + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedInstancePrivateEndpointConnection : ProxyResource + { + /// + /// Initializes a new instance of the + /// ManagedInstancePrivateEndpointConnection class. + /// + public ManagedInstancePrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedInstancePrivateEndpointConnection class. + /// + /// 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. + public ManagedInstancePrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), ManagedInstancePrivateEndpointProperty privateEndpoint = default(ManagedInstancePrivateEndpointProperty), ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(ManagedInstancePrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) + : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets private endpoint which the connection belongs to. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public ManagedInstancePrivateEndpointProperty PrivateEndpoint { get; set; } + + /// + /// Gets or sets connection State of the Private Endpoint Connection. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public ManagedInstancePrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets state of the Private Endpoint Connection. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState != null) + { + PrivateLinkServiceConnectionState.Validate(); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs new file mode 100644 index 0000000000000..a3740cedf6b0d --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLink.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A private link resource + /// + public partial class ManagedInstancePrivateLink : ProxyResource + { + /// + /// Initializes a new instance of the ManagedInstancePrivateLink class. + /// + public ManagedInstancePrivateLink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedInstancePrivateLink class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The private link resource group + /// id. + public ManagedInstancePrivateLink(string id = default(string), string name = default(string), string type = default(string), ManagedInstancePrivateLinkProperties properties = default(ManagedInstancePrivateLinkProperties)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties")] + public ManagedInstancePrivateLinkProperties Properties { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs new file mode 100644 index 0000000000000..9ae922258c970 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstancePrivateLinkProperties.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a private link resource. + /// + public partial class ManagedInstancePrivateLinkProperties + { + /// + /// Initializes a new instance of the + /// ManagedInstancePrivateLinkProperties class. + /// + public ManagedInstancePrivateLinkProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedInstancePrivateLinkProperties class. + /// + /// The private link resource group id. + /// The private link resource required + /// member names. + public ManagedInstancePrivateLinkProperties(string groupId = default(string), IList requiredMembers = default(IList)) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "requiredMembers")] + public IList RequiredMembers { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceQuery.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceQuery.cs new file mode 100644 index 0000000000000..97413b6b87446 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceQuery.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database query. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedInstanceQuery : ProxyResource + { + /// + /// Initializes a new instance of the ManagedInstanceQuery class. + /// + public ManagedInstanceQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedInstanceQuery class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Query text. + public ManagedInstanceQuery(string id = default(string), string name = default(string), string type = default(string), string queryText = default(string)) + : base(id, name, type) + { + QueryText = queryText; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets query text. + /// + [JsonProperty(PropertyName = "properties.queryText")] + public string QueryText { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceUpdate.cs index 7345937a002ce..6053e461398db 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceUpdate.cs @@ -111,8 +111,14 @@ public ManagedInstanceUpdate() /// 'ZRS' /// 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. /// Resource tags. - public ManagedInstanceUpdate(Sku sku = default(Sku), ResourceIdentity identity = default(ResourceIdentity), string provisioningState = default(string), string managedInstanceCreateMode = default(string), string fullyQualifiedDomainName = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string subnetId = default(string), string state = default(string), string licenseType = default(string), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = default(string), string dnsZone = default(string), string dnsZonePartner = default(string), bool? publicDataEndpointEnabled = default(bool?), string sourceManagedInstanceId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string proxyOverride = default(string), string timezoneId = default(string), string instancePoolId = default(string), string maintenanceConfigurationId = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string storageAccountType = default(string), bool? zoneRedundant = default(bool?), IDictionary tags = default(IDictionary)) + public ManagedInstanceUpdate(Sku sku = default(Sku), ResourceIdentityWithUserAssignedIdentities identity = default(ResourceIdentityWithUserAssignedIdentities), string provisioningState = default(string), string managedInstanceCreateMode = default(string), string fullyQualifiedDomainName = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string subnetId = default(string), string state = default(string), string licenseType = default(string), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = default(string), string dnsZone = default(string), string dnsZonePartner = default(string), bool? publicDataEndpointEnabled = default(bool?), string sourceManagedInstanceId = default(string), System.DateTime? restorePointInTime = default(System.DateTime?), string proxyOverride = default(string), string timezoneId = default(string), string instancePoolId = default(string), string maintenanceConfigurationId = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string storageAccountType = default(string), bool? zoneRedundant = default(bool?), string primaryUserAssignedIdentityId = default(string), string keyId = default(string), ManagedInstanceExternalAdministrator administrators = default(ManagedInstanceExternalAdministrator), IDictionary tags = default(IDictionary)) { Sku = sku; Identity = identity; @@ -140,6 +146,9 @@ public ManagedInstanceUpdate() MinimalTlsVersion = minimalTlsVersion; StorageAccountType = storageAccountType; ZoneRedundant = zoneRedundant; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; Tags = tags; CustomInit(); } @@ -159,7 +168,7 @@ public ManagedInstanceUpdate() /// Gets or sets managed instance identity /// [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } + public ResourceIdentityWithUserAssignedIdentities Identity { get; set; } /// /// Gets possible values include: 'Creating', 'Deleting', 'Updating', @@ -342,6 +351,26 @@ public ManagedInstanceUpdate() [JsonProperty(PropertyName = "properties.zoneRedundant")] public bool? ZoneRedundant { get; set; } + /// + /// Gets or sets the resource id of a user assigned identity to be used + /// by default. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentityId")] + public string PrimaryUserAssignedIdentityId { get; set; } + + /// + /// Gets or sets a CMK URI of the key to use for encryption. + /// + [JsonProperty(PropertyName = "properties.keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets the Azure Active Directory administrator of the + /// server. + /// + [JsonProperty(PropertyName = "properties.administrators")] + public ManagedInstanceExternalAdministrator Administrators { get; set; } + /// /// Gets or sets resource tags. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs index 7c46e6d776259..aec229e8d1ebe 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedInstanceVulnerabilityAssessment.cs @@ -41,8 +41,8 @@ public ManagedInstanceVulnerabilityAssessment() /// Resource name. /// Resource type. /// A shared access signature (SAS - /// Key) that has read and write access to the blob container specified - /// in 'storageContainerPath' parameter. If 'storageAccountAccessKey' + /// 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. @@ -72,10 +72,10 @@ public ManagedInstanceVulnerabilityAssessment() public string StorageContainerPath { get; set; } /// - /// Gets or sets 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. + /// Gets or sets a shared access signature (SAS Key) that has write + /// access to the blob container specified in 'storageContainerPath' + /// parameter. If 'storageAccountAccessKey' isn't specified, + /// StorageContainerSasKey is required. /// [JsonProperty(PropertyName = "properties.storageContainerSasKey")] public string StorageContainerSasKey { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs index 087d97a1540b6..af0e9b52e8806 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedServerSecurityAlertPolicy.cs @@ -38,15 +38,17 @@ public ManagedServerSecurityAlertPolicy() /// /// Specifies the state of the policy, whether it /// is enabled or disabled or a policy has not been applied yet on the - /// specific database. Possible values include: 'New', 'Enabled', + /// specific database. Possible values include: 'Enabled', /// 'Disabled' /// Resource ID. /// Resource name. /// Resource type. + /// SystemData of + /// SecurityAlertPolicyResource. /// Specifies an array of alerts that are /// disabled. Allowed values are: Sql_Injection, /// Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, - /// Unsafe_Action + /// Unsafe_Action, Brute_Force /// Specifies an array of e-mail addresses /// to which the alert is sent. /// Specifies that the alert is sent @@ -60,9 +62,10 @@ public ManagedServerSecurityAlertPolicy() /// the Threat Detection audit logs. /// Specifies the UTC creation time of the /// policy. - public ManagedServerSecurityAlertPolicy(SecurityAlertPolicyState state, string id = default(string), string name = default(string), string type = default(string), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) + public ManagedServerSecurityAlertPolicy(SecurityAlertsPolicyState state, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) : base(id, name, type) { + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -79,19 +82,24 @@ public ManagedServerSecurityAlertPolicy() /// partial void CustomInit(); + /// + /// Gets systemData of SecurityAlertPolicyResource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + /// /// Gets or sets specifies the state of the policy, whether it is /// enabled or disabled or a policy has not been applied yet on the - /// specific database. Possible values include: 'New', 'Enabled', - /// 'Disabled' + /// specific database. Possible values include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "properties.state")] - public SecurityAlertPolicyState State { get; set; } + public SecurityAlertsPolicyState State { get; set; } /// /// Gets or sets specifies an array of alerts that are disabled. /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - /// Access_Anomaly, Data_Exfiltration, Unsafe_Action + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force /// [JsonProperty(PropertyName = "properties.disabledAlerts")] public IList DisabledAlerts { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs new file mode 100644 index 0000000000000..bc98f447cce4f --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ManagedTransparentDataEncryption.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A managed database transparent data encryption state. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedTransparentDataEncryption : ProxyResource + { + /// + /// Initializes a new instance of the ManagedTransparentDataEncryption + /// class. + /// + public ManagedTransparentDataEncryption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedTransparentDataEncryption + /// class. + /// + /// Specifies the state of the transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' + /// Resource ID. + /// Resource name. + /// Resource type. + public ManagedTransparentDataEncryption(TransparentDataEncryptionState state, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the state of the transparent data + /// encryption. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public TransparentDataEncryptionState State { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationsHealth.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationsHealth.cs new file mode 100644 index 0000000000000..f1b9c6f976168 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/OperationsHealth.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Operations health status in a location. + /// + [Rest.Serialization.JsonTransformation] + public partial class OperationsHealth : ProxyResource + { + /// + /// Initializes a new instance of the OperationsHealth class. + /// + public OperationsHealth() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsHealth class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Operation name for the + /// service + /// Operation health status of the + /// service. + /// Health status description. + public OperationsHealth(string id = default(string), string name = default(string), string type = default(string), string operationsHealthName = default(string), string health = default(string), string description = default(string)) + : base(id, name, type) + { + OperationsHealthName = operationsHealthName; + Health = health; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets operation name for the service + /// + [JsonProperty(PropertyName = "properties.name")] + public string OperationsHealthName { get; private set; } + + /// + /// Gets operation health status of the service. + /// + [JsonProperty(PropertyName = "properties.health")] + public string Health { get; private set; } + + /// + /// Gets health status description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrincipalType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrincipalType.cs new file mode 100644 index 0000000000000..79ae75393c7c9 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrincipalType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + + /// + /// Defines values for PrincipalType. + /// + public static class PrincipalType + { + public const string User = "User"; + public const string Group = "Group"; + public const string Application = "Application"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs index 1c06729a45018..cf8ae819975c4 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/PrivateLinkResourceProperties.cs @@ -36,10 +36,13 @@ public PrivateLinkResourceProperties() /// The private link resource group id. /// The private link resource required /// member names. - public PrivateLinkResourceProperties(string groupId = default(string), IList requiredMembers = default(IList)) + /// The private link resource required + /// zone names. + public PrivateLinkResourceProperties(string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) { GroupId = groupId; RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; CustomInit(); } @@ -60,5 +63,11 @@ public PrivateLinkResourceProperties() [JsonProperty(PropertyName = "requiredMembers")] public IList RequiredMembers { get; private set; } + /// + /// Gets the private link resource required zone names. + /// + [JsonProperty(PropertyName = "requiredZoneNames")] + public IList RequiredZoneNames { get; private set; } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs new file mode 100644 index 0000000000000..5ad21835e87b0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ProxyResourceWithWritableName.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using System.Linq; + + /// + /// ARM proxy resource. + /// + public partial class ProxyResourceWithWritableName : ResourceWithWritableName + { + /// + /// Initializes a new instance of the ProxyResourceWithWritableName + /// class. + /// + public ProxyResourceWithWritableName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResourceWithWritableName + /// class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + public ProxyResourceWithWritableName(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/QueryStatistics.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/QueryStatistics.cs new file mode 100644 index 0000000000000..40f0e404e1bf7 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/QueryStatistics.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + [Rest.Serialization.JsonTransformation] + public partial class QueryStatistics : ProxyResource + { + /// + /// Initializes a new instance of the QueryStatistics class. + /// + public QueryStatistics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryStatistics class. + /// + /// 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 + public QueryStatistics(string id = default(string), string name = default(string), string type = default(string), string databaseName = default(string), string queryId = default(string), string startTime = default(string), string endTime = default(string), IList intervals = default(IList)) + : base(id, name, type) + { + DatabaseName = databaseName; + QueryId = queryId; + StartTime = startTime; + EndTime = endTime; + Intervals = intervals; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets database name of the database in which this query was + /// executed. + /// + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; private set; } + + /// + /// Gets unique query id (unique within one database). + /// + [JsonProperty(PropertyName = "properties.queryId")] + public string QueryId { get; private set; } + + /// + /// Gets the start time for the metric (ISO-8601 format). + /// + [JsonProperty(PropertyName = "properties.startTime")] + public string StartTime { get; private set; } + + /// + /// Gets the end time for the metric (ISO-8601 format). + /// + [JsonProperty(PropertyName = "properties.endTime")] + public string EndTime { get; private set; } + + /// + /// Gets or sets list of intervals with appropriate metric data + /// + [JsonProperty(PropertyName = "properties.intervals")] + public IList Intervals { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedAction.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedAction.cs new file mode 100644 index 0000000000000..1b39ec23315cc --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedAction.cs @@ -0,0 +1,320 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Database, Server or Elastic Pool Recommended Action. + /// + [Rest.Serialization.JsonTransformation] + public partial class RecommendedAction : ProxyResource + { + /// + /// Initializes a new instance of the RecommendedAction class. + /// + public RecommendedAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedAction class. + /// + /// Gets the info of the current state the + /// recommended action is in. + /// 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 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. Possible + /// values include: '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. + /// Possible values include: '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. + public RecommendedAction(RecommendedActionStateInfo state, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string recommendationReason = default(string), System.DateTime? validSince = default(System.DateTime?), System.DateTime? lastRefresh = default(System.DateTime?), bool? isExecutableAction = default(bool?), bool? isRevertableAction = default(bool?), bool? isArchivedAction = default(bool?), System.DateTime? executeActionStartTime = default(System.DateTime?), string executeActionDuration = default(string), System.DateTime? revertActionStartTime = default(System.DateTime?), string revertActionDuration = default(string), RecommendedActionInitiatedBy? executeActionInitiatedBy = default(RecommendedActionInitiatedBy?), System.DateTime? executeActionInitiatedTime = default(System.DateTime?), RecommendedActionInitiatedBy? revertActionInitiatedBy = default(RecommendedActionInitiatedBy?), System.DateTime? revertActionInitiatedTime = default(System.DateTime?), int? score = default(int?), RecommendedActionImplementationInfo implementationDetails = default(RecommendedActionImplementationInfo), RecommendedActionErrorInfo errorDetails = default(RecommendedActionErrorInfo), IList estimatedImpact = default(IList), IList observedImpact = default(IList), IList timeSeries = default(IList), IList linkedObjects = default(IList), IDictionary details = default(IDictionary)) + : 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; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource kind. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets the reason for recommending this action. e.g., DuplicateIndex + /// + [JsonProperty(PropertyName = "properties.recommendationReason")] + public string RecommendationReason { get; private set; } + + /// + /// Gets the time since when this recommended action is valid. + /// + [JsonProperty(PropertyName = "properties.validSince")] + public System.DateTime? ValidSince { get; private set; } + + /// + /// Gets time when this recommended action was last refreshed. + /// + [JsonProperty(PropertyName = "properties.lastRefresh")] + public System.DateTime? LastRefresh { get; private set; } + + /// + /// Gets the info of the current state the recommended action is in. + /// + [JsonProperty(PropertyName = "properties.state")] + public RecommendedActionStateInfo State { get; set; } + + /// + /// Gets if this recommended action is actionable by user + /// + [JsonProperty(PropertyName = "properties.isExecutableAction")] + public bool? IsExecutableAction { get; private set; } + + /// + /// Gets if changes applied by this recommended action can be reverted + /// by user + /// + [JsonProperty(PropertyName = "properties.isRevertableAction")] + public bool? IsRevertableAction { get; private set; } + + /// + /// Gets if this recommended action was suggested some time ago but + /// user chose to ignore this and system added a new recommended action + /// again. + /// + [JsonProperty(PropertyName = "properties.isArchivedAction")] + public bool? IsArchivedAction { get; private set; } + + /// + /// Gets the time when system started applying this recommended action + /// on the user resource. e.g., index creation start time + /// + [JsonProperty(PropertyName = "properties.executeActionStartTime")] + public System.DateTime? ExecuteActionStartTime { get; private set; } + + /// + /// Gets the time taken for applying this recommended action on user + /// resource. e.g., time taken for index creation + /// + [JsonProperty(PropertyName = "properties.executeActionDuration")] + public string ExecuteActionDuration { get; private set; } + + /// + /// Gets the time when system started reverting changes of this + /// recommended action on user resource. e.g., time when index drop is + /// executed. + /// + [JsonProperty(PropertyName = "properties.revertActionStartTime")] + public System.DateTime? RevertActionStartTime { get; private set; } + + /// + /// Gets the time taken for reverting changes of this recommended + /// action on user resource. e.g., time taken for dropping the created + /// index. + /// + [JsonProperty(PropertyName = "properties.revertActionDuration")] + public string RevertActionDuration { get; private set; } + + /// + /// Gets if approval for applying this recommended action was given by + /// user/system. Possible values include: 'User', 'System' + /// + [JsonProperty(PropertyName = "properties.executeActionInitiatedBy")] + public RecommendedActionInitiatedBy? ExecuteActionInitiatedBy { get; private set; } + + /// + /// Gets the time when this recommended action was approved for + /// execution. + /// + [JsonProperty(PropertyName = "properties.executeActionInitiatedTime")] + public System.DateTime? ExecuteActionInitiatedTime { get; private set; } + + /// + /// Gets if approval for reverting this recommended action was given by + /// user/system. Possible values include: 'User', 'System' + /// + [JsonProperty(PropertyName = "properties.revertActionInitiatedBy")] + public RecommendedActionInitiatedBy? RevertActionInitiatedBy { get; private set; } + + /// + /// Gets the time when this recommended action was approved for revert. + /// + [JsonProperty(PropertyName = "properties.revertActionInitiatedTime")] + public System.DateTime? RevertActionInitiatedTime { get; private set; } + + /// + /// Gets the impact of this recommended action. Possible values are 1 - + /// Low impact, 2 - Medium Impact and 3 - High Impact + /// + [JsonProperty(PropertyName = "properties.score")] + public int? Score { get; private set; } + + /// + /// Gets the implementation details of this recommended action for user + /// to apply it manually. + /// + [JsonProperty(PropertyName = "properties.implementationDetails")] + public RecommendedActionImplementationInfo ImplementationDetails { get; private set; } + + /// + /// Gets the error details if and why this recommended action is put to + /// error state. + /// + [JsonProperty(PropertyName = "properties.errorDetails")] + public RecommendedActionErrorInfo ErrorDetails { get; private set; } + + /// + /// Gets the estimated impact info for this recommended action e.g., + /// Estimated CPU gain, Estimated Disk Space change + /// + [JsonProperty(PropertyName = "properties.estimatedImpact")] + public IList EstimatedImpact { get; private set; } + + /// + /// Gets the observed/actual impact info for this recommended action + /// e.g., Actual CPU gain, Actual Disk Space change + /// + [JsonProperty(PropertyName = "properties.observedImpact")] + public IList ObservedImpact { get; private set; } + + /// + /// Gets the time series info of metrics for this recommended action + /// e.g., CPU consumption time series + /// + [JsonProperty(PropertyName = "properties.timeSeries")] + public IList TimeSeries { get; private set; } + + /// + /// Gets the linked objects, if any. + /// + [JsonProperty(PropertyName = "properties.linkedObjects")] + public IList LinkedObjects { get; private set; } + + /// + /// Gets additional details specific to this recommended action. + /// + [JsonProperty(PropertyName = "properties.details")] + public IDictionary Details { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (State == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "State"); + } + if (State != null) + { + State.Validate(); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionCurrentState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionCurrentState.cs new file mode 100644 index 0000000000000..f507c8111eef3 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionCurrentState.cs @@ -0,0 +1,34 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + + /// + /// Defines values for RecommendedActionCurrentState. + /// + public static class RecommendedActionCurrentState + { + public const string Active = "Active"; + public const string Pending = "Pending"; + public const string Executing = "Executing"; + public const string Verifying = "Verifying"; + public const string PendingRevert = "PendingRevert"; + public const string RevertCancelled = "RevertCancelled"; + public const string Reverting = "Reverting"; + public const string Reverted = "Reverted"; + public const string Ignored = "Ignored"; + public const string Expired = "Expired"; + public const string Monitoring = "Monitoring"; + public const string Resolved = "Resolved"; + public const string Success = "Success"; + public const string Error = "Error"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs new file mode 100644 index 0000000000000..6e83bac42f303 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionErrorInfo.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains error information for an Azure SQL Database, Server or Elastic + /// Pool Recommended Action. + /// + public partial class RecommendedActionErrorInfo + { + /// + /// Initializes a new instance of the RecommendedActionErrorInfo class. + /// + public RecommendedActionErrorInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedActionErrorInfo class. + /// + /// 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. Possible values include: 'Yes', 'No' + public RecommendedActionErrorInfo(string errorCode = default(string), IsRetryable? isRetryable = default(IsRetryable?)) + { + ErrorCode = errorCode; + IsRetryable = isRetryable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the reason why the recommended action was put to error state. + /// e.g., DatabaseHasQdsOff, IndexAlreadyExists + /// + [JsonProperty(PropertyName = "errorCode")] + public string ErrorCode { get; private set; } + + /// + /// Gets whether the error could be ignored and recommended action + /// could be retried. Possible values are: Yes/No. Possible values + /// include: 'Yes', 'No' + /// + [JsonProperty(PropertyName = "isRetryable")] + public IsRetryable? IsRetryable { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs new file mode 100644 index 0000000000000..f66900e11a922 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImpactRecord.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// 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 the RecommendedActionImpactRecord + /// class. + /// + public RecommendedActionImpactRecord() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedActionImpactRecord + /// class. + /// + /// 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 + public RecommendedActionImpactRecord(string dimensionName = default(string), string unit = default(string), double? absoluteValue = default(double?), double? changeValueAbsolute = default(double?), double? changeValueRelative = default(double?)) + { + DimensionName = dimensionName; + Unit = unit; + AbsoluteValue = absoluteValue; + ChangeValueAbsolute = changeValueAbsolute; + ChangeValueRelative = changeValueRelative; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the impact dimension. e.g., CPUChange, + /// DiskSpaceChange, NumberOfQueriesAffected. + /// + [JsonProperty(PropertyName = "dimensionName")] + public string DimensionName { get; private set; } + + /// + /// Gets the name of the impact dimension. e.g., CPUChange, + /// DiskSpaceChange, NumberOfQueriesAffected. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets the absolute value of this dimension if applicable. e.g., + /// Number of Queries affected + /// + [JsonProperty(PropertyName = "absoluteValue")] + public double? AbsoluteValue { get; private set; } + + /// + /// Gets the absolute change in the value of this dimension. e.g., + /// Absolute Disk space change in Megabytes + /// + [JsonProperty(PropertyName = "changeValueAbsolute")] + public double? ChangeValueAbsolute { get; private set; } + + /// + /// Gets the relative change in the value of this dimension. e.g., + /// Relative Disk space change in Percentage + /// + [JsonProperty(PropertyName = "changeValueRelative")] + public double? ChangeValueRelative { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs new file mode 100644 index 0000000000000..347c90d3e4961 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionImplementationInfo.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// 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 the + /// RecommendedActionImplementationInfo class. + /// + public RecommendedActionImplementationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RecommendedActionImplementationInfo class. + /// + /// Gets the method in which this recommended + /// action can be manually implemented. e.g., TSql, AzurePowerShell. + /// Possible values include: 'TSql', 'AzurePowerShell' + /// Gets the manual implementation script. e.g., + /// T-SQL script that could be executed on the database. + public RecommendedActionImplementationInfo(ImplementationMethod? method = default(ImplementationMethod?), string script = default(string)) + { + Method = method; + Script = script; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the method in which this recommended action can be manually + /// implemented. e.g., TSql, AzurePowerShell. Possible values include: + /// 'TSql', 'AzurePowerShell' + /// + [JsonProperty(PropertyName = "method")] + public ImplementationMethod? Method { get; private set; } + + /// + /// Gets the manual implementation script. e.g., T-SQL script that + /// could be executed on the database. + /// + [JsonProperty(PropertyName = "script")] + public string Script { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs new file mode 100644 index 0000000000000..79e02aaca4a14 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionInitiatedBy.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RecommendedActionInitiatedBy. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecommendedActionInitiatedBy + { + [EnumMember(Value = "User")] + User, + [EnumMember(Value = "System")] + System + } + internal static class RecommendedActionInitiatedByEnumExtension + { + internal static string ToSerializedValue(this RecommendedActionInitiatedBy? value) + { + return value == null ? null : ((RecommendedActionInitiatedBy)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RecommendedActionInitiatedBy value) + { + switch( value ) + { + case RecommendedActionInitiatedBy.User: + return "User"; + case RecommendedActionInitiatedBy.System: + return "System"; + } + return null; + } + + internal static RecommendedActionInitiatedBy? ParseRecommendedActionInitiatedBy(this string value) + { + switch( value ) + { + case "User": + return RecommendedActionInitiatedBy.User; + case "System": + return RecommendedActionInitiatedBy.System; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs new file mode 100644 index 0000000000000..01dc1b71dbc87 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionMetricInfo.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// 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 the RecommendedActionMetricInfo + /// class. + /// + public RecommendedActionMetricInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedActionMetricInfo + /// class. + /// + /// 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. + public RecommendedActionMetricInfo(string metricName = default(string), string unit = default(string), string timeGrain = default(string), System.DateTime? startTime = default(System.DateTime?), double? value = default(double?)) + { + MetricName = metricName; + Unit = unit; + TimeGrain = timeGrain; + StartTime = startTime; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the metric. e.g., CPU, Number of Queries. + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; private set; } + + /// + /// Gets the unit in which metric is measured. e.g., DTU, Frequency + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets the duration of time interval for the value given by this + /// MetricInfo. e.g., PT1H (1 hour) + /// + [JsonProperty(PropertyName = "timeGrain")] + public string TimeGrain { get; private set; } + + /// + /// Gets the start time of time interval given by this MetricInfo. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the value of the metric in the time interval given by this + /// MetricInfo. + /// + [JsonProperty(PropertyName = "value")] + public double? Value { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionStateInfo.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionStateInfo.cs new file mode 100644 index 0000000000000..28ee87e2af3cd --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedActionStateInfo.cs @@ -0,0 +1,128 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// 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 the RecommendedActionStateInfo class. + /// + public RecommendedActionStateInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedActionStateInfo class. + /// + /// 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. Possible + /// values include: 'Active', 'Pending', 'Executing', 'Verifying', + /// 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', + /// 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', + /// 'Error' + /// Gets who initiated the execution of + /// this recommended action. Possible Value are: User -> When + /// user explicity notified system to apply the recommended action. + /// System -> When auto-execute status of this advisor was set to + /// 'Enabled', in which case the system applied it. Possible values + /// include: 'User', 'System' + /// Gets the time when the state was last + /// modified + public RecommendedActionStateInfo(string currentValue, RecommendedActionInitiatedBy? actionInitiatedBy = default(RecommendedActionInitiatedBy?), System.DateTime? lastModified = default(System.DateTime?)) + { + CurrentValue = currentValue; + ActionInitiatedBy = actionInitiatedBy; + LastModified = lastModified; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current state the recommended action is in. Some + /// commonly used states are: Active -&gt; recommended action + /// is active and no action has been taken yet. Pending -&gt; + /// recommended action is approved for and is awaiting execution. + /// Executing -&gt; recommended action is being applied on the + /// user database. Verifying -&gt; recommended action was applied + /// and is being verified of its usefulness by the system. Success + /// -&gt; recommended action was applied and improvement found + /// during verification. Pending Revert -&gt; verification found + /// little or no improvement so recommended action is queued for revert + /// or user has manually reverted. Reverting -&gt; changes made + /// while applying recommended action are being reverted on the user + /// database. Reverted -&gt; successfully reverted the changes + /// made by recommended action on user database. Ignored -&gt; + /// user explicitly ignored/discarded the recommended action. Possible + /// values include: 'Active', 'Pending', 'Executing', 'Verifying', + /// 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', + /// 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', 'Error' + /// + [JsonProperty(PropertyName = "currentValue")] + public string CurrentValue { get; set; } + + /// + /// Gets who initiated the execution of this recommended action. + /// Possible Value are: User -&gt; When user explicity notified + /// system to apply the recommended action. System -&gt; When + /// auto-execute status of this advisor was set to 'Enabled', in which + /// case the system applied it. Possible values include: 'User', + /// 'System' + /// + [JsonProperty(PropertyName = "actionInitiatedBy")] + public RecommendedActionInitiatedBy? ActionInitiatedBy { get; private set; } + + /// + /// Gets the time when the state was last modified + /// + [JsonProperty(PropertyName = "lastModified")] + public System.DateTime? LastModified { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CurrentValue == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CurrentValue"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPool.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPool.cs deleted file mode 100644 index 64bc89c9d26fc..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPool.cs +++ /dev/null @@ -1,153 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a recommended elastic pool. - /// - [Rest.Serialization.JsonTransformation] - public partial class RecommendedElasticPool : ProxyResource - { - /// - /// Initializes a new instance of the RecommendedElasticPool class. - /// - public RecommendedElasticPool() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RecommendedElasticPool class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// The edition of the recommended - /// elastic pool. The ElasticPoolEdition enumeration contains all the - /// valid editions. Possible values include: 'Basic', 'Standard', - /// 'Premium', 'GeneralPurpose', 'BusinessCritical' - /// 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 - public RecommendedElasticPool(string id = default(string), string name = default(string), string type = default(string), string databaseEdition = default(string), double? dtu = default(double?), double? databaseDtuMin = default(double?), double? databaseDtuMax = default(double?), double? storageMB = default(double?), System.DateTime? observationPeriodStart = default(System.DateTime?), System.DateTime? observationPeriodEnd = default(System.DateTime?), double? maxObservedDtu = default(double?), double? maxObservedStorageMB = default(double?), IList databases = default(IList), IList metrics = default(IList)) - : 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; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the edition of the recommended elastic pool. The - /// ElasticPoolEdition enumeration contains all the valid editions. - /// Possible values include: 'Basic', 'Standard', 'Premium', - /// 'GeneralPurpose', 'BusinessCritical' - /// - [JsonProperty(PropertyName = "properties.databaseEdition")] - public string DatabaseEdition { get; private set; } - - /// - /// Gets or sets the DTU for the recommended elastic pool. - /// - [JsonProperty(PropertyName = "properties.dtu")] - public double? Dtu { get; set; } - - /// - /// Gets or sets the minimum DTU for the database. - /// - [JsonProperty(PropertyName = "properties.databaseDtuMin")] - public double? DatabaseDtuMin { get; set; } - - /// - /// Gets or sets the maximum DTU for the database. - /// - [JsonProperty(PropertyName = "properties.databaseDtuMax")] - public double? DatabaseDtuMax { get; set; } - - /// - /// Gets storage size in megabytes. - /// - [JsonProperty(PropertyName = "properties.storageMB")] - public double? StorageMB { get; set; } - - /// - /// Gets the observation period start (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.observationPeriodStart")] - public System.DateTime? ObservationPeriodStart { get; private set; } - - /// - /// Gets the observation period start (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.observationPeriodEnd")] - public System.DateTime? ObservationPeriodEnd { get; private set; } - - /// - /// Gets maximum observed DTU. - /// - [JsonProperty(PropertyName = "properties.maxObservedDtu")] - public double? MaxObservedDtu { get; private set; } - - /// - /// Gets maximum observed storage in megabytes. - /// - [JsonProperty(PropertyName = "properties.maxObservedStorageMB")] - public double? MaxObservedStorageMB { get; private set; } - - /// - /// Gets the list of databases in this pool. Expanded property - /// - [JsonProperty(PropertyName = "properties.databases")] - public IList Databases { get; private set; } - - /// - /// Gets the list of databases housed in the server. Expanded property - /// - [JsonProperty(PropertyName = "properties.metrics")] - public IList Metrics { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs deleted file mode 100644 index b4a124354c277..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedElasticPoolMetric.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents recommended elastic pool metric. - /// - public partial class RecommendedElasticPoolMetric - { - /// - /// Initializes a new instance of the RecommendedElasticPoolMetric - /// class. - /// - public RecommendedElasticPoolMetric() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RecommendedElasticPoolMetric - /// class. - /// - /// 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. - public RecommendedElasticPoolMetric(System.DateTime? dateTime = default(System.DateTime?), double? dtu = default(double?), double? sizeGB = default(double?)) - { - DateTime = dateTime; - Dtu = dtu; - SizeGB = sizeGB; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the time of metric (ISO8601 format). - /// - [JsonProperty(PropertyName = "dateTime")] - public System.DateTime? DateTime { get; set; } - - /// - /// Gets or sets the DTUs (Database Transaction Units). See - /// https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ - /// - [JsonProperty(PropertyName = "dtu")] - public double? Dtu { get; set; } - - /// - /// Gets or sets size in gigabytes. - /// - [JsonProperty(PropertyName = "sizeGB")] - public double? SizeGB { get; set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndex.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndex.cs deleted file mode 100644 index 7be4717955970..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndex.cs +++ /dev/null @@ -1,171 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a database recommended index. - /// - [Rest.Serialization.JsonTransformation] - public partial class RecommendedIndex : ProxyResource - { - /// - /// Initializes a new instance of the RecommendedIndex class. - /// - public RecommendedIndex() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RecommendedIndex class. - /// - /// 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. Possible values include: 'Create', - /// 'Drop', 'Rebuild' - /// The current recommendation state. Possible - /// values include: 'Active', 'Pending', 'Executing', 'Verifying', - /// 'Pending Revert', 'Reverting', 'Reverted', 'Ignored', 'Expired', - /// 'Blocked', 'Success' - /// 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). Possible values include: - /// '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. - public RecommendedIndex(string id = default(string), string name = default(string), string type = default(string), RecommendedIndexAction? action = default(RecommendedIndexAction?), RecommendedIndexState? state = default(RecommendedIndexState?), System.DateTime? created = default(System.DateTime?), System.DateTime? lastModified = default(System.DateTime?), RecommendedIndexType? indexType = default(RecommendedIndexType?), string schema = default(string), string table = default(string), IList columns = default(IList), IList includedColumns = default(IList), string indexScript = default(string), IList estimatedImpact = default(IList), IList reportedImpact = default(IList)) - : 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; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the proposed index action. You can create a missing index, - /// drop an unused index, or rebuild an existing index to improve its - /// performance. Possible values include: 'Create', 'Drop', 'Rebuild' - /// - [JsonProperty(PropertyName = "properties.action")] - public RecommendedIndexAction? Action { get; private set; } - - /// - /// Gets the current recommendation state. Possible values include: - /// 'Active', 'Pending', 'Executing', 'Verifying', 'Pending Revert', - /// 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' - /// - [JsonProperty(PropertyName = "properties.state")] - public RecommendedIndexState? State { get; private set; } - - /// - /// Gets the UTC datetime showing when this resource was created - /// (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.created")] - public System.DateTime? Created { get; private set; } - - /// - /// Gets the UTC datetime of when was this resource last changed - /// (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.lastModified")] - public System.DateTime? LastModified { get; private set; } - - /// - /// Gets the type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, - /// CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', - /// 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE' - /// - [JsonProperty(PropertyName = "properties.indexType")] - public RecommendedIndexType? IndexType { get; private set; } - - /// - /// Gets the schema where table to build index over resides - /// - [JsonProperty(PropertyName = "properties.schema")] - public string Schema { get; private set; } - - /// - /// Gets the table on which to build index. - /// - [JsonProperty(PropertyName = "properties.table")] - public string Table { get; private set; } - - /// - /// Gets columns over which to build index - /// - [JsonProperty(PropertyName = "properties.columns")] - public IList Columns { get; private set; } - - /// - /// Gets the list of column names to be included in the index - /// - [JsonProperty(PropertyName = "properties.includedColumns")] - public IList IncludedColumns { get; private set; } - - /// - /// Gets the full build index script - /// - [JsonProperty(PropertyName = "properties.indexScript")] - public string IndexScript { get; private set; } - - /// - /// Gets the estimated impact of doing recommended index action. - /// - [JsonProperty(PropertyName = "properties.estimatedImpact")] - public IList EstimatedImpact { get; private set; } - - /// - /// Gets the values reported after index action is complete. - /// - [JsonProperty(PropertyName = "properties.reportedImpact")] - public IList ReportedImpact { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexAction.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexAction.cs deleted file mode 100644 index f9f90228c0981..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexAction.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for RecommendedIndexAction. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RecommendedIndexAction - { - [EnumMember(Value = "Create")] - Create, - [EnumMember(Value = "Drop")] - Drop, - [EnumMember(Value = "Rebuild")] - Rebuild - } - internal static class RecommendedIndexActionEnumExtension - { - internal static string ToSerializedValue(this RecommendedIndexAction? value) - { - return value == null ? null : ((RecommendedIndexAction)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this RecommendedIndexAction value) - { - switch( value ) - { - case RecommendedIndexAction.Create: - return "Create"; - case RecommendedIndexAction.Drop: - return "Drop"; - case RecommendedIndexAction.Rebuild: - return "Rebuild"; - } - return null; - } - - internal static RecommendedIndexAction? ParseRecommendedIndexAction(this string value) - { - switch( value ) - { - case "Create": - return RecommendedIndexAction.Create; - case "Drop": - return RecommendedIndexAction.Drop; - case "Rebuild": - return RecommendedIndexAction.Rebuild; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexState.cs deleted file mode 100644 index 528724aa23578..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexState.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for RecommendedIndexState. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RecommendedIndexState - { - [EnumMember(Value = "Active")] - Active, - [EnumMember(Value = "Pending")] - Pending, - [EnumMember(Value = "Executing")] - Executing, - [EnumMember(Value = "Verifying")] - Verifying, - [EnumMember(Value = "Pending Revert")] - PendingRevert, - [EnumMember(Value = "Reverting")] - Reverting, - [EnumMember(Value = "Reverted")] - Reverted, - [EnumMember(Value = "Ignored")] - Ignored, - [EnumMember(Value = "Expired")] - Expired, - [EnumMember(Value = "Blocked")] - Blocked, - [EnumMember(Value = "Success")] - Success - } - internal static class RecommendedIndexStateEnumExtension - { - internal static string ToSerializedValue(this RecommendedIndexState? value) - { - return value == null ? null : ((RecommendedIndexState)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this RecommendedIndexState value) - { - switch( value ) - { - case RecommendedIndexState.Active: - return "Active"; - case RecommendedIndexState.Pending: - return "Pending"; - case RecommendedIndexState.Executing: - return "Executing"; - case RecommendedIndexState.Verifying: - return "Verifying"; - case RecommendedIndexState.PendingRevert: - return "Pending Revert"; - case RecommendedIndexState.Reverting: - return "Reverting"; - case RecommendedIndexState.Reverted: - return "Reverted"; - case RecommendedIndexState.Ignored: - return "Ignored"; - case RecommendedIndexState.Expired: - return "Expired"; - case RecommendedIndexState.Blocked: - return "Blocked"; - case RecommendedIndexState.Success: - return "Success"; - } - return null; - } - - internal static RecommendedIndexState? ParseRecommendedIndexState(this string value) - { - switch( value ) - { - case "Active": - return RecommendedIndexState.Active; - case "Pending": - return RecommendedIndexState.Pending; - case "Executing": - return RecommendedIndexState.Executing; - case "Verifying": - return RecommendedIndexState.Verifying; - case "Pending Revert": - return RecommendedIndexState.PendingRevert; - case "Reverting": - return RecommendedIndexState.Reverting; - case "Reverted": - return RecommendedIndexState.Reverted; - case "Ignored": - return RecommendedIndexState.Ignored; - case "Expired": - return RecommendedIndexState.Expired; - case "Blocked": - return RecommendedIndexState.Blocked; - case "Success": - return RecommendedIndexState.Success; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexType.cs deleted file mode 100644 index a84c416068ec3..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedIndexType.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for RecommendedIndexType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RecommendedIndexType - { - [EnumMember(Value = "CLUSTERED")] - CLUSTERED, - [EnumMember(Value = "NONCLUSTERED")] - NONCLUSTERED, - [EnumMember(Value = "COLUMNSTORE")] - COLUMNSTORE, - [EnumMember(Value = "CLUSTERED COLUMNSTORE")] - CLUSTEREDCOLUMNSTORE - } - internal static class RecommendedIndexTypeEnumExtension - { - internal static string ToSerializedValue(this RecommendedIndexType? value) - { - return value == null ? null : ((RecommendedIndexType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this RecommendedIndexType value) - { - switch( value ) - { - case RecommendedIndexType.CLUSTERED: - return "CLUSTERED"; - case RecommendedIndexType.NONCLUSTERED: - return "NONCLUSTERED"; - case RecommendedIndexType.COLUMNSTORE: - return "COLUMNSTORE"; - case RecommendedIndexType.CLUSTEREDCOLUMNSTORE: - return "CLUSTERED COLUMNSTORE"; - } - return null; - } - - internal static RecommendedIndexType? ParseRecommendedIndexType(this string value) - { - switch( value ) - { - case "CLUSTERED": - return RecommendedIndexType.CLUSTERED; - case "NONCLUSTERED": - return RecommendedIndexType.NONCLUSTERED; - case "COLUMNSTORE": - return RecommendedIndexType.COLUMNSTORE; - case "CLUSTERED COLUMNSTORE": - return RecommendedIndexType.CLUSTEREDCOLUMNSTORE; - } - return null; - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs new file mode 100644 index 0000000000000..aabd6bd617a2f --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdate.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A recommended sensitivity label update operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class RecommendedSensitivityLabelUpdate : ProxyResource + { + /// + /// Initializes a new instance of the RecommendedSensitivityLabelUpdate + /// class. + /// + public RecommendedSensitivityLabelUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecommendedSensitivityLabelUpdate + /// class. + /// + /// Possible values include: 'enable', + /// 'disable' + /// Schema name of the column to update. + /// Table name of the column to update. + /// Column name to update. + /// Resource ID. + /// Resource name. + /// Resource type. + public RecommendedSensitivityLabelUpdate(RecommendedSensitivityLabelUpdateKind op, string schema, string table, string column, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + Op = op; + Schema = schema; + Table = table; + Column = column; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'enable', 'disable' + /// + [JsonProperty(PropertyName = "properties.op")] + public RecommendedSensitivityLabelUpdateKind Op { get; set; } + + /// + /// Gets or sets schema name of the column to update. + /// + [JsonProperty(PropertyName = "properties.schema")] + public string Schema { get; set; } + + /// + /// Gets or sets table name of the column to update. + /// + [JsonProperty(PropertyName = "properties.table")] + public string Table { get; set; } + + /// + /// Gets or sets column name to update. + /// + [JsonProperty(PropertyName = "properties.column")] + public string Column { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Schema == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Schema"); + } + if (Table == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Table"); + } + if (Column == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Column"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs new file mode 100644 index 0000000000000..37527d6b87062 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateKind.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RecommendedSensitivityLabelUpdateKind. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecommendedSensitivityLabelUpdateKind + { + [EnumMember(Value = "enable")] + Enable, + [EnumMember(Value = "disable")] + Disable + } + internal static class RecommendedSensitivityLabelUpdateKindEnumExtension + { + internal static string ToSerializedValue(this RecommendedSensitivityLabelUpdateKind? value) + { + return value == null ? null : ((RecommendedSensitivityLabelUpdateKind)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RecommendedSensitivityLabelUpdateKind value) + { + switch( value ) + { + case RecommendedSensitivityLabelUpdateKind.Enable: + return "enable"; + case RecommendedSensitivityLabelUpdateKind.Disable: + return "disable"; + } + return null; + } + + internal static RecommendedSensitivityLabelUpdateKind? ParseRecommendedSensitivityLabelUpdateKind(this string value) + { + switch( value ) + { + case "enable": + return RecommendedSensitivityLabelUpdateKind.Enable; + case "disable": + return RecommendedSensitivityLabelUpdateKind.Disable; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs new file mode 100644 index 0000000000000..cabe652110eb7 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RecommendedSensitivityLabelUpdateList.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of recommended sensitivity label update operations. + /// + public partial class RecommendedSensitivityLabelUpdateList + { + /// + /// Initializes a new instance of the + /// RecommendedSensitivityLabelUpdateList class. + /// + public RecommendedSensitivityLabelUpdateList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RecommendedSensitivityLabelUpdateList class. + /// + public RecommendedSensitivityLabelUpdateList(IList operations = default(IList)) + { + Operations = operations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "operations")] + public IList Operations { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentityWithUserAssignedIdentities.cs similarity index 66% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentity.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentityWithUserAssignedIdentities.cs index 2e1034bc6ebb5..6df0be98d2ba5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentity.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceIdentityWithUserAssignedIdentities.cs @@ -11,24 +11,30 @@ namespace Microsoft.Azure.Management.Sql.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// /// Azure Active Directory identity configuration for a resource. /// - public partial class ResourceIdentity + public partial class ResourceIdentityWithUserAssignedIdentities { /// - /// Initializes a new instance of the ResourceIdentity class. + /// Initializes a new instance of the + /// ResourceIdentityWithUserAssignedIdentities class. /// - public ResourceIdentity() + public ResourceIdentityWithUserAssignedIdentities() { CustomInit(); } /// - /// Initializes a new instance of the ResourceIdentity class. + /// Initializes a new instance of the + /// ResourceIdentityWithUserAssignedIdentities class. /// + /// The resource ids of the user + /// assigned identities to use /// The Azure Active Directory principal /// id. /// The identity type. Set this to 'SystemAssigned' @@ -37,8 +43,9 @@ public ResourceIdentity() /// 'None', 'SystemAssigned', 'UserAssigned' /// The Azure Active Directory tenant /// id. - public ResourceIdentity(System.Guid? principalId = default(System.Guid?), string type = default(string), System.Guid? tenantId = default(System.Guid?)) + public ResourceIdentityWithUserAssignedIdentities(IDictionary userAssignedIdentities = default(IDictionary), System.Guid? principalId = default(System.Guid?), string type = default(string), System.Guid? tenantId = default(System.Guid?)) { + UserAssignedIdentities = userAssignedIdentities; PrincipalId = principalId; Type = type; TenantId = tenantId; @@ -50,6 +57,13 @@ public ResourceIdentity() /// partial void CustomInit(); + /// + /// Gets or sets the resource ids of the user assigned identities to + /// use + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + /// /// Gets the Azure Active Directory principal id. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceWithWritableName.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceWithWritableName.cs new file mode 100644 index 0000000000000..7b89bf85ef92b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ResourceWithWritableName.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ARM resource. + /// + public partial class ResourceWithWritableName : IResource + { + /// + /// Initializes a new instance of the ResourceWithWritableName class. + /// + public ResourceWithWritableName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceWithWritableName class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + public ResourceWithWritableName(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs index 58e9491e62c7a..e7d0890219d8e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/RestorableDroppedDatabase.cs @@ -13,10 +13,12 @@ namespace Microsoft.Azure.Management.Sql.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// A restorable dropped database + /// A restorable dropped database resource. /// [Rest.Serialization.JsonTransformation] public partial class RestorableDroppedDatabase : ProxyResource @@ -35,31 +37,29 @@ public RestorableDroppedDatabase() /// Resource ID. /// Resource name. /// Resource type. - /// The geo-location where the resource - /// lives - /// 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 name and tier of the SKU. + /// Resource location. + /// Resource tags. + /// The name of the database. + /// The max size of the database expressed + /// in bytes. + /// The resource name of the elastic pool + /// containing this database. /// The creation date of the database - /// (ISO8601 format) + /// (ISO8601 format). /// The deletion date of the database - /// (ISO8601 format) + /// (ISO8601 format). /// The earliest restore date of the - /// database (ISO8601 format) - public RestorableDroppedDatabase(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string databaseName = default(string), string edition = default(string), string maxSizeBytes = default(string), string serviceLevelObjective = default(string), string elasticPoolName = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? deletionDate = default(System.DateTime?), System.DateTime? earliestRestoreDate = default(System.DateTime?)) + /// database (ISO8601 format). + public RestorableDroppedDatabase(string id = default(string), string name = default(string), string type = default(string), Sku sku = default(Sku), string location = default(string), IDictionary tags = default(IDictionary), string databaseName = default(string), long? maxSizeBytes = default(long?), string elasticPoolId = default(string), System.DateTime? creationDate = default(System.DateTime?), System.DateTime? deletionDate = default(System.DateTime?), System.DateTime? earliestRestoreDate = default(System.DateTime?)) : base(id, name, type) { + Sku = sku; Location = location; + Tags = tags; DatabaseName = databaseName; - Edition = edition; MaxSizeBytes = maxSizeBytes; - ServiceLevelObjective = serviceLevelObjective; - ElasticPoolName = elasticPoolName; + ElasticPoolId = elasticPoolId; CreationDate = creationDate; DeletionDate = deletionDate; EarliestRestoreDate = earliestRestoreDate; @@ -72,58 +72,72 @@ public RestorableDroppedDatabase() partial void CustomInit(); /// - /// Gets the geo-location where the resource lives + /// Gets or sets the name and tier of the SKU. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } /// - /// Gets the name of the database + /// Gets or sets resource location. /// - [JsonProperty(PropertyName = "properties.databaseName")] - public string DatabaseName { get; private set; } + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } /// - /// Gets the edition of the database + /// Gets or sets resource tags. /// - [JsonProperty(PropertyName = "properties.edition")] - public string Edition { get; private set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } /// - /// Gets the max size in bytes of the database + /// Gets the name of the database. /// - [JsonProperty(PropertyName = "properties.maxSizeBytes")] - public string MaxSizeBytes { get; private set; } + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; private set; } /// - /// Gets the service level objective name of the database + /// Gets the max size of the database expressed in bytes. /// - [JsonProperty(PropertyName = "properties.serviceLevelObjective")] - public string ServiceLevelObjective { get; private set; } + [JsonProperty(PropertyName = "properties.maxSizeBytes")] + public long? MaxSizeBytes { get; private set; } /// - /// Gets the elastic pool name of the database + /// Gets the resource name of the elastic pool containing this + /// database. /// - [JsonProperty(PropertyName = "properties.elasticPoolName")] - public string ElasticPoolName { get; private set; } + [JsonProperty(PropertyName = "properties.elasticPoolId")] + public string ElasticPoolId { get; private set; } /// - /// Gets the creation date of the database (ISO8601 format) + /// Gets the creation date of the database (ISO8601 format). /// [JsonProperty(PropertyName = "properties.creationDate")] public System.DateTime? CreationDate { get; private set; } /// - /// Gets the deletion date of the database (ISO8601 format) + /// Gets the deletion date of the database (ISO8601 format). /// [JsonProperty(PropertyName = "properties.deletionDate")] public System.DateTime? DeletionDate { get; private set; } /// - /// Gets the earliest restore date of the database (ISO8601 format) + /// Gets the earliest restore date of the database (ISO8601 format). /// [JsonProperty(PropertyName = "properties.earliestRestoreDate")] public System.DateTime? EarliestRestoreDate { get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs similarity index 62% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs index f825a9f752493..9fd3e2742b7a6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyUseServerDefault.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertsPolicyState.cs @@ -16,43 +16,43 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Runtime.Serialization; /// - /// Defines values for SecurityAlertPolicyUseServerDefault. + /// Defines values for SecurityAlertsPolicyState. /// [JsonConverter(typeof(StringEnumConverter))] - public enum SecurityAlertPolicyUseServerDefault + public enum SecurityAlertsPolicyState { [EnumMember(Value = "Enabled")] Enabled, [EnumMember(Value = "Disabled")] Disabled } - internal static class SecurityAlertPolicyUseServerDefaultEnumExtension + internal static class SecurityAlertsPolicyStateEnumExtension { - internal static string ToSerializedValue(this SecurityAlertPolicyUseServerDefault? value) + internal static string ToSerializedValue(this SecurityAlertsPolicyState? value) { - return value == null ? null : ((SecurityAlertPolicyUseServerDefault)value).ToSerializedValue(); + return value == null ? null : ((SecurityAlertsPolicyState)value).ToSerializedValue(); } - internal static string ToSerializedValue(this SecurityAlertPolicyUseServerDefault value) + internal static string ToSerializedValue(this SecurityAlertsPolicyState value) { switch( value ) { - case SecurityAlertPolicyUseServerDefault.Enabled: + case SecurityAlertsPolicyState.Enabled: return "Enabled"; - case SecurityAlertPolicyUseServerDefault.Disabled: + case SecurityAlertsPolicyState.Disabled: return "Disabled"; } return null; } - internal static SecurityAlertPolicyUseServerDefault? ParseSecurityAlertPolicyUseServerDefault(this string value) + internal static SecurityAlertsPolicyState? ParseSecurityAlertsPolicyState(this string value) { switch( value ) { case "Enabled": - return SecurityAlertPolicyUseServerDefault.Enabled; + return SecurityAlertsPolicyState.Enabled; case "Disabled": - return SecurityAlertPolicyUseServerDefault.Disabled; + return SecurityAlertsPolicyState.Disabled; } return null; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEvent.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEvent.cs new file mode 100644 index 0000000000000..798243420bda0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEvent.cs @@ -0,0 +1,132 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A security event. + /// + [Rest.Serialization.JsonTransformation] + public partial class SecurityEvent : ProxyResource + { + /// + /// Initializes a new instance of the SecurityEvent class. + /// + public SecurityEvent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityEvent class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The time when the security event + /// occurred. + /// The type of the security event. + /// Possible values include: 'Undefined', 'SqlInjectionVulnerability', + /// 'SqlInjectionExploit' + /// 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. + public SecurityEvent(string id = default(string), string name = default(string), string type = default(string), System.DateTime? eventTime = default(System.DateTime?), SecurityEventType? securityEventType = default(SecurityEventType?), string subscription = default(string), string server = default(string), string database = default(string), string clientIp = default(string), string applicationName = default(string), string principalName = default(string), SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties = default(SecurityEventSqlInjectionAdditionalProperties)) + : base(id, name, type) + { + EventTime = eventTime; + SecurityEventType = securityEventType; + Subscription = subscription; + Server = server; + Database = database; + ClientIp = clientIp; + ApplicationName = applicationName; + PrincipalName = principalName; + SecurityEventSqlInjectionAdditionalProperties = securityEventSqlInjectionAdditionalProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the time when the security event occurred. + /// + [JsonProperty(PropertyName = "properties.eventTime")] + public System.DateTime? EventTime { get; private set; } + + /// + /// Gets the type of the security event. Possible values include: + /// 'Undefined', 'SqlInjectionVulnerability', 'SqlInjectionExploit' + /// + [JsonProperty(PropertyName = "properties.securityEventType")] + public SecurityEventType? SecurityEventType { get; private set; } + + /// + /// Gets the subscription name + /// + [JsonProperty(PropertyName = "properties.subscription")] + public string Subscription { get; private set; } + + /// + /// Gets the server name + /// + [JsonProperty(PropertyName = "properties.server")] + public string Server { get; private set; } + + /// + /// Gets the database name + /// + [JsonProperty(PropertyName = "properties.database")] + public string Database { get; private set; } + + /// + /// Gets the IP address of the client who executed the statement. + /// + [JsonProperty(PropertyName = "properties.clientIp")] + public string ClientIp { get; private set; } + + /// + /// Gets the application used to execute the statement. + /// + [JsonProperty(PropertyName = "properties.applicationName")] + public string ApplicationName { get; private set; } + + /// + /// Gets the principal user who executed the statement + /// + [JsonProperty(PropertyName = "properties.principalName")] + public string PrincipalName { get; private set; } + + /// + /// Gets the sql injection additional properties, populated only if the + /// type of the security event is sql injection. + /// + [JsonProperty(PropertyName = "properties.securityEventSqlInjectionAdditionalProperties")] + public SecurityEventSqlInjectionAdditionalProperties SecurityEventSqlInjectionAdditionalProperties { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs new file mode 100644 index 0000000000000..af9e3fc6ffdc4 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventSqlInjectionAdditionalProperties.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of a security event sql injection additional properties. + /// + public partial class SecurityEventSqlInjectionAdditionalProperties + { + /// + /// Initializes a new instance of the + /// SecurityEventSqlInjectionAdditionalProperties class. + /// + public SecurityEventSqlInjectionAdditionalProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SecurityEventSqlInjectionAdditionalProperties class. + /// + /// 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 + public SecurityEventSqlInjectionAdditionalProperties(string threatId = default(string), string statement = default(string), int? statementHighlightOffset = default(int?), int? statementHighlightLength = default(int?), int? errorCode = default(int?), int? errorSeverity = default(int?), string errorMessage = default(string)) + { + ThreatId = threatId; + Statement = statement; + StatementHighlightOffset = statementHighlightOffset; + StatementHighlightLength = statementHighlightLength; + ErrorCode = errorCode; + ErrorSeverity = errorSeverity; + ErrorMessage = errorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the threat ID. + /// + [JsonProperty(PropertyName = "threatId")] + public string ThreatId { get; private set; } + + /// + /// Gets the statement + /// + [JsonProperty(PropertyName = "statement")] + public string Statement { get; private set; } + + /// + /// Gets the statement highlight offset + /// + [JsonProperty(PropertyName = "statementHighlightOffset")] + public int? StatementHighlightOffset { get; private set; } + + /// + /// Gets the statement highlight length + /// + [JsonProperty(PropertyName = "statementHighlightLength")] + public int? StatementHighlightLength { get; private set; } + + /// + /// Gets the sql error code + /// + [JsonProperty(PropertyName = "errorCode")] + public int? ErrorCode { get; private set; } + + /// + /// Gets the sql error severity + /// + [JsonProperty(PropertyName = "errorSeverity")] + public int? ErrorSeverity { get; private set; } + + /// + /// Gets the sql error message + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventType.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventType.cs new file mode 100644 index 0000000000000..ab86fe79be120 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SecurityEventType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SecurityEventType + { + [EnumMember(Value = "Undefined")] + Undefined, + [EnumMember(Value = "SqlInjectionVulnerability")] + SqlInjectionVulnerability, + [EnumMember(Value = "SqlInjectionExploit")] + SqlInjectionExploit + } + internal static class SecurityEventTypeEnumExtension + { + internal static string ToSerializedValue(this SecurityEventType? value) + { + return value == null ? null : ((SecurityEventType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SecurityEventType value) + { + switch( value ) + { + case SecurityEventType.Undefined: + return "Undefined"; + case SecurityEventType.SqlInjectionVulnerability: + return "SqlInjectionVulnerability"; + case SecurityEventType.SqlInjectionExploit: + return "SqlInjectionExploit"; + } + return null; + } + + internal static SecurityEventType? ParseSecurityEventType(this string value) + { + switch( value ) + { + case "Undefined": + return SecurityEventType.Undefined; + case "SqlInjectionVulnerability": + return SecurityEventType.SqlInjectionVulnerability; + case "SqlInjectionExploit": + return SecurityEventType.SqlInjectionExploit; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs new file mode 100644 index 0000000000000..db623e8499518 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityEventsFilterParameters.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties that are supported in the $filter operation. + /// + public partial class SecurityEventsFilterParameters + { + /// + /// Initializes a new instance of the SecurityEventsFilterParameters + /// class. + /// + public SecurityEventsFilterParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityEventsFilterParameters + /// class. + /// + /// Filter on the event time. + /// Whether to show server records or + /// not. + public SecurityEventsFilterParameters(System.DateTime? eventTime = default(System.DateTime?), bool? showServerRecords = default(bool?)) + { + EventTime = eventTime; + ShowServerRecords = showServerRecords; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets filter on the event time. + /// + [JsonProperty(PropertyName = "eventTime")] + public System.DateTime? EventTime { get; set; } + + /// + /// Gets or sets whether to show server records or not. + /// + [JsonProperty(PropertyName = "showServerRecords")] + public bool? ShowServerRecords { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabel.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabel.cs index 7ca8f24fa5705..1eb4054312c5e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabel.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabel.cs @@ -35,6 +35,11 @@ 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. @@ -45,9 +50,13 @@ public SensitivityLabel() /// (dismissed) or not. /// Possible values include: 'None', 'Low', /// 'Medium', 'High', 'Critical' - public SensitivityLabel(string id = default(string), string name = default(string), string type = default(string), string labelName = default(string), string labelId = default(string), string informationType = default(string), string informationTypeId = default(string), bool? isDisabled = default(bool?), SensitivityLabelRank? rank = default(SensitivityLabelRank?)) + public SensitivityLabel(string id = default(string), string name = default(string), string type = default(string), string managedBy = default(string), string schemaName = default(string), string tableName = default(string), string columnName = default(string), string labelName = default(string), string labelId = default(string), string informationType = default(string), string informationTypeId = default(string), bool? isDisabled = default(bool?), SensitivityLabelRank? rank = default(SensitivityLabelRank?)) : base(id, name, type) { + ManagedBy = managedBy; + SchemaName = schemaName; + TableName = tableName; + ColumnName = columnName; LabelName = labelName; LabelId = labelId; InformationType = informationType; @@ -62,6 +71,30 @@ public SensitivityLabel() /// partial void CustomInit(); + /// + /// Gets resource that manages the sensitivity label. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; private set; } + + /// + /// Gets the schema name. + /// + [JsonProperty(PropertyName = "properties.schemaName")] + public string SchemaName { get; private set; } + + /// + /// Gets the table name. + /// + [JsonProperty(PropertyName = "properties.tableName")] + public string TableName { get; private set; } + + /// + /// Gets the column name. + /// + [JsonProperty(PropertyName = "properties.columnName")] + public string ColumnName { get; private set; } + /// /// Gets or sets the label name. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdate.cs new file mode 100644 index 0000000000000..dd11c8713b59c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdate.cs @@ -0,0 +1,113 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A sensitivity label update operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class SensitivityLabelUpdate : ProxyResource + { + /// + /// Initializes a new instance of the SensitivityLabelUpdate class. + /// + public SensitivityLabelUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SensitivityLabelUpdate class. + /// + /// Possible values include: 'set', 'remove' + /// Schema name of the column to update. + /// Table name of the column to update. + /// Column name to update. + /// Resource ID. + /// Resource name. + /// Resource type. + /// The sensitivity label information to + /// apply on a column. + public SensitivityLabelUpdate(SensitivityLabelUpdateKind op, string schema, string table, string column, string id = default(string), string name = default(string), string type = default(string), SensitivityLabel sensitivityLabel = default(SensitivityLabel)) + : base(id, name, type) + { + Op = op; + Schema = schema; + Table = table; + Column = column; + SensitivityLabel = sensitivityLabel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'set', 'remove' + /// + [JsonProperty(PropertyName = "properties.op")] + public SensitivityLabelUpdateKind Op { get; set; } + + /// + /// Gets or sets schema name of the column to update. + /// + [JsonProperty(PropertyName = "properties.schema")] + public string Schema { get; set; } + + /// + /// Gets or sets table name of the column to update. + /// + [JsonProperty(PropertyName = "properties.table")] + public string Table { get; set; } + + /// + /// Gets or sets column name to update. + /// + [JsonProperty(PropertyName = "properties.column")] + public string Column { get; set; } + + /// + /// Gets or sets the sensitivity label information to apply on a + /// column. + /// + [JsonProperty(PropertyName = "properties.sensitivityLabel")] + public SensitivityLabel SensitivityLabel { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Schema == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Schema"); + } + if (Table == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Table"); + } + if (Column == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Column"); + } + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs new file mode 100644 index 0000000000000..f450732de1278 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateKind.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SensitivityLabelUpdateKind. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SensitivityLabelUpdateKind + { + [EnumMember(Value = "set")] + Set, + [EnumMember(Value = "remove")] + Remove + } + internal static class SensitivityLabelUpdateKindEnumExtension + { + internal static string ToSerializedValue(this SensitivityLabelUpdateKind? value) + { + return value == null ? null : ((SensitivityLabelUpdateKind)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SensitivityLabelUpdateKind value) + { + switch( value ) + { + case SensitivityLabelUpdateKind.Set: + return "set"; + case SensitivityLabelUpdateKind.Remove: + return "remove"; + } + return null; + } + + internal static SensitivityLabelUpdateKind? ParseSensitivityLabelUpdateKind(this string value) + { + switch( value ) + { + case "set": + return SensitivityLabelUpdateKind.Set; + case "remove": + return SensitivityLabelUpdateKind.Remove; + } + return null; + } + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs new file mode 100644 index 0000000000000..ab075881b1e9d --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SensitivityLabelUpdateList.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of sensitivity label update operations. + /// + public partial class SensitivityLabelUpdateList + { + /// + /// Initializes a new instance of the SensitivityLabelUpdateList class. + /// + public SensitivityLabelUpdateList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SensitivityLabelUpdateList class. + /// + public SensitivityLabelUpdateList(IList operations = default(IList)) + { + Operations = operations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "operations")] + public IList Operations { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs index ceb028f78c6fb..bae18e863d943 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/Server.cs @@ -59,7 +59,16 @@ public Server() /// access is allowed for this server. Value is optional but if passed /// in, must be 'Enabled' or 'Disabled'. Possible values include: /// 'Enabled', 'Disabled' - public Server(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), string kind = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string)) + /// Whether or not existing server has a + /// workspace created and if it allows connection from workspace. + /// Possible values include: 'Connected', 'Disconnected' + /// 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 identity of + /// the server. + public Server(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentityWithUserAssignedIdentities identity = default(ResourceIdentityWithUserAssignedIdentities), string kind = default(string), string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string), string workspaceFeature = default(string), string primaryUserAssignedIdentityId = default(string), string keyId = default(string), ServerExternalAdministrator administrators = default(ServerExternalAdministrator)) : base(location, id, name, type, tags) { Identity = identity; @@ -72,6 +81,10 @@ public Server() PrivateEndpointConnections = privateEndpointConnections; MinimalTlsVersion = minimalTlsVersion; PublicNetworkAccess = publicNetworkAccess; + WorkspaceFeature = workspaceFeature; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; CustomInit(); } @@ -84,7 +97,7 @@ public Server() /// Gets or sets the Azure Active Directory identity of the server. /// [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } + public ResourceIdentityWithUserAssignedIdentities Identity { get; set; } /// /// Gets kind of sql server. This is metadata used for the Azure portal @@ -146,6 +159,33 @@ public Server() [JsonProperty(PropertyName = "properties.publicNetworkAccess")] public string PublicNetworkAccess { get; set; } + /// + /// Gets whether or not existing server has a workspace created and if + /// it allows connection from workspace. Possible values include: + /// 'Connected', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.workspaceFeature")] + public string WorkspaceFeature { get; private set; } + + /// + /// Gets or sets the resource id of a user assigned identity to be used + /// by default. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentityId")] + public string PrimaryUserAssignedIdentityId { get; set; } + + /// + /// Gets or sets a CMK URI of the key to use for encryption. + /// + [JsonProperty(PropertyName = "properties.keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets the Azure Active Directory identity of the server. + /// + [JsonProperty(PropertyName = "properties.administrators")] + public ServerExternalAdministrator Administrators { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs index ff252b229b698..5b3f8efae4062 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerBlobAuditingPolicy.cs @@ -34,30 +34,32 @@ public ServerBlobAuditingPolicy() /// /// Initializes a new instance of the ServerBlobAuditingPolicy class. /// - /// Specifies the state of the policy. If state is + /// Specifies the state of the audit. If state is /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are /// required. Possible values include: 'Enabled', 'Disabled' /// Resource ID. /// Resource name. /// Resource type. - /// 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 state of devops + /// audit. If state is Enabled, devops logs will be sent to Azure + /// Monitor. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + /// 'IsDevopsAuditEnabled' as true + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'DevOpsOperationsAudit' diagnostic logs category on the master + /// database should also be created. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// /// Specifies the number of days to keep in /// the audit logs in the storage account. /// Specifies the Actions-Groups @@ -134,15 +136,13 @@ 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. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -164,18 +164,39 @@ public ServerBlobAuditingPolicy() /// processed. /// The default minimum value is 1000 (1 second). The maximum is /// 2,147,483,647. - public ServerBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), System.Guid? storageAccountSubscriptionId = default(System.Guid?), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?)) + /// 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. + public ServerBlobAuditingPolicy(BlobAuditingPolicyState state, string id = default(string), string name = default(string), string type = default(string), bool? isDevopsAuditEnabled = default(bool?), int? retentionDays = default(int?), IList auditActionsAndGroups = default(IList), bool? isStorageSecondaryKeyInUse = default(bool?), bool? isAzureMonitorTargetEnabled = default(bool?), int? queueDelayMs = default(int?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), System.Guid? storageAccountSubscriptionId = default(System.Guid?)) : 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; CustomInit(); } @@ -185,39 +206,28 @@ public ServerBlobAuditingPolicy() partial void CustomInit(); /// - /// Gets or sets specifies the state of the policy. If state is - /// Enabled, storageEndpoint or isAzureMonitorTargetEnabled are - /// required. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public BlobAuditingPolicyState State { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). If state is Enabled, - /// storageEndpoint or isAzureMonitorTargetEnabled is required. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets 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) + /// Gets or sets specifies the state of devops audit. If state is + /// Enabled, devops logs will be sent to Azure Monitor. + /// In order to send the events to Azure Monitor, specify 'State' as + /// 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + /// 'IsDevopsAuditEnabled' as true + /// + /// When using REST API to configure auditing, Diagnostic Settings with + /// 'DevOpsOperationsAudit' diagnostic logs category on the master + /// database should also be created. + /// + /// Diagnostic Settings URI format: + /// PUT + /// https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + /// + /// For more information, see [Diagnostic Settings REST + /// API](https://go.microsoft.com/fwlink/?linkid=2033207) + /// or [Diagnostic Settings + /// PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + /// /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } + [JsonProperty(PropertyName = "properties.isDevopsAuditEnabled")] + public bool? IsDevopsAuditEnabled { get; set; } /// /// Gets or sets specifies the number of days to keep in the audit logs @@ -305,12 +315,6 @@ public ServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.auditActionsAndGroups")] public IList AuditActionsAndGroups { get; set; } - /// - /// Gets or sets specifies the blob storage subscription Id. - /// - [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] - public System.Guid? StorageAccountSubscriptionId { get; set; } - /// /// Gets or sets specifies whether storageAccountAccessKey value is the /// storage's secondary key. @@ -321,8 +325,8 @@ public ServerBlobAuditingPolicy() /// /// Gets or sets 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. /// /// When using REST API to configure auditing, Diagnostic Settings with /// 'SQLSecurityAuditEvents' diagnostic logs category on the database @@ -352,6 +356,47 @@ public ServerBlobAuditingPolicy() [JsonProperty(PropertyName = "properties.queueDelayMs")] public int? QueueDelayMs { get; set; } + /// + /// Gets or sets specifies the state of the audit. If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled are required. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public BlobAuditingPolicyState State { get; set; } + + /// + /// Gets or sets specifies the blob storage endpoint (e.g. + /// https://MyAccount.blob.core.windows.net). If state is Enabled, + /// storageEndpoint or isAzureMonitorTargetEnabled is required. + /// + [JsonProperty(PropertyName = "properties.storageEndpoint")] + public string StorageEndpoint { get; set; } + + /// + /// Gets or sets specifies the identifier key of the auditing storage + /// account. + /// If state is Enabled and storageEndpoint is specified, not + /// specifying the storageAccountAccessKey will use SQL server + /// system-assigned managed identity to access the storage. + /// Prerequisites for using managed identity authentication: + /// 1. Assign SQL Server a system-assigned managed identity in Azure + /// Active Directory (AAD). + /// 2. Grant SQL Server identity access to the storage account by + /// adding 'Storage Blob Data Contributor' RBAC role to the server + /// identity. + /// For more information, see [Auditing to storage using Managed + /// Identity + /// authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + /// + [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] + public string StorageAccountAccessKey { get; set; } + + /// + /// Gets or sets specifies the blob storage subscription Id. + /// + [JsonProperty(PropertyName = "properties.storageAccountSubscriptionId")] + public System.Guid? StorageAccountSubscriptionId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs index 4b63f09d11e26..3ed770d4b0b2c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerDnsAliasAcquisition.cs @@ -10,11 +10,12 @@ namespace Microsoft.Azure.Management.Sql.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// - /// A server DNS alias acquisition request. + /// A server dns alias acquisition request. /// public partial class ServerDnsAliasAcquisition { @@ -31,7 +32,7 @@ public ServerDnsAliasAcquisition() /// /// The id of the server alias that /// will be acquired to point to this server instead. - public ServerDnsAliasAcquisition(string oldServerDnsAliasId = default(string)) + public ServerDnsAliasAcquisition(string oldServerDnsAliasId) { OldServerDnsAliasId = oldServerDnsAliasId; CustomInit(); @@ -49,5 +50,18 @@ public ServerDnsAliasAcquisition() [JsonProperty(PropertyName = "oldServerDnsAliasId")] public string OldServerDnsAliasId { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OldServerDnsAliasId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OldServerDnsAliasId"); + } + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerExternalAdministrator.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerExternalAdministrator.cs new file mode 100644 index 0000000000000..8c8c94543a632 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerExternalAdministrator.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a active directory administrator. + /// + public partial class ServerExternalAdministrator + { + /// + /// Initializes a new instance of the ServerExternalAdministrator + /// class. + /// + public ServerExternalAdministrator() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerExternalAdministrator + /// class. + /// + /// Type of the sever administrator. + /// Possible values include: 'ActiveDirectory' + /// Principal Type of the sever + /// administrator. Possible values include: 'User', 'Group', + /// 'Application' + /// Login name of the server administrator. + /// SID (object ID) of the server + /// administrator. + /// Tenant ID of the administrator. + /// Azure Active Directory only + /// Authentication enabled. + public ServerExternalAdministrator(string administratorType = default(string), string principalType = default(string), string login = default(string), System.Guid? sid = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), bool? azureADOnlyAuthentication = default(bool?)) + { + AdministratorType = administratorType; + PrincipalType = principalType; + Login = login; + Sid = sid; + TenantId = tenantId; + AzureADOnlyAuthentication = azureADOnlyAuthentication; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the sever administrator. Possible values + /// include: 'ActiveDirectory' + /// + [JsonProperty(PropertyName = "administratorType")] + public string AdministratorType { get; set; } + + /// + /// Gets or sets principal Type of the sever administrator. Possible + /// values include: 'User', 'Group', 'Application' + /// + [JsonProperty(PropertyName = "principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets or sets login name of the server administrator. + /// + [JsonProperty(PropertyName = "login")] + public string Login { get; set; } + + /// + /// Gets or sets SID (object ID) of the server administrator. + /// + [JsonProperty(PropertyName = "sid")] + public System.Guid? Sid { get; set; } + + /// + /// Gets or sets tenant ID of the administrator. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; set; } + + /// + /// Gets or sets azure Active Directory only Authentication enabled. + /// + [JsonProperty(PropertyName = "azureADOnlyAuthentication")] + public bool? AzureADOnlyAuthentication { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerKey.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerKey.cs index 75567c92ac7e8..d343d862e29f9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerKey.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerKey.cs @@ -42,10 +42,13 @@ public ServerKey() /// used for the Azure portal experience. /// Resource location. /// Subregion of the server key. - /// 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. - public ServerKey(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string subregion = default(string), string uri = default(string), string thumbprint = default(string), System.DateTime? creationDate = default(System.DateTime?)) + /// Key auto rotation opt-in flag. + /// Either true or false. + public ServerKey(string serverKeyType, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), string subregion = default(string), string uri = default(string), string thumbprint = default(string), System.DateTime? creationDate = default(System.DateTime?), bool? autoRotationEnabled = default(bool?)) : base(id, name, type) { Kind = kind; @@ -55,6 +58,7 @@ public ServerKey() Uri = uri; Thumbprint = thumbprint; CreationDate = creationDate; + AutoRotationEnabled = autoRotationEnabled; CustomInit(); } @@ -64,11 +68,11 @@ public ServerKey() partial void CustomInit(); /// - /// Gets or sets kind of encryption protector. This is metadata used - /// for the Azure portal experience. + /// Gets kind of encryption protector. This is metadata used for the + /// Azure portal experience. /// [JsonProperty(PropertyName = "kind")] - public string Kind { get; set; } + public string Kind { get; private set; } /// /// Gets resource location. @@ -91,22 +95,29 @@ public ServerKey() public string ServerKeyType { get; set; } /// - /// Gets or sets the URI of the server key. + /// Gets or sets the URI of the server key. If the ServerKeyType is + /// AzureKeyVault, then the URI is required. /// [JsonProperty(PropertyName = "properties.uri")] public string Uri { get; set; } /// - /// Gets or sets thumbprint of the server key. + /// Gets thumbprint of the server key. /// [JsonProperty(PropertyName = "properties.thumbprint")] - public string Thumbprint { get; set; } + public string Thumbprint { get; private set; } /// - /// Gets or sets the server key creation date. + /// Gets the server key creation date. /// [JsonProperty(PropertyName = "properties.creationDate")] - public System.DateTime? CreationDate { get; set; } + public System.DateTime? CreationDate { get; private set; } + + /// + /// Gets key auto rotation opt-in flag. Either true or false. + /// + [JsonProperty(PropertyName = "properties.autoRotationEnabled")] + public bool? AutoRotationEnabled { get; private set; } /// /// Validate the object. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerOperation.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerOperation.cs new file mode 100644 index 0000000000000..fe17244072e8c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerOperation.cs @@ -0,0 +1,164 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A server operation. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServerOperation : ProxyResource + { + /// + /// Initializes a new instance of the ServerOperation class. + /// + public ServerOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerOperation class. + /// + /// 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. Possible values include: + /// 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', + /// 'Cancelled' + /// 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. + public ServerOperation(string id = default(string), string name = default(string), string type = default(string), string operation = default(string), string operationFriendlyName = default(string), int? percentComplete = default(int?), string serverName = default(string), System.DateTime? startTime = default(System.DateTime?), string state = default(string), int? errorCode = default(int?), string errorDescription = default(string), int? errorSeverity = default(int?), bool? isUserError = default(bool?), System.DateTime? estimatedCompletionTime = default(System.DateTime?), string description = default(string), bool? isCancellable = default(bool?)) + : 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; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of operation. + /// + [JsonProperty(PropertyName = "properties.operation")] + public string Operation { get; private set; } + + /// + /// Gets the friendly name of operation. + /// + [JsonProperty(PropertyName = "properties.operationFriendlyName")] + public string OperationFriendlyName { get; private set; } + + /// + /// Gets the percentage of the operation completed. + /// + [JsonProperty(PropertyName = "properties.percentComplete")] + public int? PercentComplete { get; private set; } + + /// + /// Gets the name of the server. + /// + [JsonProperty(PropertyName = "properties.serverName")] + public string ServerName { get; private set; } + + /// + /// Gets the operation start time. + /// + [JsonProperty(PropertyName = "properties.startTime")] + public System.DateTime? StartTime { get; private set; } + + /// + /// Gets the operation state. Possible values include: 'Pending', + /// 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', + /// 'Cancelled' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets the operation error code. + /// + [JsonProperty(PropertyName = "properties.errorCode")] + public int? ErrorCode { get; private set; } + + /// + /// Gets the operation error description. + /// + [JsonProperty(PropertyName = "properties.errorDescription")] + public string ErrorDescription { get; private set; } + + /// + /// Gets the operation error severity. + /// + [JsonProperty(PropertyName = "properties.errorSeverity")] + public int? ErrorSeverity { get; private set; } + + /// + /// Gets whether or not the error is a user error. + /// + [JsonProperty(PropertyName = "properties.isUserError")] + public bool? IsUserError { get; private set; } + + /// + /// Gets the estimated completion time of the operation. + /// + [JsonProperty(PropertyName = "properties.estimatedCompletionTime")] + public System.DateTime? EstimatedCompletionTime { get; private set; } + + /// + /// Gets the operation description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets whether the operation can be cancelled. + /// + [JsonProperty(PropertyName = "properties.isCancellable")] + public bool? IsCancellable { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs index c931ffdac9c77..f9a14d06a6465 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerSecurityAlertPolicy.cs @@ -36,15 +36,17 @@ public ServerSecurityAlertPolicy() /// /// Specifies the state of the policy, whether it /// is enabled or disabled or a policy has not been applied yet on the - /// specific database. Possible values include: 'New', 'Enabled', + /// specific database. Possible values include: 'Enabled', /// 'Disabled' /// Resource ID. /// Resource name. /// Resource type. + /// SystemData of + /// SecurityAlertPolicyResource. /// Specifies an array of alerts that are /// disabled. Allowed values are: Sql_Injection, /// Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, - /// Unsafe_Action + /// Unsafe_Action, Brute_Force /// Specifies an array of e-mail addresses /// to which the alert is sent. /// Specifies that the alert is sent @@ -58,9 +60,10 @@ public ServerSecurityAlertPolicy() /// the Threat Detection audit logs. /// Specifies the UTC creation time of the /// policy. - public ServerSecurityAlertPolicy(SecurityAlertPolicyState state, string id = default(string), string name = default(string), string type = default(string), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) + public ServerSecurityAlertPolicy(SecurityAlertsPolicyState state, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?), System.DateTime? creationTime = default(System.DateTime?)) : base(id, name, type) { + SystemData = systemData; State = state; DisabledAlerts = disabledAlerts; EmailAddresses = emailAddresses; @@ -77,19 +80,24 @@ public ServerSecurityAlertPolicy() /// partial void CustomInit(); + /// + /// Gets systemData of SecurityAlertPolicyResource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + /// /// Gets or sets specifies the state of the policy, whether it is /// enabled or disabled or a policy has not been applied yet on the - /// specific database. Possible values include: 'New', 'Enabled', - /// 'Disabled' + /// specific database. Possible values include: 'Enabled', 'Disabled' /// [JsonProperty(PropertyName = "properties.state")] - public SecurityAlertPolicyState State { get; set; } + public SecurityAlertsPolicyState State { get; set; } /// /// Gets or sets specifies an array of alerts that are disabled. /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - /// Access_Anomaly, Data_Exfiltration, Unsafe_Action + /// Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force /// [JsonProperty(PropertyName = "properties.disabledAlerts")] public IList DisabledAlerts { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs index cd86344ea902f..8fd3609112beb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerUpdate.cs @@ -34,6 +34,7 @@ public ServerUpdate() /// /// Initializes a new instance of the ServerUpdate class. /// + /// Server identity /// Administrator username for the /// server. Once created it cannot be changed. /// The administrator login @@ -50,9 +51,19 @@ public ServerUpdate() /// access is allowed for this server. Value is optional but if passed /// in, must be 'Enabled' or 'Disabled'. Possible values include: /// 'Enabled', 'Disabled' + /// Whether or not existing server has a + /// workspace created and if it allows connection from workspace. + /// Possible values include: 'Connected', 'Disconnected' + /// 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 identity of + /// the server. /// Resource tags. - public ServerUpdate(string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string), IDictionary tags = default(IDictionary)) + public ServerUpdate(ResourceIdentityWithUserAssignedIdentities identity = default(ResourceIdentityWithUserAssignedIdentities), string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), IList privateEndpointConnections = default(IList), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string), string workspaceFeature = default(string), string primaryUserAssignedIdentityId = default(string), string keyId = default(string), ServerExternalAdministrator administrators = default(ServerExternalAdministrator), IDictionary tags = default(IDictionary)) { + Identity = identity; AdministratorLogin = administratorLogin; AdministratorLoginPassword = administratorLoginPassword; Version = version; @@ -61,6 +72,10 @@ public ServerUpdate() PrivateEndpointConnections = privateEndpointConnections; MinimalTlsVersion = minimalTlsVersion; PublicNetworkAccess = publicNetworkAccess; + WorkspaceFeature = workspaceFeature; + PrimaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + KeyId = keyId; + Administrators = administrators; Tags = tags; CustomInit(); } @@ -70,6 +85,12 @@ public ServerUpdate() /// partial void CustomInit(); + /// + /// Gets or sets server identity + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentityWithUserAssignedIdentities Identity { get; set; } + /// /// Gets or sets administrator username for the server. Once created it /// cannot be changed. @@ -123,6 +144,33 @@ public ServerUpdate() [JsonProperty(PropertyName = "properties.publicNetworkAccess")] public string PublicNetworkAccess { get; set; } + /// + /// Gets whether or not existing server has a workspace created and if + /// it allows connection from workspace. Possible values include: + /// 'Connected', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.workspaceFeature")] + public string WorkspaceFeature { get; private set; } + + /// + /// Gets or sets the resource id of a user assigned identity to be used + /// by default. + /// + [JsonProperty(PropertyName = "properties.primaryUserAssignedIdentityId")] + public string PrimaryUserAssignedIdentityId { get; set; } + + /// + /// Gets or sets a CMK URI of the key to use for encryption. + /// + [JsonProperty(PropertyName = "properties.keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets the Azure Active Directory identity of the server. + /// + [JsonProperty(PropertyName = "properties.administrators")] + public ServerExternalAdministrator Administrators { get; set; } + /// /// Gets or sets resource tags. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs index 0fe8baa64ded8..a66171057791f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerVulnerabilityAssessment.cs @@ -41,8 +41,8 @@ public ServerVulnerabilityAssessment() /// Resource name. /// Resource type. /// A shared access signature (SAS - /// Key) that has read and write access to the blob container specified - /// in 'storageContainerPath' parameter. If 'storageAccountAccessKey' + /// 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. @@ -72,10 +72,10 @@ public ServerVulnerabilityAssessment() public string StorageContainerPath { get; set; } /// - /// Gets or sets 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. + /// Gets or sets a shared access signature (SAS Key) that has write + /// access to the blob container specified in 'storageContainerPath' + /// parameter. If 'storageAccountAccessKey' isn't specified, + /// StorageContainerSasKey is required. /// [JsonProperty(PropertyName = "properties.storageContainerSasKey")] public string StorageContainerSasKey { get; set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerWorkspaceFeature.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerWorkspaceFeature.cs new file mode 100644 index 0000000000000..568b5b9b66f38 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServerWorkspaceFeature.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + + /// + /// Defines values for ServerWorkspaceFeature. + /// + public static class ServerWorkspaceFeature + { + public const string Connected = "Connected"; + public const string Disconnected = "Disconnected"; + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceTierAdvisor.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceTierAdvisor.cs deleted file mode 100644 index 1809b4de62619..0000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ServiceTierAdvisor.cs +++ /dev/null @@ -1,246 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Sql.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a Service Tier Advisor. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServiceTierAdvisor : ProxyResource - { - /// - /// Initializes a new instance of the ServiceTierAdvisor class. - /// - public ServiceTierAdvisor() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServiceTierAdvisor class. - /// - /// 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. - public ServiceTierAdvisor(string id = default(string), string name = default(string), string type = default(string), System.DateTime? observationPeriodStart = default(System.DateTime?), System.DateTime? observationPeriodEnd = default(System.DateTime?), double? activeTimeRatio = default(double?), double? minDtu = default(double?), double? avgDtu = default(double?), double? maxDtu = default(double?), double? maxSizeInGB = default(double?), IList serviceLevelObjectiveUsageMetrics = default(IList), string currentServiceLevelObjective = default(string), System.Guid? currentServiceLevelObjectiveId = default(System.Guid?), string usageBasedRecommendationServiceLevelObjective = default(string), System.Guid? usageBasedRecommendationServiceLevelObjectiveId = default(System.Guid?), string databaseSizeBasedRecommendationServiceLevelObjective = default(string), System.Guid? databaseSizeBasedRecommendationServiceLevelObjectiveId = default(System.Guid?), string disasterPlanBasedRecommendationServiceLevelObjective = default(string), System.Guid? disasterPlanBasedRecommendationServiceLevelObjectiveId = default(System.Guid?), string overallRecommendationServiceLevelObjective = default(string), System.Guid? overallRecommendationServiceLevelObjectiveId = default(System.Guid?), double confidence = default(double)) - : 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; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the observation period start (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.observationPeriodStart")] - public System.DateTime? ObservationPeriodStart { get; private set; } - - /// - /// Gets the observation period start (ISO8601 format). - /// - [JsonProperty(PropertyName = "properties.observationPeriodEnd")] - public System.DateTime? ObservationPeriodEnd { get; private set; } - - /// - /// Gets the activeTimeRatio for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.activeTimeRatio")] - public double? ActiveTimeRatio { get; private set; } - - /// - /// Gets or sets minDtu for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.minDtu")] - public double? MinDtu { get; private set; } - - /// - /// Gets or sets avgDtu for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.avgDtu")] - public double? AvgDtu { get; private set; } - - /// - /// Gets or sets maxDtu for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.maxDtu")] - public double? MaxDtu { get; private set; } - - /// - /// Gets or sets maxSizeInGB for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.maxSizeInGB")] - public double? MaxSizeInGB { get; private set; } - - /// - /// Gets or sets serviceLevelObjectiveUsageMetrics for the service tier - /// advisor. - /// - [JsonProperty(PropertyName = "properties.serviceLevelObjectiveUsageMetrics")] - public IList ServiceLevelObjectiveUsageMetrics { get; private set; } - - /// - /// Gets or sets currentServiceLevelObjective for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.currentServiceLevelObjective")] - public string CurrentServiceLevelObjective { get; private set; } - - /// - /// Gets or sets currentServiceLevelObjectiveId for service tier - /// advisor. - /// - [JsonProperty(PropertyName = "properties.currentServiceLevelObjectiveId")] - public System.Guid? CurrentServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets usageBasedRecommendationServiceLevelObjective for - /// service tier advisor. - /// - [JsonProperty(PropertyName = "properties.usageBasedRecommendationServiceLevelObjective")] - public string UsageBasedRecommendationServiceLevelObjective { get; private set; } - - /// - /// Gets or sets usageBasedRecommendationServiceLevelObjectiveId for - /// service tier advisor. - /// - [JsonProperty(PropertyName = "properties.usageBasedRecommendationServiceLevelObjectiveId")] - public System.Guid? UsageBasedRecommendationServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets databaseSizeBasedRecommendationServiceLevelObjective - /// for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.databaseSizeBasedRecommendationServiceLevelObjective")] - public string DatabaseSizeBasedRecommendationServiceLevelObjective { get; private set; } - - /// - /// Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId - /// for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.databaseSizeBasedRecommendationServiceLevelObjectiveId")] - public System.Guid? DatabaseSizeBasedRecommendationServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets disasterPlanBasedRecommendationServiceLevelObjective - /// for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.disasterPlanBasedRecommendationServiceLevelObjective")] - public string DisasterPlanBasedRecommendationServiceLevelObjective { get; private set; } - - /// - /// Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId - /// for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.disasterPlanBasedRecommendationServiceLevelObjectiveId")] - public System.Guid? DisasterPlanBasedRecommendationServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets overallRecommendationServiceLevelObjective for service - /// tier advisor. - /// - [JsonProperty(PropertyName = "properties.overallRecommendationServiceLevelObjective")] - public string OverallRecommendationServiceLevelObjective { get; private set; } - - /// - /// Gets or sets overallRecommendationServiceLevelObjectiveId for - /// service tier advisor. - /// - [JsonProperty(PropertyName = "properties.overallRecommendationServiceLevelObjectiveId")] - public System.Guid? OverallRecommendationServiceLevelObjectiveId { get; private set; } - - /// - /// Gets or sets confidence for service tier advisor. - /// - [JsonProperty(PropertyName = "properties.confidence")] - public double Confidence { get; private set; } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SqlAgentConfiguration.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SqlAgentConfiguration.cs new file mode 100644 index 0000000000000..e1b4daef7714c --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SqlAgentConfiguration.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A recoverable managed database resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlAgentConfiguration : ProxyResource + { + /// + /// Initializes a new instance of the SqlAgentConfiguration class. + /// + public SqlAgentConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlAgentConfiguration class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The state of Sql Agent. Possible values + /// include: 'Enabled', 'Disabled' + public SqlAgentConfiguration(string id = default(string), string name = default(string), string type = default(string), string state = default(string)) + : base(id, name, type) + { + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of Sql Agent. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SyncGroup.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SyncGroup.cs index ba3c84abd60cc..fa9f576080789 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SyncGroup.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SyncGroup.cs @@ -35,6 +35,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. @@ -51,13 +52,18 @@ public SyncGroup() /// values include: 'NotReady', 'Error', 'Warning', 'Progressing', /// 'Good' /// Sync schema of the sync group. + /// If conflict logging is + /// enabled. + /// Conflict logging + /// retention period. /// If use private link /// connection is enabled. /// Private endpoint name of the sync /// group if use private link connection is enabled. - public SyncGroup(string id = default(string), string name = default(string), string type = default(string), int? interval = default(int?), System.DateTime? lastSyncTime = default(System.DateTime?), string conflictResolutionPolicy = default(string), string syncDatabaseId = default(string), string hubDatabaseUserName = default(string), string hubDatabasePassword = default(string), string syncState = default(string), SyncGroupSchema schema = default(SyncGroupSchema), bool? usePrivateLinkConnection = default(bool?), string privateEndpointName = default(string)) + public SyncGroup(string id = default(string), string name = default(string), string type = default(string), Sku sku = default(Sku), int? interval = default(int?), System.DateTime? lastSyncTime = default(System.DateTime?), string conflictResolutionPolicy = default(string), string syncDatabaseId = default(string), string hubDatabaseUserName = default(string), string hubDatabasePassword = default(string), string syncState = default(string), SyncGroupSchema schema = default(SyncGroupSchema), bool? enableConflictLogging = default(bool?), int? conflictLoggingRetentionInDays = default(int?), bool? usePrivateLinkConnection = default(bool?), string privateEndpointName = default(string)) : base(id, name, type) { + Sku = sku; Interval = interval; LastSyncTime = lastSyncTime; ConflictResolutionPolicy = conflictResolutionPolicy; @@ -66,6 +72,8 @@ public SyncGroup() HubDatabasePassword = hubDatabasePassword; SyncState = syncState; Schema = schema; + EnableConflictLogging = enableConflictLogging; + ConflictLoggingRetentionInDays = conflictLoggingRetentionInDays; UsePrivateLinkConnection = usePrivateLinkConnection; PrivateEndpointName = privateEndpointName; CustomInit(); @@ -76,6 +84,12 @@ public SyncGroup() /// partial void CustomInit(); + /// + /// Gets or sets the name and capacity of the SKU. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + /// /// Gets or sets sync interval of the sync group. /// @@ -127,6 +141,18 @@ public SyncGroup() [JsonProperty(PropertyName = "properties.schema")] public SyncGroupSchema Schema { get; set; } + /// + /// Gets or sets if conflict logging is enabled. + /// + [JsonProperty(PropertyName = "properties.enableConflictLogging")] + public bool? EnableConflictLogging { get; set; } + + /// + /// Gets or sets conflict logging retention period. + /// + [JsonProperty(PropertyName = "properties.conflictLoggingRetentionInDays")] + public int? ConflictLoggingRetentionInDays { get; set; } + /// /// Gets or sets if use private link connection is enabled. /// @@ -140,5 +166,18 @@ public SyncGroup() [JsonProperty(PropertyName = "properties.privateEndpointName")] public string PrivateEndpointName { get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SystemData.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SystemData.cs index 2c71b27ad8cb1..5215a566c46ee 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SystemData.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SystemData.cs @@ -29,22 +29,20 @@ public SystemData() /// /// Initializes a new instance of the SystemData class. /// - /// A string identifier for the identity that - /// created the resource. + /// The identity that created the + /// resource. /// The type of identity that created the - /// resource: <User|Application|ManagedIdentity|Key>. Possible - /// values include: 'User', 'Application', 'ManagedIdentity', - /// 'Key' + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' /// The timestamp of resource creation /// (UTC). - /// A string identifier for the identity - /// that last modified the resource. + /// The identity that last modified the + /// resource. /// The type of identity that last - /// modified the resource: - /// <User|Application|ManagedIdentity|Key>. Possible values - /// include: 'User', 'Application', 'ManagedIdentity', 'Key' - /// The timestamp of last modification - /// (UTC). + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) { CreatedBy = createdBy; @@ -62,46 +60,44 @@ public SystemData() partial void CustomInit(); /// - /// Gets a string identifier for the identity that created the - /// resource. + /// Gets or sets the identity that created the resource. /// [JsonProperty(PropertyName = "createdBy")] - public string CreatedBy { get; private set; } + public string CreatedBy { get; set; } /// - /// Gets the type of identity that created the resource: - /// &lt;User|Application|ManagedIdentity|Key&gt;. Possible - /// values include: 'User', 'Application', 'ManagedIdentity', 'Key' + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' /// [JsonProperty(PropertyName = "createdByType")] - public string CreatedByType { get; private set; } + public string CreatedByType { get; set; } /// - /// Gets the timestamp of resource creation (UTC). + /// Gets or sets the timestamp of resource creation (UTC). /// [JsonProperty(PropertyName = "createdAt")] - public System.DateTime? CreatedAt { get; private set; } + public System.DateTime? CreatedAt { get; set; } /// - /// Gets a string identifier for the identity that last modified the - /// resource. + /// Gets or sets the identity that last modified the resource. /// [JsonProperty(PropertyName = "lastModifiedBy")] - public string LastModifiedBy { get; private set; } + public string LastModifiedBy { get; set; } /// - /// Gets the type of identity that last modified the resource: - /// &lt;User|Application|ManagedIdentity|Key&gt;. Possible - /// values include: 'User', 'Application', 'ManagedIdentity', 'Key' + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' /// [JsonProperty(PropertyName = "lastModifiedByType")] - public string LastModifiedByType { get; private set; } + public string LastModifiedByType { get; set; } /// - /// Gets the timestamp of last modification (UTC). + /// Gets or sets the timestamp of resource last modification (UTC) /// [JsonProperty(PropertyName = "lastModifiedAt")] - public System.DateTime? LastModifiedAt { get; private set; } + public System.DateTime? LastModifiedAt { get; set; } } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolEdition.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TableTemporalType.cs similarity index 55% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolEdition.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TableTemporalType.cs index 4ce5464769019..471655c7bbfaa 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/ElasticPoolEdition.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TableTemporalType.cs @@ -12,14 +12,12 @@ namespace Microsoft.Azure.Management.Sql.Models { /// - /// Defines values for ElasticPoolEdition. + /// Defines values for TableTemporalType. /// - public static class ElasticPoolEdition + public static class TableTemporalType { - public const string Basic = "Basic"; - public const string Standard = "Standard"; - public const string Premium = "Premium"; - public const string GeneralPurpose = "GeneralPurpose"; - public const string BusinessCritical = "BusinessCritical"; + public const string NonTemporalTable = "NonTemporalTable"; + public const string HistoryTable = "HistoryTable"; + public const string SystemVersionedTemporalTable = "SystemVersionedTemporalTable"; } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TimeZone.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TimeZone.cs new file mode 100644 index 0000000000000..1151f38a1b73b --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TimeZone.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Time Zone. + /// + [Rest.Serialization.JsonTransformation] + public partial class TimeZone : ProxyResource + { + /// + /// Initializes a new instance of the TimeZone class. + /// + public TimeZone() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeZone class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The time zone id + /// The time zone display name + public TimeZone(string id = default(string), string name = default(string), string type = default(string), string timeZoneId = default(string), string displayName = default(string)) + : base(id, name, type) + { + TimeZoneId = timeZoneId; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the time zone id + /// + [JsonProperty(PropertyName = "properties.timeZoneId")] + public string TimeZoneId { get; private set; } + + /// + /// Gets the time zone display name + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionState.cs similarity index 55% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionState.cs index 0b697a00547db..65c67a0ddb0b5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/SecurityAlertPolicyEmailAccountAdmins.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/TransparentDataEncryptionState.cs @@ -16,43 +16,43 @@ namespace Microsoft.Azure.Management.Sql.Models using System.Runtime.Serialization; /// - /// Defines values for SecurityAlertPolicyEmailAccountAdmins. + /// Defines values for TransparentDataEncryptionState. /// [JsonConverter(typeof(StringEnumConverter))] - public enum SecurityAlertPolicyEmailAccountAdmins + public enum TransparentDataEncryptionState { [EnumMember(Value = "Enabled")] Enabled, [EnumMember(Value = "Disabled")] Disabled } - internal static class SecurityAlertPolicyEmailAccountAdminsEnumExtension + internal static class TransparentDataEncryptionStateEnumExtension { - internal static string ToSerializedValue(this SecurityAlertPolicyEmailAccountAdmins? value) + internal static string ToSerializedValue(this TransparentDataEncryptionState? value) { - return value == null ? null : ((SecurityAlertPolicyEmailAccountAdmins)value).ToSerializedValue(); + return value == null ? null : ((TransparentDataEncryptionState)value).ToSerializedValue(); } - internal static string ToSerializedValue(this SecurityAlertPolicyEmailAccountAdmins value) + internal static string ToSerializedValue(this TransparentDataEncryptionState value) { switch( value ) { - case SecurityAlertPolicyEmailAccountAdmins.Enabled: + case TransparentDataEncryptionState.Enabled: return "Enabled"; - case SecurityAlertPolicyEmailAccountAdmins.Disabled: + case TransparentDataEncryptionState.Disabled: return "Disabled"; } return null; } - internal static SecurityAlertPolicyEmailAccountAdmins? ParseSecurityAlertPolicyEmailAccountAdmins(this string value) + internal static TransparentDataEncryptionState? ParseTransparentDataEncryptionState(this string value) { switch( value ) { case "Enabled": - return SecurityAlertPolicyEmailAccountAdmins.Enabled; + return TransparentDataEncryptionState.Enabled; case "Disabled": - return SecurityAlertPolicyEmailAccountAdmins.Disabled; + return TransparentDataEncryptionState.Disabled; } return null; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs new file mode 100644 index 0000000000000..159f7fb13faed --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UpdateManagedInstanceDnsServersOperation.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A recoverable managed database resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class UpdateManagedInstanceDnsServersOperation : ProxyResource + { + /// + /// Initializes a new instance of the + /// UpdateManagedInstanceDnsServersOperation class. + /// + public UpdateManagedInstanceDnsServersOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// UpdateManagedInstanceDnsServersOperation class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// The status of the DNS refresh operation. + /// Possible values include: 'Succeeded', 'Failed' + public UpdateManagedInstanceDnsServersOperation(string id = default(string), string name = default(string), string type = default(string), string status = default(string)) + : base(id, name, type) + { + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the status of the DNS refresh operation. Possible values + /// include: 'Succeeded', 'Failed' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UserIdentity.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UserIdentity.cs new file mode 100644 index 0000000000000..db5b24d3ce040 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/UserIdentity.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Active Directory identity configuration for a resource. + /// + public partial class UserIdentity + { + /// + /// Initializes a new instance of the UserIdentity class. + /// + public UserIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentity class. + /// + /// The Azure Active Directory principal + /// id. + /// The Azure Active Directory client + /// id. + public UserIdentity(System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Azure Active Directory principal id. + /// + [JsonProperty(PropertyName = "principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the Azure Active Directory client id. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid? ClientId { get; private set; } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualCluster.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualCluster.cs index 5b9b536fffc89..755cb297d5450 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualCluster.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualCluster.cs @@ -45,12 +45,15 @@ public VirtualCluster() /// hardware, for the same SKU, then that can be captured here. /// List of resources in this virtual /// cluster. - public VirtualCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string subnetId = default(string), string family = default(string), IList childResources = default(IList)) + /// Specifies maintenance + /// configuration id to apply to this virtual cluster. + public VirtualCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string subnetId = default(string), string family = default(string), IList childResources = default(IList), string maintenanceConfigurationId = default(string)) : base(location, id, name, type, tags) { SubnetId = subnetId; Family = family; ChildResources = childResources; + MaintenanceConfigurationId = maintenanceConfigurationId; CustomInit(); } @@ -78,6 +81,13 @@ public VirtualCluster() [JsonProperty(PropertyName = "properties.childResources")] public IList ChildResources { get; private set; } + /// + /// Gets or sets specifies maintenance configuration id to apply to + /// this virtual cluster. + /// + [JsonProperty(PropertyName = "properties.maintenanceConfigurationId")] + public string MaintenanceConfigurationId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualClusterUpdate.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualClusterUpdate.cs index 3bb25968e80fc..c2e42f40e32fa 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualClusterUpdate.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualClusterUpdate.cs @@ -40,12 +40,15 @@ public VirtualClusterUpdate() /// hardware, for the same SKU, then that can be captured here. /// List of resources in this virtual /// cluster. + /// Specifies maintenance + /// configuration id to apply to this virtual cluster. /// Resource tags. - public VirtualClusterUpdate(string subnetId = default(string), string family = default(string), IList childResources = default(IList), IDictionary tags = default(IDictionary)) + public VirtualClusterUpdate(string subnetId = default(string), string family = default(string), IList childResources = default(IList), string maintenanceConfigurationId = default(string), IDictionary tags = default(IDictionary)) { SubnetId = subnetId; Family = family; ChildResources = childResources; + MaintenanceConfigurationId = maintenanceConfigurationId; Tags = tags; CustomInit(); } @@ -74,6 +77,13 @@ public VirtualClusterUpdate() [JsonProperty(PropertyName = "properties.childResources")] public IList ChildResources { get; private set; } + /// + /// Gets or sets specifies maintenance configuration id to apply to + /// this virtual cluster. + /// + [JsonProperty(PropertyName = "properties.maintenanceConfigurationId")] + public string MaintenanceConfigurationId { get; set; } + /// /// Gets or sets resource tags. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRule.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRule.cs index b34438897190c..7ad4863674ce0 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRule.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRule.cs @@ -41,8 +41,8 @@ public VirtualNetworkRule() /// before the virtual network has vnet service endpoint /// enabled. /// Virtual Network Rule State. Possible values - /// include: 'Initializing', 'InProgress', 'Ready', 'Deleting', - /// 'Unknown' + /// include: 'Initializing', 'InProgress', 'Ready', 'Failed', + /// 'Deleting', 'Unknown' public VirtualNetworkRule(string virtualNetworkSubnetId, string id = default(string), string name = default(string), string type = default(string), bool? ignoreMissingVnetServiceEndpoint = default(bool?), string state = default(string)) : base(id, name, type) { @@ -72,7 +72,8 @@ public VirtualNetworkRule() /// /// Gets virtual Network Rule State. Possible values include: - /// 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' + /// 'Initializing', 'InProgress', 'Ready', 'Failed', 'Deleting', + /// 'Unknown' /// [JsonProperty(PropertyName = "properties.state")] public string State { get; private set; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRuleState.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRuleState.cs index ef0dd2f70a5b8..1b0e17f64db15 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRuleState.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Models/VirtualNetworkRuleState.cs @@ -19,6 +19,7 @@ public static class VirtualNetworkRuleState public const string Initializing = "Initializing"; public const string InProgress = "InProgress"; public const string Ready = "Ready"; + public const string Failed = "Failed"; public const string Deleting = "Deleting"; public const string Unknown = "Unknown"; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Operations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Operations.cs index 3880565f95391..e579b3e14be5d 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Operations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(SqlManagementClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperations.cs new file mode 100644 index 0000000000000..42bc7d73347b5 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperations.cs @@ -0,0 +1,412 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationsHealthOperations operations. + /// + internal partial class OperationsHealthOperations : IServiceOperations, IOperationsHealthOperations + { + /// + /// Initializes a new instance of the OperationsHealthOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OperationsHealthOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a service operation health status. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/operationsHealth").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a service operation health status. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperationsExtensions.cs new file mode 100644 index 0000000000000..31d88d56ac984 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/OperationsHealthOperationsExtensions.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OperationsHealthOperations. + /// + public static partial class OperationsHealthOperationsExtensions + { + /// + /// Gets a service operation health status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + public static IPage ListByLocation(this IOperationsHealthOperations operations, string locationName) + { + return operations.ListByLocationAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a service operation health status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the region where the resource is located. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IOperationsHealthOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a service operation health status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IOperationsHealthOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a service operation health status. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IOperationsHealthOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateLinkResourcesOperations.cs index 8c2d1eacd2e7b..c9727ebfe728a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateLinkResourcesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/PrivateLinkResourcesOperations.cs @@ -95,7 +95,7 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -297,7 +297,7 @@ internal PrivateLinkResourcesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs new file mode 100644 index 0000000000000..71e46e0c31ca0 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperations.cs @@ -0,0 +1,251 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RecommendedSensitivityLabelsOperations operations. + /// + internal partial class RecommendedSensitivityLabelsOperations : IServiceOperations, IRecommendedSensitivityLabelsOperations + { + /// + /// Initializes a new instance of the RecommendedSensitivityLabelsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RecommendedSensitivityLabelsOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperationsExtensions.cs new file mode 100644 index 0000000000000..695e35ce9f579 --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedSensitivityLabelsOperationsExtensions.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for RecommendedSensitivityLabelsOperations. + /// + public static partial class RecommendedSensitivityLabelsOperationsExtensions + { + /// + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// + public static void Update(this IRecommendedSensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters) + { + operations.UpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update recommended sensitivity labels states of a given database using an + /// operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task UpdateAsync(this IRecommendedSensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, RecommendedSensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableManagedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableManagedDatabasesOperations.cs index a2411afc748a4..cb9350c225554 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableManagedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecoverableManagedDatabasesOperations.cs @@ -95,7 +95,7 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -296,7 +296,7 @@ internal RecoverableManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs index 166c29c694439..242c5a46f276b 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperations.cs @@ -51,7 +51,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a deleted database that can be restored + /// Gets a list of restorable dropped databases. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,10 +60,6 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The id of the deleted database in the form of - /// databaseName,deletionTimeInFileTimeFormat - /// /// /// Headers that will be added to request. /// @@ -85,12 +81,8 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string restorableDroppededDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -99,11 +91,11 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (restorableDroppededDatabaseId == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "restorableDroppededDatabaseId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -111,20 +103,18 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("restorableDroppededDatabaseId", restorableDroppededDatabaseId); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{restorableDroppededDatabaseId}", System.Uri.EscapeDataString(restorableDroppededDatabaseId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -223,7 +213,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -236,7 +226,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -256,7 +246,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) } /// - /// Gets a list of deleted databases that can be restored + /// Gets a restorable dropped database. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -265,6 +255,8 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// /// /// Headers that will be added to request. /// @@ -286,12 +278,8 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string restorableDroppedDatabaseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -300,7 +288,15 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2014-04-01"; + if (restorableDroppedDatabaseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restorableDroppedDatabaseId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -308,18 +304,20 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("restorableDroppedDatabaseId", restorableDroppedDatabaseId); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{restorableDroppedDatabaseId}", System.Uri.EscapeDataString(restorableDroppedDatabaseId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -418,7 +416,180 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of restorable dropped databases. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -431,7 +602,7 @@ internal RestorableDroppedDatabasesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperationsExtensions.cs index 1bf3d18ae714d..4f63557659a40 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedDatabasesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -24,7 +22,7 @@ namespace Microsoft.Azure.Management.Sql public static partial class RestorableDroppedDatabasesOperationsExtensions { /// - /// Gets a deleted database that can be restored + /// Gets a list of restorable dropped databases. /// /// /// The operations group for this extension method. @@ -36,17 +34,13 @@ public static partial class RestorableDroppedDatabasesOperationsExtensions /// /// The name of the server. /// - /// - /// The id of the deleted database in the form of - /// databaseName,deletionTimeInFileTimeFormat - /// - public static RestorableDroppedDatabase Get(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, string restorableDroppededDatabaseId) + public static IPage ListByServer(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName) { - return operations.GetAsync(resourceGroupName, serverName, restorableDroppededDatabaseId).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// Gets a deleted database that can be restored + /// Gets a list of restorable dropped databases. /// /// /// The operations group for this extension method. @@ -58,23 +52,19 @@ public static RestorableDroppedDatabase Get(this IRestorableDroppedDatabasesOper /// /// The name of the server. /// - /// - /// The id of the deleted database in the form of - /// databaseName,deletionTimeInFileTimeFormat - /// /// /// The cancellation token. /// - public static async Task GetAsync(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, string restorableDroppededDatabaseId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, restorableDroppededDatabaseId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a list of deleted databases that can be restored + /// Gets a restorable dropped database. /// /// /// The operations group for this extension method. @@ -86,13 +76,15 @@ public static RestorableDroppedDatabase Get(this IRestorableDroppedDatabasesOper /// /// The name of the server. /// - public static IEnumerable ListByServer(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName) + /// + /// + public static RestorableDroppedDatabase Get(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, string restorableDroppedDatabaseId) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, restorableDroppedDatabaseId).GetAwaiter().GetResult(); } /// - /// Gets a list of deleted databases that can be restored + /// Gets a restorable dropped database. /// /// /// The operations group for this extension method. @@ -104,12 +96,48 @@ public static IEnumerable ListByServer(this IRestorab /// /// The name of the server. /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IRestorableDroppedDatabasesOperations operations, string resourceGroupName, string serverName, string restorableDroppedDatabaseId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, restorableDroppedDatabaseId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of restorable dropped databases. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IRestorableDroppedDatabasesOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of restorable dropped databases. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IRestorableDroppedDatabasesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedManagedDatabasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedManagedDatabasesOperations.cs index e29929ae53746..f91949e220614 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedManagedDatabasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorableDroppedManagedDatabasesOperations.cs @@ -95,7 +95,7 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -296,7 +296,7 @@ internal RestorableDroppedManagedDatabasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperations.cs index f3108b1e83047..8597cc7972fc9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperations.cs @@ -84,7 +84,7 @@ internal RestorePointsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -102,7 +102,7 @@ internal RestorePointsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -222,7 +222,7 @@ internal RestorePointsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -235,7 +235,7 @@ internal RestorePointsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -342,7 +342,7 @@ internal RestorePointsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -552,7 +552,7 @@ internal RestorePointsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -751,7 +751,7 @@ internal RestorePointsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -928,5 +928,178 @@ internal RestorePointsOperations(SqlManagementClient client) return _result; } + /// + /// Gets a list of database restore points. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperationsExtensions.cs index 225555ac69a64..c7f541c5ee98c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RestorePointsOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Sql using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -39,7 +37,7 @@ public static partial class RestorePointsOperationsExtensions /// /// The name of the database. /// - public static IEnumerable ListByDatabase(this IRestorePointsOperations operations, string resourceGroupName, string serverName, string databaseName) + public static IPage ListByDatabase(this IRestorePointsOperations operations, string resourceGroupName, string serverName, string databaseName) { return operations.ListByDatabaseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult(); } @@ -63,7 +61,7 @@ public static IEnumerable ListByDatabase(this IRestorePointsOperat /// /// The cancellation token. /// - public static async Task> ListByDatabaseAsync(this IRestorePointsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByDatabaseAsync(this IRestorePointsOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)) { @@ -284,5 +282,39 @@ public static RestorePoint BeginCreate(this IRestorePointsOperations operations, } } + /// + /// Gets a list of database restore points. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDatabaseNext(this IRestorePointsOperations operations, string nextPageLink) + { + return operations.ListByDatabaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of database restore points. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseNextAsync(this IRestorePointsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs index feab62484021b..c439f990d66a6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SdkInfo_SqlManagementClient.cs @@ -19,106 +19,126 @@ public static IEnumerable> ApiInfo_SqlManagementCl { return new Tuple[] { - new Tuple("Sql", "BackupShortTermRetentionPolicies", "2017-10-01-preview"), - new Tuple("Sql", "Capabilities", "2020-08-01-preview"), + new Tuple("Sql", "BackupShortTermRetentionPolicies", "2020-11-01-preview"), + new Tuple("Sql", "Capabilities", "2020-11-01-preview"), new Tuple("Sql", "DataMaskingPolicies", "2014-04-01"), new Tuple("Sql", "DataMaskingRules", "2014-04-01"), - new Tuple("Sql", "DatabaseAutomaticTuning", "2015-05-01-preview"), - new Tuple("Sql", "DatabaseBlobAuditingPolicies", "2017-03-01-preview"), - new Tuple("Sql", "DatabaseOperations", "2017-10-01-preview"), - new Tuple("Sql", "DatabaseThreatDetectionPolicies", "2014-04-01"), - new Tuple("Sql", "DatabaseUsages", "2014-04-01"), - new Tuple("Sql", "DatabaseVulnerabilityAssessmentRuleBaselines", "2017-03-01-preview"), - new Tuple("Sql", "DatabaseVulnerabilityAssessmentScans", "2017-10-01-preview"), - new Tuple("Sql", "DatabaseVulnerabilityAssessments", "2017-03-01-preview"), + new Tuple("Sql", "DataWarehouseUserActivities", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseAdvisors", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseAutomaticTuning", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseBlobAuditingPolicies", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseColumns", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseExtensions", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseOperations", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseRecommendedActions", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseSchemas", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseSecurityAlertPolicies", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseTables", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseUsages", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseVulnerabilityAssessmentRuleBaselines", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseVulnerabilityAssessmentScans", "2020-11-01-preview"), + new Tuple("Sql", "DatabaseVulnerabilityAssessments", "2020-11-01-preview"), new Tuple("Sql", "Databases", "2014-04-01"), - new Tuple("Sql", "Databases", "2020-02-02-preview"), new Tuple("Sql", "Databases", "2020-11-01-preview"), + new Tuple("Sql", "DeletedServers", "2020-11-01-preview"), new Tuple("Sql", "ElasticPoolActivities", "2014-04-01"), new Tuple("Sql", "ElasticPoolDatabaseActivities", "2014-04-01"), - new Tuple("Sql", "ElasticPoolOperations", "2017-10-01-preview"), + new Tuple("Sql", "ElasticPoolOperations", "2020-11-01-preview"), new Tuple("Sql", "ElasticPools", "2014-04-01"), - new Tuple("Sql", "ElasticPools", "2020-08-01-preview"), - new Tuple("Sql", "EncryptionProtectors", "2015-05-01-preview"), - new Tuple("Sql", "ExtendedDatabaseBlobAuditingPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ExtendedServerBlobAuditingPolicies", "2017-03-01-preview"), - new Tuple("Sql", "FailoverGroups", "2015-05-01-preview"), - new Tuple("Sql", "FirewallRules", "2014-04-01"), + new Tuple("Sql", "ElasticPools", "2020-11-01-preview"), + new Tuple("Sql", "EncryptionProtectors", "2020-11-01-preview"), + new Tuple("Sql", "ExtendedDatabaseBlobAuditingPolicies", "2020-11-01-preview"), + new Tuple("Sql", "ExtendedServerBlobAuditingPolicies", "2020-11-01-preview"), + new Tuple("Sql", "FailoverGroups", "2020-11-01-preview"), + new Tuple("Sql", "FirewallRules", "2020-11-01-preview"), new Tuple("Sql", "GeoBackupPolicies", "2014-04-01"), - new Tuple("Sql", "ImportExport", "2020-02-02-preview"), - new Tuple("Sql", "InstanceFailoverGroups", "2017-10-01-preview"), - new Tuple("Sql", "InstancePools", "2018-06-01-preview"), - new Tuple("Sql", "JobAgents", "2017-03-01-preview"), - new Tuple("Sql", "JobCredentials", "2017-03-01-preview"), - new Tuple("Sql", "JobExecutions", "2017-03-01-preview"), - new Tuple("Sql", "JobStepExecutions", "2017-03-01-preview"), - new Tuple("Sql", "JobSteps", "2017-03-01-preview"), - new Tuple("Sql", "JobTargetExecutions", "2017-03-01-preview"), - new Tuple("Sql", "JobTargetGroups", "2017-03-01-preview"), - new Tuple("Sql", "JobVersions", "2017-03-01-preview"), - new Tuple("Sql", "Jobs", "2017-03-01-preview"), + new Tuple("Sql", "InstanceFailoverGroups", "2020-11-01-preview"), + new Tuple("Sql", "InstancePools", "2020-11-01-preview"), + new Tuple("Sql", "JobAgents", "2020-11-01-preview"), + new Tuple("Sql", "JobCredentials", "2020-11-01-preview"), + new Tuple("Sql", "JobExecutions", "2020-11-01-preview"), + new Tuple("Sql", "JobStepExecutions", "2020-11-01-preview"), + new Tuple("Sql", "JobSteps", "2020-11-01-preview"), + new Tuple("Sql", "JobTargetExecutions", "2020-11-01-preview"), + new Tuple("Sql", "JobTargetGroups", "2020-11-01-preview"), + new Tuple("Sql", "JobVersions", "2020-11-01-preview"), + new Tuple("Sql", "Jobs", "2020-11-01-preview"), new Tuple("Sql", "LongTermRetentionBackups", "2020-11-01-preview"), - new Tuple("Sql", "LongTermRetentionManagedInstanceBackups", "2018-06-01-preview"), + new Tuple("Sql", "LongTermRetentionManagedInstanceBackups", "2020-11-01-preview"), new Tuple("Sql", "LongTermRetentionPolicies", "2020-11-01-preview"), - new Tuple("Sql", "ManagedBackupShortTermRetentionPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ManagedDatabaseRestoreDetails", "2020-02-02-preview"), - new Tuple("Sql", "ManagedDatabaseSecurityAlertPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ManagedDatabaseSensitivityLabels", "2018-06-01-preview"), - new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentRuleBaselines", "2017-10-01-preview"), - new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentScans", "2017-10-01-preview"), - new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessments", "2017-10-01-preview"), - new Tuple("Sql", "ManagedDatabases", "2020-02-02-preview"), - new Tuple("Sql", "ManagedInstanceAdministrators", "2017-03-01-preview"), - new Tuple("Sql", "ManagedInstanceAzureADOnlyAuthentications", "2020-02-02-preview"), - new Tuple("Sql", "ManagedInstanceEncryptionProtectors", "2017-10-01-preview"), - new Tuple("Sql", "ManagedInstanceKeys", "2017-10-01-preview"), - new Tuple("Sql", "ManagedInstanceLongTermRetentionPolicies", "2018-06-01-preview"), - new Tuple("Sql", "ManagedInstanceOperations", "2019-06-01-preview"), - new Tuple("Sql", "ManagedInstanceTdeCertificates", "2017-10-01-preview"), - new Tuple("Sql", "ManagedInstanceVulnerabilityAssessments", "2018-06-01-preview"), - new Tuple("Sql", "ManagedInstances", "2020-02-02-preview"), - new Tuple("Sql", "ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ManagedServerSecurityAlertPolicies", "2017-03-01-preview"), - new Tuple("Sql", "Operations", "2015-05-01-preview"), + new Tuple("Sql", "MaintenanceWindowOptions", "2020-11-01-preview"), + new Tuple("Sql", "MaintenanceWindows", "2020-11-01-preview"), + new Tuple("Sql", "ManagedBackupShortTermRetentionPolicies", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseColumns", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseQueries", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseRecommendedSensitivityLabels", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseRestoreDetails", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseSchemas", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseSecurityAlertPolicies", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseSecurityEvents", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseSensitivityLabels", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseTables", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseTransparentDataEncryption", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentRuleBaselines", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentScans", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessments", "2020-11-01-preview"), + new Tuple("Sql", "ManagedDatabases", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstanceAdministrators", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstanceAzureADOnlyAuthentications", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstanceEncryptionProtectors", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstanceKeys", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstanceLongTermRetentionPolicies", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstanceOperations", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstancePrivateEndpointConnections", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstancePrivateLinkResources", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstanceTdeCertificates", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstanceVulnerabilityAssessments", "2020-11-01-preview"), + new Tuple("Sql", "ManagedInstances", "2020-11-01-preview"), + new Tuple("Sql", "ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies", "2020-11-01-preview"), + new Tuple("Sql", "ManagedServerSecurityAlertPolicies", "2020-11-01-preview"), + new Tuple("Sql", "Operations", "2020-11-01-preview"), + new Tuple("Sql", "OperationsHealth", "2020-11-01-preview"), new Tuple("Sql", "PrivateEndpointConnections", "2020-11-01-preview"), - new Tuple("Sql", "PrivateLinkResources", "2018-06-01-preview"), - new Tuple("Sql", "RecommendedElasticPools", "2014-04-01"), + new Tuple("Sql", "PrivateLinkResources", "2020-11-01-preview"), + new Tuple("Sql", "RecommendedSensitivityLabels", "2020-11-01-preview"), new Tuple("Sql", "RecoverableDatabases", "2014-04-01"), - new Tuple("Sql", "RecoverableManagedDatabases", "2017-10-01-preview"), + new Tuple("Sql", "RecoverableManagedDatabases", "2020-11-01-preview"), new Tuple("Sql", "ReplicationLinks", "2014-04-01"), - new Tuple("Sql", "RestorableDroppedDatabases", "2014-04-01"), - new Tuple("Sql", "RestorableDroppedManagedDatabases", "2017-03-01-preview"), - new Tuple("Sql", "RestorePoints", "2017-03-01-preview"), - new Tuple("Sql", "SensitivityLabels", "2017-03-01-preview"), - new Tuple("Sql", "ServerAutomaticTuning", "2017-03-01-preview"), - new Tuple("Sql", "ServerAzureADAdministrators", "2019-06-01-preview"), - new Tuple("Sql", "ServerAzureADOnlyAuthentications", "2020-02-02-preview"), - new Tuple("Sql", "ServerBlobAuditingPolicies", "2017-03-01-preview"), + new Tuple("Sql", "RestorableDroppedDatabases", "2020-11-01-preview"), + new Tuple("Sql", "RestorableDroppedManagedDatabases", "2020-11-01-preview"), + new Tuple("Sql", "RestorePoints", "2020-11-01-preview"), + new Tuple("Sql", "SensitivityLabels", "2020-11-01-preview"), + new Tuple("Sql", "ServerAdvisors", "2020-11-01-preview"), + new Tuple("Sql", "ServerAutomaticTuning", "2020-11-01-preview"), + new Tuple("Sql", "ServerAzureADAdministrators", "2020-11-01-preview"), + new Tuple("Sql", "ServerAzureADOnlyAuthentications", "2020-11-01-preview"), + new Tuple("Sql", "ServerBlobAuditingPolicies", "2020-11-01-preview"), new Tuple("Sql", "ServerCommunicationLinks", "2014-04-01"), new Tuple("Sql", "ServerConnectionPolicies", "2014-04-01"), - new Tuple("Sql", "ServerDevOpsAuditSettings", "2020-08-01-preview"), - new Tuple("Sql", "ServerDnsAliases", "2017-03-01-preview"), - new Tuple("Sql", "ServerKeys", "2015-05-01-preview"), - new Tuple("Sql", "ServerSecurityAlertPolicies", "2017-03-01-preview"), - new Tuple("Sql", "ServerTrustGroups", "2020-02-02-preview"), + new Tuple("Sql", "ServerDevOpsAuditSettings", "2020-11-01-preview"), + new Tuple("Sql", "ServerDnsAliases", "2020-11-01-preview"), + new Tuple("Sql", "ServerKeys", "2020-11-01-preview"), + new Tuple("Sql", "ServerOperations", "2020-11-01-preview"), + new Tuple("Sql", "ServerSecurityAlertPolicies", "2020-11-01-preview"), + new Tuple("Sql", "ServerTrustGroups", "2020-11-01-preview"), new Tuple("Sql", "ServerUsages", "2014-04-01"), - new Tuple("Sql", "ServerVulnerabilityAssessments", "2018-06-01-preview"), - new Tuple("Sql", "Servers", "2019-06-01-preview"), - new Tuple("Sql", "Servers", "2020-02-02-preview"), + new Tuple("Sql", "ServerVulnerabilityAssessments", "2020-11-01-preview"), + new Tuple("Sql", "Servers", "2020-11-01-preview"), new Tuple("Sql", "ServiceObjectives", "2014-04-01"), - new Tuple("Sql", "ServiceTierAdvisors", "2014-04-01"), - new Tuple("Sql", "SubscriptionUsages", "2015-05-01-preview"), - new Tuple("Sql", "SyncAgents", "2015-05-01-preview"), - new Tuple("Sql", "SyncGroups", "2019-06-01-preview"), - new Tuple("Sql", "SyncMembers", "2019-06-01-preview"), - new Tuple("Sql", "TdeCertificates", "2017-10-01-preview"), + new Tuple("Sql", "SqlAgent", "2020-11-01-preview"), + new Tuple("Sql", "SubscriptionUsages", "2020-11-01-preview"), + new Tuple("Sql", "SyncAgents", "2020-11-01-preview"), + new Tuple("Sql", "SyncGroups", "2020-11-01-preview"), + new Tuple("Sql", "SyncMembers", "2020-11-01-preview"), + new Tuple("Sql", "TdeCertificates", "2020-11-01-preview"), + new Tuple("Sql", "TimeZones", "2020-11-01-preview"), new Tuple("Sql", "TransparentDataEncryptionActivities", "2014-04-01"), new Tuple("Sql", "TransparentDataEncryptions", "2014-04-01"), new Tuple("Sql", "Usages", "2018-06-01-preview"), - new Tuple("Sql", "VirtualClusters", "2015-05-01-preview"), - new Tuple("Sql", "VirtualNetworkRules", "2015-05-01-preview"), - new Tuple("Sql", "WorkloadClassifiers", "2019-06-01-preview"), - new Tuple("Sql", "WorkloadGroups", "2019-06-01-preview"), + new Tuple("Sql", "VirtualClusters", "2020-11-01-preview"), + new Tuple("Sql", "VirtualNetworkRules", "2020-11-01-preview"), + new Tuple("Sql", "WorkloadClassifiers", "2020-11-01-preview"), + new Tuple("Sql", "WorkloadGroups", "2020-11-01-preview"), }.AsEnumerable(); } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs index 0dd4fe37efe69..c033488914ca5 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperations.cs @@ -67,6 +67,10 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// Headers that will be added to request. /// @@ -88,7 +92,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCurrentByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -106,7 +110,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -118,6 +122,8 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("count", count); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListCurrentByDatabase", tracingParameters); @@ -138,6 +144,14 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _queryParameters.Add(_odataFilter); } } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (count != null) + { + _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -267,6 +281,202 @@ internal SensitivityLabelsOperations(SqlManagementClient client) return _result; } + /// + /// 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. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets the sensitivity labels of a given database /// @@ -283,11 +493,11 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// Headers that will be added to request. /// @@ -309,7 +519,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListRecommendedByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -327,7 +537,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -339,8 +549,8 @@ internal SensitivityLabelsOperations(SqlManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("includeDisabledRecommendations", includeDisabledRecommendations); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListRecommendedByDatabase", tracingParameters); @@ -361,14 +571,14 @@ internal SensitivityLabelsOperations(SqlManagementClient client) _queryParameters.Add(_odataFilter); } } - if (includeDisabledRecommendations != null) - { - _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); - } if (skipToken != null) { _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); } + if (includeDisabledRecommendations != null) + { + _queryParameters.Add(string.Format("includeDisabledRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeDisabledRecommendations, Client.SerializationSettings).Trim('"')))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -570,7 +780,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "recommended"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -783,7 +993,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "recommended"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1002,7 +1212,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1243,7 +1453,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "current"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1499,7 +1709,7 @@ internal SensitivityLabelsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string sensitivityLabelSource = "current"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs index a647ae07ee4a1..16d2060007674 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SensitivityLabelsOperationsExtensions.cs @@ -41,9 +41,13 @@ public static partial class SensitivityLabelsOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage ListCurrentByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery)) + /// + /// + /// + /// + public static IPage ListCurrentByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?)) { - return operations.ListCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery).GetAwaiter().GetResult(); + return operations.ListCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery, skipToken, count).GetAwaiter().GetResult(); } /// @@ -65,17 +69,70 @@ public static partial class SensitivityLabelsOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// + /// + /// /// /// The cancellation token. /// - public static async Task> ListCurrentByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListCurrentByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? count = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListCurrentByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, skipToken, count, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + /// + /// + public static void Update(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters) + { + operations.UpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update sensitivity labels of a given database using an operations batch. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the 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. + /// + public static async Task UpdateAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, SensitivityLabelUpdateList parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets the sensitivity labels of a given database /// @@ -95,14 +152,14 @@ public static partial class SensitivityLabelsOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// - public static IPage ListRecommendedByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string)) + public static IPage ListRecommendedByDatabase(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?)) { - return operations.ListRecommendedByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery, includeDisabledRecommendations, skipToken).GetAwaiter().GetResult(); + return operations.ListRecommendedByDatabaseAsync(resourceGroupName, serverName, databaseName, odataQuery, skipToken, includeDisabledRecommendations).GetAwaiter().GetResult(); } /// @@ -124,17 +181,17 @@ public static partial class SensitivityLabelsOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// /// /// Specifies whether to include disabled recommendations or not. /// - /// - /// /// /// The cancellation token. /// - public static async Task> ListRecommendedByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), bool? includeDisabledRecommendations = default(bool?), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListRecommendedByDatabaseAsync(this ISensitivityLabelsOperations operations, string resourceGroupName, string serverName, string databaseName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), bool? includeDisabledRecommendations = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, includeDisabledRecommendations, skipToken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListRecommendedByDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, odataQuery, skipToken, includeDisabledRecommendations, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperations.cs similarity index 87% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperations.cs index 8f5b8001213f7..89b36dabc7467 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// RecommendedElasticPoolsOperations operations. + /// ServerAdvisorsOperations operations. /// - internal partial class RecommendedElasticPoolsOperations : IServiceOperations, IRecommendedElasticPoolsOperations + internal partial class ServerAdvisorsOperations : IServiceOperations, IServerAdvisorsOperations { /// - /// Initializes a new instance of the RecommendedElasticPoolsOperations class. + /// Initializes a new instance of the ServerAdvisorsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class RecommendedElasticPoolsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal RecommendedElasticPoolsOperations(SqlManagementClient client) + internal ServerAdvisorsOperations(SqlManagementClient client) { if (client == null) { @@ -51,7 +51,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -60,8 +60,8 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The child resources to include in the response. /// /// /// Headers that will be added to request. @@ -84,12 +84,8 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -98,11 +94,11 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (recommendedElasticPoolName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "recommendedElasticPoolName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -110,21 +106,24 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("recommendedElasticPoolName", recommendedElasticPoolName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{recommendedElasticPoolName}", System.Uri.EscapeDataString(recommendedElasticPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -222,7 +221,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -235,7 +234,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -255,7 +254,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) } /// - /// Returns recommended elastic pools. + /// Gets a server advisor. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -264,6 +263,9 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// The name of the Server Advisor. + /// /// /// Headers that will be added to request. /// @@ -285,12 +287,8 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string advisorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -299,7 +297,15 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2014-04-01"; + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -307,18 +313,20 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -417,7 +425,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -430,7 +438,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -450,7 +458,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) } /// - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -459,8 +467,11 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// 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. /// /// /// Headers that will be added to request. @@ -483,12 +494,8 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string advisorName, Advisor parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -497,11 +504,19 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - if (recommendedElasticPoolName == null) + if (advisorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "advisorName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "recommendedElasticPoolName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -509,20 +524,21 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); - tracingParameters.Add("recommendedElasticPoolName", recommendedElasticPoolName); + tracingParameters.Add("advisorName", advisorName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advisors/{advisorName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{recommendedElasticPoolName}", System.Uri.EscapeDataString(recommendedElasticPoolName)); + _url = _url.Replace("{advisorName}", System.Uri.EscapeDataString(advisorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -535,7 +551,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -566,6 +582,12 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -621,7 +643,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -634,7 +656,7 @@ internal RecommendedElasticPoolsOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperationsExtensions.cs similarity index 61% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperationsExtensions.cs index 1cb689bd8c2aa..9d9d309a21321 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/RecommendedElasticPoolsOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAdvisorsOperationsExtensions.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for RecommendedElasticPoolsOperations. + /// Extension methods for ServerAdvisorsOperations. /// - public static partial class RecommendedElasticPoolsOperationsExtensions + public static partial class ServerAdvisorsOperationsExtensions { /// - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// /// /// The operations group for this extension method. @@ -36,16 +36,16 @@ public static partial class RecommendedElasticPoolsOperationsExtensions /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The child resources to include in the response. /// - public static RecommendedElasticPool Get(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName) + public static IList ListByServer(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, serverName, recommendedElasticPoolName).GetAwaiter().GetResult(); + return operations.ListByServerAsync(resourceGroupName, serverName, expand).GetAwaiter().GetResult(); } /// - /// Gets a recommended elastic pool. + /// Gets a list of server advisors. /// /// /// The operations group for this extension method. @@ -57,22 +57,22 @@ public static RecommendedElasticPool Get(this IRecommendedElasticPoolsOperations /// /// 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. /// - public static async Task GetAsync(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, recommendedElasticPoolName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns recommended elastic pools. + /// Gets a server advisor. /// /// /// The operations group for this extension method. @@ -84,13 +84,16 @@ public static RecommendedElasticPool Get(this IRecommendedElasticPoolsOperations /// /// The name of the server. /// - public static IEnumerable ListByServer(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName) + /// + /// The name of the Server Advisor. + /// + public static Advisor Get(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string advisorName) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, advisorName).GetAwaiter().GetResult(); } /// - /// Returns recommended elastic pools. + /// Gets a server advisor. /// /// /// The operations group for this extension method. @@ -102,19 +105,22 @@ public static IEnumerable ListByServer(this IRecommended /// /// The name of the server. /// + /// + /// The name of the Server Advisor. + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string advisorName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, advisorName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// /// /// The operations group for this extension method. @@ -126,16 +132,19 @@ public static IEnumerable ListByServer(this IRecommended /// /// The name of the server. /// - /// - /// The name of the recommended elastic pool to be retrieved. + /// + /// The name of the Server Advisor. /// - public static IEnumerable ListMetrics(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName) + /// + /// The requested advisor resource state. + /// + public static Advisor Update(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string advisorName, Advisor parameters) { - return operations.ListMetricsAsync(resourceGroupName, serverName, recommendedElasticPoolName).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serverName, advisorName, parameters).GetAwaiter().GetResult(); } /// - /// Returns recommended elastic pool metrics. + /// Updates a server advisor. /// /// /// The operations group for this extension method. @@ -147,15 +156,18 @@ public static IEnumerable ListMetrics(this IRecomm /// /// 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. /// - public static async Task> ListMetricsAsync(this IRecommendedElasticPoolsOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IServerAdvisorsOperations operations, string resourceGroupName, string serverName, string advisorName, Advisor parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListMetricsWithHttpMessagesAsync(resourceGroupName, serverName, recommendedElasticPoolName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, advisorName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAutomaticTuningOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAutomaticTuningOperations.cs index 53f679eaf559a..fa3a8337a2719 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAutomaticTuningOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAutomaticTuningOperations.cs @@ -95,7 +95,7 @@ internal ServerAutomaticTuningOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -297,7 +297,7 @@ internal ServerAutomaticTuningOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADAdministratorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADAdministratorsOperations.cs index 4b7546f19acc2..a477883f80f39 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADAdministratorsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADAdministratorsOperations.cs @@ -83,10 +83,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -95,8 +91,12 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2019-06-01-preview"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } string administratorName = "ActiveDirectory"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -104,20 +104,20 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("administratorName", administratorName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -330,10 +330,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) /// public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -342,7 +338,11 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2019-06-01-preview"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -350,18 +350,18 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -528,10 +528,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerAzureADAdministrator parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -548,8 +544,12 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { parameters.Validate(); } - string apiVersion = "2019-06-01-preview"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } string administratorName = "ActiveDirectory"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -557,21 +557,21 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("administratorName", administratorName); tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -756,10 +756,6 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -768,8 +764,12 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2019-06-01-preview"; + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } string administratorName = "ActiveDirectory"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -777,20 +777,20 @@ internal ServerAzureADAdministratorsOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("administratorName", administratorName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADOnlyAuthenticationsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADOnlyAuthenticationsOperations.cs index b0cc0491829b8..b46df4661c125 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADOnlyAuthenticationsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerAzureADOnlyAuthenticationsOperations.cs @@ -96,7 +96,7 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -344,7 +344,7 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -553,7 +553,7 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -773,7 +773,7 @@ internal ServerAzureADOnlyAuthenticationsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string authenticationName = "Default"; - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerBlobAuditingPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerBlobAuditingPoliciesOperations.cs index 9e3e362d7bdea..07ace45490fe9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerBlobAuditingPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerBlobAuditingPoliciesOperations.cs @@ -96,7 +96,7 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -319,7 +319,7 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -526,7 +526,7 @@ internal ServerBlobAuditingPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string blobAuditingPolicyName = "default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs index deda3a3b42020..0023b24274bb6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDevOpsAuditSettingsOperations.cs @@ -102,7 +102,7 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -328,7 +328,7 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -541,7 +541,7 @@ internal ServerDevOpsAuditSettingsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperations.cs index aaa2a49842453..656e9bbfc3312 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperations.cs @@ -61,7 +61,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// 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. /// /// /// Headers that will be added to request. @@ -102,7 +102,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -255,7 +255,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -265,7 +265,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// 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 headers that will be added to request. @@ -291,7 +291,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// 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 headers that will be added to request. @@ -351,7 +351,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -522,15 +522,15 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// /// The cancellation token. /// - public async Task AcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginAcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginAcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The name of the resource group that contains the resource. You can obtain @@ -540,7 +540,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// 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. /// /// /// Headers that will be added to request. @@ -581,7 +581,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -762,7 +762,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// 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. /// /// /// Headers that will be added to request. @@ -800,7 +800,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -958,6 +958,9 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -967,7 +970,7 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginAcquireWithHttpMessagesAsync(string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -985,11 +988,15 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1116,13 +1123,31 @@ internal ServerDnsAliasesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperationsExtensions.cs index d59b5f284a4e9..591e3712aeb0a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerDnsAliasesOperationsExtensions.cs @@ -35,7 +35,7 @@ public static partial class ServerDnsAliasesOperationsExtensions /// 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. /// public static ServerDnsAlias Get(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -56,7 +56,7 @@ public static ServerDnsAlias Get(this IServerDnsAliasesOperations operations, st /// 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. @@ -70,7 +70,7 @@ public static ServerDnsAlias Get(this IServerDnsAliasesOperations operations, st } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The operations group for this extension method. @@ -83,7 +83,7 @@ public static ServerDnsAlias Get(this IServerDnsAliasesOperations operations, st /// 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. /// public static ServerDnsAlias CreateOrUpdate(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -91,7 +91,7 @@ public static ServerDnsAlias CreateOrUpdate(this IServerDnsAliasesOperations ope } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The operations group for this extension method. @@ -104,7 +104,7 @@ public static ServerDnsAlias CreateOrUpdate(this IServerDnsAliasesOperations ope /// 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. @@ -131,7 +131,7 @@ public static ServerDnsAlias CreateOrUpdate(this IServerDnsAliasesOperations ope /// 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. /// public static void Delete(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -152,7 +152,7 @@ public static void Delete(this IServerDnsAliasesOperations operations, string re /// 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. @@ -222,9 +222,9 @@ public static IPage ListByServer(this IServerDnsAliasesOperation /// /// /// - public static void Acquire(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters) + public static ServerDnsAlias Acquire(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters) { - operations.AcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).GetAwaiter().GetResult(); + return operations.AcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).GetAwaiter().GetResult(); } /// @@ -248,13 +248,16 @@ public static void Acquire(this IServerDnsAliasesOperations operations, string r /// /// The cancellation token. /// - public static async Task AcquireAsync(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AcquireAsync(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.AcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.AcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The operations group for this extension method. @@ -267,7 +270,7 @@ public static void Acquire(this IServerDnsAliasesOperations operations, string r /// 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. /// public static ServerDnsAlias BeginCreateOrUpdate(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -275,7 +278,7 @@ public static ServerDnsAlias BeginCreateOrUpdate(this IServerDnsAliasesOperation } /// - /// Creates a server dns alias. + /// Creates a server DNS alias. /// /// /// The operations group for this extension method. @@ -288,7 +291,7 @@ public static ServerDnsAlias BeginCreateOrUpdate(this IServerDnsAliasesOperation /// 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. @@ -315,7 +318,7 @@ public static ServerDnsAlias BeginCreateOrUpdate(this IServerDnsAliasesOperation /// 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. /// public static void BeginDelete(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName) { @@ -336,7 +339,7 @@ public static void BeginDelete(this IServerDnsAliasesOperations operations, stri /// 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. @@ -364,9 +367,9 @@ public static void BeginDelete(this IServerDnsAliasesOperations operations, stri /// /// /// - public static void BeginAcquire(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters) + public static ServerDnsAlias BeginAcquire(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters) { - operations.BeginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).GetAwaiter().GetResult(); + return operations.BeginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).GetAwaiter().GetResult(); } /// @@ -390,9 +393,12 @@ public static void BeginAcquire(this IServerDnsAliasesOperations operations, str /// /// The cancellation token. /// - public static async Task BeginAcquireAsync(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginAcquireAsync(this IServerDnsAliasesOperations operations, string resourceGroupName, string serverName, string dnsAliasName, ServerDnsAliasAcquisition parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginAcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginAcquireWithHttpMessagesAsync(resourceGroupName, serverName, dnsAliasName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperations.cs index 98014ba2d2bee..a483c43804b5c 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperations.cs @@ -95,7 +95,7 @@ internal ServerKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -297,7 +297,7 @@ internal ServerKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -463,9 +463,9 @@ internal ServerKeysOperations(SqlManagementClient client) /// 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 + /// 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. @@ -523,9 +523,9 @@ internal ServerKeysOperations(SqlManagementClient client) /// 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 + /// 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. @@ -577,7 +577,7 @@ internal ServerKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -803,7 +803,7 @@ internal ServerKeysOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperationsExtensions.cs index 600dbf3f8eec3..aaa9e6e63847f 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerKeysOperationsExtensions.cs @@ -128,9 +128,9 @@ public static ServerKey Get(this IServerKeysOperations operations, string resour /// 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 + /// 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. @@ -157,9 +157,9 @@ public static ServerKey CreateOrUpdate(this IServerKeysOperations operations, st /// 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 + /// 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. @@ -237,9 +237,9 @@ public static void Delete(this IServerKeysOperations operations, string resource /// 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 + /// 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. @@ -266,9 +266,9 @@ public static ServerKey BeginCreateOrUpdate(this IServerKeysOperations operation /// 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 + /// 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. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperations.cs new file mode 100644 index 0000000000000..eb048373e9d6e --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperations.cs @@ -0,0 +1,422 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServerOperations operations. + /// + internal partial class ServerOperations : IServiceOperations, IServerOperations + { + /// + /// Initializes a new instance of the ServerOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServerOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/operations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of operations performed on the server. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperationsExtensions.cs new file mode 100644 index 0000000000000..02a148ef049ae --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerOperationsExtensions.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServerOperations. + /// + public static partial class ServerOperationsExtensions + { + /// + /// Gets a list of operations performed on the server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// + public static IPage ListByServer(this IServerOperations operations, string resourceGroupName, string serverName) + { + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of operations performed on the server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group 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. + /// + public static async Task> ListByServerAsync(this IServerOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of operations performed on the server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IServerOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of operations performed on the server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IServerOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs index d66ce161ec76c..86e4f2a779e96 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerSecurityAlertPoliciesOperations.cs @@ -96,7 +96,7 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string securityAlertPolicyName = "Default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -319,7 +319,7 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -526,7 +526,7 @@ internal ServerSecurityAlertPoliciesOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string securityAlertPolicyName = "Default"; - string apiVersion = "2017-03-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustGroupsOperations.cs index 9edbfc8996337..87ac5f2594004 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerTrustGroupsOperations.cs @@ -102,7 +102,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +354,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -549,7 +549,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -762,7 +762,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -988,7 +988,7 @@ internal ServerTrustGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs index d1bf7937ec977..650ccf656ca79 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServerVulnerabilityAssessmentsOperations.cs @@ -96,7 +96,7 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -305,7 +305,7 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -525,7 +525,7 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string vulnerabilityAssessmentName = "default"; - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -704,7 +704,7 @@ internal ServerVulnerabilityAssessmentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs index 6fb27c3a7ea67..ebaad2d115dbb 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperations.cs @@ -57,6 +57,9 @@ internal ServersOperations(SqlManagementClient client) /// The 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. + /// /// /// Headers that will be added to request. /// @@ -78,7 +81,7 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -88,7 +91,7 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -97,6 +100,7 @@ internal ServersOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); @@ -107,6 +111,10 @@ internal ServersOperations(SqlManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -246,6 +254,9 @@ internal ServersOperations(SqlManagementClient client) /// /// The name of the server. /// + /// + /// The child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -267,7 +278,7 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -281,7 +292,7 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -291,6 +302,7 @@ internal ServersOperations(SqlManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -302,6 +314,10 @@ internal ServersOperations(SqlManagementClient client) _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -509,6 +525,9 @@ internal ServersOperations(SqlManagementClient client) /// /// Gets a list of all servers in the subscription. /// + /// + /// The child resources to include in the response. + /// /// /// Headers that will be added to request. /// @@ -530,13 +549,13 @@ internal ServersOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -544,6 +563,7 @@ internal ServersOperations(SqlManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("expand", expand); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); @@ -553,6 +573,10 @@ internal ServersOperations(SqlManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -682,6 +706,32 @@ internal ServersOperations(SqlManagementClient client) return _result; } + /// + /// 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 headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Determines whether a resource can be created with the specified name. /// @@ -723,7 +773,7 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -876,32 +926,6 @@ internal ServersOperations(SqlManagementClient client) return _result; } - /// - /// 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 headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> ImportDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - /// /// Creates or updates a server. /// @@ -958,7 +982,7 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1175,7 +1199,7 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1359,7 +1383,7 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1572,7 +1596,7 @@ internal ServersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-02-02-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs index 89784f56684a0..c4c0511a94f4e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ServersOperationsExtensions.cs @@ -31,9 +31,12 @@ public static partial class ServersOperationsExtensions /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// - public static IPage ListByResourceGroup(this IServersOperations operations, string resourceGroupName) + /// + /// The child resources to include in the response. + /// + public static IPage ListByResourceGroup(this IServersOperations operations, string resourceGroupName, string expand = default(string)) { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + return operations.ListByResourceGroupAsync(resourceGroupName, expand).GetAwaiter().GetResult(); } /// @@ -46,12 +49,15 @@ public static IPage ListByResourceGroup(this IServersOperations operatio /// The 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. /// - public static async Task> ListByResourceGroupAsync(this IServersOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IServersOperations operations, string resourceGroupName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -70,9 +76,12 @@ public static IPage ListByResourceGroup(this IServersOperations operatio /// /// The name of the server. /// - public static Server Get(this IServersOperations operations, string resourceGroupName, string serverName) + /// + /// The child resources to include in the response. + /// + public static Server Get(this IServersOperations operations, string resourceGroupName, string serverName, string expand = default(string)) { - return operations.GetAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serverName, expand).GetAwaiter().GetResult(); } /// @@ -88,12 +97,15 @@ public static Server Get(this IServersOperations operations, string resourceGrou /// /// The name of the server. /// + /// + /// The child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IServersOperations operations, string resourceGroupName, string serverName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -240,9 +252,12 @@ public static Server Update(this IServersOperations operations, string resourceG /// /// The operations group for this extension method. /// - public static IPage List(this IServersOperations operations) + /// + /// The child resources to include in the response. + /// + public static IPage List(this IServersOperations operations, string expand = default(string)) { - return operations.ListAsync().GetAwaiter().GetResult(); + return operations.ListAsync(expand).GetAwaiter().GetResult(); } /// @@ -251,94 +266,97 @@ public static IPage List(this IServersOperations operations) /// /// The operations group for this extension method. /// + /// + /// The child resources to include in the response. + /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IServersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IServersOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Determines whether a resource can be created with the specified name. + /// Imports a bacpac into a new database. /// /// /// The operations group for this extension method. /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// /// - /// The name availability request parameters. + /// The database import request parameters. /// - public static CheckNameAvailabilityResponse CheckNameAvailability(this IServersOperations operations, CheckNameAvailabilityRequest parameters) + public static ImportExportOperationResult ImportDatabase(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) { - return operations.CheckNameAvailabilityAsync(parameters).GetAwaiter().GetResult(); + return operations.ImportDatabaseAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } /// - /// Determines whether a resource can be created with the specified name. + /// Imports a bacpac into a new database. /// /// /// The operations group for this extension method. /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the server. + /// /// - /// The name availability request parameters. + /// The database import request parameters. /// /// /// The cancellation token. /// - public static async Task CheckNameAvailabilityAsync(this IServersOperations operations, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ImportDatabaseAsync(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Imports a bacpac into a new database. + /// Determines whether a resource can be created with the specified name. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group 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 name availability request parameters. /// - public static ImportExportOperationResult ImportDatabase(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters) + public static CheckNameAvailabilityResponse CheckNameAvailability(this IServersOperations operations, CheckNameAvailabilityRequest parameters) { - return operations.ImportDatabaseAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); + return operations.CheckNameAvailabilityAsync(parameters).GetAwaiter().GetResult(); } /// - /// Imports a bacpac into a new database. + /// Determines whether a resource can be created with the specified name. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group 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 name availability request parameters. /// /// /// The cancellation token. /// - public static async Task ImportDatabaseAsync(this IServersOperations operations, string resourceGroupName, string serverName, ImportNewDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CheckNameAvailabilityAsync(this IServersOperations operations, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ImportDatabaseWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperations.cs similarity index 79% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperations.cs index 00564efdc5045..17ac882a160e2 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/DatabaseThreatDetectionPoliciesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// DatabaseThreatDetectionPoliciesOperations operations. + /// SqlAgentOperations operations. /// - internal partial class DatabaseThreatDetectionPoliciesOperations : IServiceOperations, IDatabaseThreatDetectionPoliciesOperations + internal partial class SqlAgentOperations : IServiceOperations, ISqlAgentOperations { /// - /// Initializes a new instance of the DatabaseThreatDetectionPoliciesOperations class. + /// Initializes a new instance of the SqlAgentOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class DatabaseThreatDetectionPoliciesOperations : IServiceOpera /// /// Thrown when a required parameter is null /// - internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) + internal SqlAgentOperations(SqlManagementClient client) { if (client == null) { @@ -51,18 +51,14 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) public SqlManagementClient Client { get; private set; } /// - /// Gets a database's threat detection policy. + /// 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 server. - /// - /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// + /// The name of the managed instance. /// /// /// Headers that will be added to request. @@ -85,26 +81,21 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (serverName == null) + if (managedInstanceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); } - if (databaseName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string securityAlertPolicyName = "default"; - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -113,21 +104,17 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/sqlAgent/current").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -226,7 +213,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -239,7 +226,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -259,21 +246,16 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) } /// - /// Creates or updates a database's threat detection policy. + /// 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 server. - /// - /// - /// The name of the database for which database Threat Detection policy is - /// defined. + /// + /// The name of the managed instance. /// /// - /// The database Threat Detection policy. /// /// /// Headers that will be added to request. @@ -296,34 +278,25 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (serverName == null) + if (managedInstanceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (databaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (parameters != null) + if (Client.SubscriptionId == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string securityAlertPolicyName = "default"; - string apiVersion = "2014-04-01"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -332,9 +305,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("databaseName", databaseName); - tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + tracingParameters.Add("managedInstanceName", managedInstanceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); @@ -342,12 +313,10 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/sqlAgent/current").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); - _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) { @@ -417,7 +386,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -452,7 +421,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -465,25 +434,7 @@ internal DatabaseThreatDetectionPoliciesOperations(SqlManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperationsExtensions.cs similarity index 50% rename from sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperationsExtensions.cs rename to sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperationsExtensions.cs index 256cedb55dd0a..05a0eb37d52fd 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/ImportExportOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlAgentOperationsExtensions.cs @@ -17,12 +17,12 @@ namespace Microsoft.Azure.Management.Sql using System.Threading.Tasks; /// - /// Extension methods for ImportExportOperations. + /// Extension methods for SqlAgentOperations. /// - public static partial class ImportExportOperationsExtensions + public static partial class SqlAgentOperationsExtensions { /// - /// Imports a bacpac into a new database. + /// Gets current instance sql agent configuration. /// /// /// The operations group for this extension method. @@ -31,22 +31,16 @@ public static partial class ImportExportOperationsExtensions /// The name of the resource group that contains the resource. You can obtain /// this value from the Azure Resource Manager API or the portal. /// - /// - /// The name of the server. + /// + /// The name of the managed instance. /// - /// - /// The name of the database. - /// - /// - /// The database import request parameters. - /// - public static ImportExportOperationResult Import(this IImportExportOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) + public static SqlAgentConfiguration Get(this ISqlAgentOperations operations, string resourceGroupName, string managedInstanceName) { - return operations.ImportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); } /// - /// Imports a bacpac into a new database. + /// Gets current instance sql agent configuration. /// /// /// The operations group for this extension method. @@ -55,28 +49,22 @@ public static ImportExportOperationResult Import(this IImportExportOperations op /// The name of the resource group that contains the 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 name of the managed instance. /// /// /// The cancellation token. /// - public static async Task ImportAsync(this IImportExportOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ISqlAgentOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Imports a bacpac into a new database. + /// Puts new sql agent configuration to instance. /// /// /// The operations group for this extension method. @@ -85,22 +73,18 @@ public static ImportExportOperationResult Import(this IImportExportOperations op /// The name of the resource group that contains the 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 managed instance. /// /// - /// The database import request parameters. /// - public static ImportExportOperationResult BeginImport(this IImportExportOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters) + public static SqlAgentConfiguration CreateOrUpdate(this ISqlAgentOperations operations, string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters) { - return operations.BeginImportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).GetAwaiter().GetResult(); } /// - /// Imports a bacpac into a new database. + /// Puts new sql agent configuration to instance. /// /// /// The operations group for this extension method. @@ -109,21 +93,17 @@ public static ImportExportOperationResult BeginImport(this IImportExportOperatio /// The name of the resource group that contains the 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 managed instance. /// /// - /// The database import request parameters. /// /// /// The cancellation token. /// - public static async Task BeginImportAsync(this IImportExportOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExistingDatabaseDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ISqlAgentOperations operations, string resourceGroupName, string managedInstanceName, SqlAgentConfiguration parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs index 4b4f8b14b5827..075753414de7a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SqlManagementClient.cs @@ -77,21 +77,11 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IRecoverableDatabasesOperations RecoverableDatabases { get; private set; } - /// - /// Gets the IRestorableDroppedDatabasesOperations. - /// - public virtual IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; private set; } - /// /// Gets the IServerConnectionPoliciesOperations. /// public virtual IServerConnectionPoliciesOperations ServerConnectionPolicies { get; private set; } - /// - /// Gets the IDatabaseThreatDetectionPoliciesOperations. - /// - public virtual IDatabaseThreatDetectionPoliciesOperations DatabaseThreatDetectionPolicies { get; private set; } - /// /// Gets the IDataMaskingPoliciesOperations. /// @@ -102,11 +92,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IDataMaskingRulesOperations DataMaskingRules { get; private set; } - /// - /// Gets the IFirewallRulesOperations. - /// - public virtual IFirewallRulesOperations FirewallRules { get; private set; } - /// /// Gets the IGeoBackupPoliciesOperations. /// @@ -122,11 +107,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IElasticPoolsOperations ElasticPools { get; private set; } - /// - /// Gets the IRecommendedElasticPoolsOperations. - /// - public virtual IRecommendedElasticPoolsOperations RecommendedElasticPools { get; private set; } - /// /// Gets the IReplicationLinksOperations. /// @@ -152,11 +132,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IElasticPoolDatabaseActivitiesOperations ElasticPoolDatabaseActivities { get; private set; } - /// - /// Gets the IServiceTierAdvisorsOperations. - /// - public virtual IServiceTierAdvisorsOperations ServiceTierAdvisors { get; private set; } - /// /// Gets the ITransparentDataEncryptionsOperations. /// @@ -173,74 +148,84 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IServerUsagesOperations ServerUsages { get; private set; } /// - /// Gets the IDatabaseUsagesOperations. + /// Gets the IUsagesOperations. /// - public virtual IDatabaseUsagesOperations DatabaseUsages { get; private set; } + public virtual IUsagesOperations Usages { get; private set; } /// - /// Gets the IDatabaseAutomaticTuningOperations. + /// Gets the IBackupShortTermRetentionPoliciesOperations. /// - public virtual IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { get; private set; } + public virtual IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; private set; } /// - /// Gets the IEncryptionProtectorsOperations. + /// Gets the IExtendedDatabaseBlobAuditingPoliciesOperations. /// - public virtual IEncryptionProtectorsOperations EncryptionProtectors { get; private set; } + public virtual IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; private set; } /// - /// Gets the IFailoverGroupsOperations. + /// Gets the IExtendedServerBlobAuditingPoliciesOperations. /// - public virtual IFailoverGroupsOperations FailoverGroups { get; private set; } + public virtual IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; private set; } /// - /// Gets the IOperations. + /// Gets the IServerBlobAuditingPoliciesOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; private set; } /// - /// Gets the IServerKeysOperations. + /// Gets the IDatabaseBlobAuditingPoliciesOperations. /// - public virtual IServerKeysOperations ServerKeys { get; private set; } + public virtual IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; private set; } /// - /// Gets the ISyncAgentsOperations. + /// Gets the IDatabaseAdvisorsOperations. /// - public virtual ISyncAgentsOperations SyncAgents { get; private set; } + public virtual IDatabaseAdvisorsOperations DatabaseAdvisors { get; private set; } /// - /// Gets the ISubscriptionUsagesOperations. + /// Gets the IDatabaseAutomaticTuningOperations. /// - public virtual ISubscriptionUsagesOperations SubscriptionUsages { get; private set; } + public virtual IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { get; private set; } /// - /// Gets the IVirtualClustersOperations. + /// Gets the IDatabaseColumnsOperations. /// - public virtual IVirtualClustersOperations VirtualClusters { get; private set; } + public virtual IDatabaseColumnsOperations DatabaseColumns { get; private set; } /// - /// Gets the IVirtualNetworkRulesOperations. + /// Gets the IDatabaseExtensionsOperations. /// - public virtual IVirtualNetworkRulesOperations VirtualNetworkRules { get; private set; } + public virtual IDatabaseExtensionsOperations DatabaseExtensions { get; private set; } /// - /// Gets the IExtendedDatabaseBlobAuditingPoliciesOperations. + /// Gets the IDatabaseOperations. /// - public virtual IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; private set; } + public virtual IDatabaseOperations DatabaseOperations { get; private set; } /// - /// Gets the IExtendedServerBlobAuditingPoliciesOperations. + /// Gets the IDatabaseRecommendedActionsOperations. /// - public virtual IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; private set; } + public virtual IDatabaseRecommendedActionsOperations DatabaseRecommendedActions { get; private set; } /// - /// Gets the IServerBlobAuditingPoliciesOperations. + /// Gets the IDatabaseSchemasOperations. /// - public virtual IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; private set; } + public virtual IDatabaseSchemasOperations DatabaseSchemas { get; private set; } /// - /// Gets the IDatabaseBlobAuditingPoliciesOperations. + /// Gets the IDatabaseSecurityAlertPoliciesOperations. /// - public virtual IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; private set; } + public virtual IDatabaseSecurityAlertPoliciesOperations DatabaseSecurityAlertPolicies { get; private set; } + + /// + /// Gets the IDatabaseTablesOperations. + /// + public virtual IDatabaseTablesOperations DatabaseTables { get; private set; } + + /// + /// Gets the IDatabaseUsagesOperations. + /// + public virtual IDatabaseUsagesOperations DatabaseUsages { get; private set; } /// /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. @@ -252,6 +237,51 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual IDatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments { get; private set; } + /// + /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. + /// + public virtual IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; private set; } + + /// + /// Gets the IDataWarehouseUserActivitiesOperations. + /// + public virtual IDataWarehouseUserActivitiesOperations DataWarehouseUserActivities { get; private set; } + + /// + /// Gets the IDeletedServersOperations. + /// + public virtual IDeletedServersOperations DeletedServers { get; private set; } + + /// + /// Gets the IElasticPoolOperations. + /// + public virtual IElasticPoolOperations ElasticPoolOperations { get; private set; } + + /// + /// Gets the IEncryptionProtectorsOperations. + /// + public virtual IEncryptionProtectorsOperations EncryptionProtectors { get; private set; } + + /// + /// Gets the IFailoverGroupsOperations. + /// + public virtual IFailoverGroupsOperations FailoverGroups { get; private set; } + + /// + /// Gets the IFirewallRulesOperations. + /// + public virtual IFirewallRulesOperations FirewallRules { get; private set; } + + /// + /// Gets the IInstanceFailoverGroupsOperations. + /// + public virtual IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; private set; } + + /// + /// Gets the IInstancePoolsOperations. + /// + public virtual IInstancePoolsOperations InstancePools { get; private set; } + /// /// Gets the IJobAgentsOperations. /// @@ -298,84 +328,99 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IJobVersionsOperations JobVersions { get; private set; } /// - /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. + /// Gets the ICapabilitiesOperations. /// - public virtual IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; private set; } + public virtual ICapabilitiesOperations Capabilities { get; private set; } /// - /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. + /// Gets the ILongTermRetentionBackupsOperations. /// - public virtual IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; private set; } + public virtual ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; private set; } /// - /// Gets the IServerAutomaticTuningOperations. + /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. /// - public virtual IServerAutomaticTuningOperations ServerAutomaticTuning { get; private set; } + public virtual ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; private set; } /// - /// Gets the IServerDnsAliasesOperations. + /// Gets the ILongTermRetentionPoliciesOperations. /// - public virtual IServerDnsAliasesOperations ServerDnsAliases { get; private set; } + public virtual ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; private set; } /// - /// Gets the IServerSecurityAlertPoliciesOperations. + /// Gets the IMaintenanceWindowOptionsOperations. /// - public virtual IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; private set; } + public virtual IMaintenanceWindowOptionsOperations MaintenanceWindowOptions { get; private set; } /// - /// Gets the IRestorableDroppedManagedDatabasesOperations. + /// Gets the IMaintenanceWindowsOperations. /// - public virtual IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; private set; } + public virtual IMaintenanceWindowsOperations MaintenanceWindows { get; private set; } /// - /// Gets the IRestorePointsOperations. + /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. /// - public virtual IRestorePointsOperations RestorePoints { get; private set; } + public virtual IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; private set; } /// - /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseColumnsOperations. /// - public virtual IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; private set; } + public virtual IManagedDatabaseColumnsOperations ManagedDatabaseColumns { get; private set; } /// - /// Gets the IManagedServerSecurityAlertPoliciesOperations. + /// Gets the IManagedDatabaseQueriesOperations. /// - public virtual IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; private set; } + public virtual IManagedDatabaseQueriesOperations ManagedDatabaseQueries { get; private set; } /// - /// Gets the ISensitivityLabelsOperations. + /// Gets the IManagedDatabaseRestoreDetailsOperations. /// - public virtual ISensitivityLabelsOperations SensitivityLabels { get; private set; } + public virtual IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; private set; } /// - /// Gets the IManagedInstanceAdministratorsOperations. + /// Gets the IManagedDatabasesOperations. /// - public virtual IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; private set; } + public virtual IManagedDatabasesOperations ManagedDatabases { get; private set; } /// - /// Gets the IDatabaseOperations. + /// Gets the IManagedDatabaseSchemasOperations. /// - public virtual IDatabaseOperations DatabaseOperations { get; private set; } + public virtual IManagedDatabaseSchemasOperations ManagedDatabaseSchemas { get; private set; } /// - /// Gets the IElasticPoolOperations. + /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. /// - public virtual IElasticPoolOperations ElasticPoolOperations { get; private set; } + public virtual IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; private set; } /// - /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. + /// Gets the IManagedDatabaseSecurityEventsOperations. /// - public virtual IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; private set; } + public virtual IManagedDatabaseSecurityEventsOperations ManagedDatabaseSecurityEvents { get; private set; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. + /// Gets the IManagedDatabaseSensitivityLabelsOperations. /// - public virtual IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; private set; } + public virtual IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; private set; } /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. + /// Gets the IManagedDatabaseRecommendedSensitivityLabelsOperations. /// - public virtual IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; private set; } + public virtual IManagedDatabaseRecommendedSensitivityLabelsOperations ManagedDatabaseRecommendedSensitivityLabels { get; private set; } + + /// + /// Gets the IManagedDatabaseTablesOperations. + /// + public virtual IManagedDatabaseTablesOperations ManagedDatabaseTables { get; private set; } + + /// + /// Gets the IManagedDatabaseTransparentDataEncryptionOperations. + /// + public virtual IManagedDatabaseTransparentDataEncryptionOperations ManagedDatabaseTransparentDataEncryption { get; private set; } + + /// + /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. + /// + public virtual IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; private set; } /// /// Gets the IManagedDatabaseVulnerabilityAssessmentsOperations. @@ -383,19 +428,24 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IManagedDatabaseVulnerabilityAssessmentsOperations ManagedDatabaseVulnerabilityAssessments { get; private set; } /// - /// Gets the IInstanceFailoverGroupsOperations. + /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. /// - public virtual IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; private set; } + public virtual IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; private set; } /// - /// Gets the ITdeCertificatesOperations. + /// Gets the IManagedInstanceAdministratorsOperations. /// - public virtual ITdeCertificatesOperations TdeCertificates { get; private set; } + public virtual IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; private set; } /// - /// Gets the IManagedInstanceTdeCertificatesOperations. + /// Gets the IManagedInstanceAzureADOnlyAuthenticationsOperations. /// - public virtual IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; private set; } + public virtual IManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications { get; private set; } + + /// + /// Gets the IManagedInstanceEncryptionProtectorsOperations. + /// + public virtual IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; private set; } /// /// Gets the IManagedInstanceKeysOperations. @@ -403,19 +453,34 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IManagedInstanceKeysOperations ManagedInstanceKeys { get; private set; } /// - /// Gets the IManagedInstanceEncryptionProtectorsOperations. + /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. /// - public virtual IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; private set; } + public virtual IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; private set; } /// - /// Gets the IRecoverableManagedDatabasesOperations. + /// Gets the IManagedInstanceOperations. /// - public virtual IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; private set; } + public virtual IManagedInstanceOperations ManagedInstanceOperations { get; private set; } /// - /// Gets the IBackupShortTermRetentionPoliciesOperations. + /// Gets the IManagedInstancePrivateEndpointConnectionsOperations. /// - public virtual IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; private set; } + public virtual IManagedInstancePrivateEndpointConnectionsOperations ManagedInstancePrivateEndpointConnections { get; private set; } + + /// + /// Gets the IManagedInstancePrivateLinkResourcesOperations. + /// + public virtual IManagedInstancePrivateLinkResourcesOperations ManagedInstancePrivateLinkResources { get; private set; } + + /// + /// Gets the IManagedInstancesOperations. + /// + public virtual IManagedInstancesOperations ManagedInstances { get; private set; } + + /// + /// Gets the IManagedInstanceTdeCertificatesOperations. + /// + public virtual IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; private set; } /// /// Gets the IManagedInstanceVulnerabilityAssessmentsOperations. @@ -423,24 +488,29 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IManagedInstanceVulnerabilityAssessmentsOperations ManagedInstanceVulnerabilityAssessments { get; private set; } /// - /// Gets the IServerVulnerabilityAssessmentsOperations. + /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. /// - public virtual IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; private set; } + public virtual IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; private set; } /// - /// Gets the IManagedDatabaseSensitivityLabelsOperations. + /// Gets the IManagedServerSecurityAlertPoliciesOperations. /// - public virtual IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; private set; } + public virtual IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; private set; } /// - /// Gets the IInstancePoolsOperations. + /// Gets the IOperations. /// - public virtual IInstancePoolsOperations InstancePools { get; private set; } + public virtual IOperations Operations { get; private set; } /// - /// Gets the IUsagesOperations. + /// Gets the IOperationsHealthOperations. /// - public virtual IUsagesOperations Usages { get; private set; } + public virtual IOperationsHealthOperations OperationsHealth { get; private set; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } /// /// Gets the IPrivateLinkResourcesOperations. @@ -448,84 +518,84 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } /// - /// Gets the IServersOperations. + /// Gets the IRecoverableManagedDatabasesOperations. /// - public virtual IServersOperations Servers { get; private set; } + public virtual IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; private set; } /// - /// Gets the ICapabilitiesOperations. + /// Gets the IRestorableDroppedDatabasesOperations. /// - public virtual ICapabilitiesOperations Capabilities { get; private set; } + public virtual IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; private set; } /// - /// Gets the ILongTermRetentionManagedInstanceBackupsOperations. + /// Gets the IRestorableDroppedManagedDatabasesOperations. /// - public virtual ILongTermRetentionManagedInstanceBackupsOperations LongTermRetentionManagedInstanceBackups { get; private set; } + public virtual IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; private set; } /// - /// Gets the IManagedInstanceLongTermRetentionPoliciesOperations. + /// Gets the IRestorePointsOperations. /// - public virtual IManagedInstanceLongTermRetentionPoliciesOperations ManagedInstanceLongTermRetentionPolicies { get; private set; } + public virtual IRestorePointsOperations RestorePoints { get; private set; } /// - /// Gets the IWorkloadGroupsOperations. + /// Gets the ISensitivityLabelsOperations. /// - public virtual IWorkloadGroupsOperations WorkloadGroups { get; private set; } + public virtual ISensitivityLabelsOperations SensitivityLabels { get; private set; } /// - /// Gets the IWorkloadClassifiersOperations. + /// Gets the IRecommendedSensitivityLabelsOperations. /// - public virtual IWorkloadClassifiersOperations WorkloadClassifiers { get; private set; } + public virtual IRecommendedSensitivityLabelsOperations RecommendedSensitivityLabels { get; private set; } /// - /// Gets the IManagedInstanceOperations. + /// Gets the IServerAdvisorsOperations. /// - public virtual IManagedInstanceOperations ManagedInstanceOperations { get; private set; } + public virtual IServerAdvisorsOperations ServerAdvisors { get; private set; } /// - /// Gets the IServerAzureADAdministratorsOperations. + /// Gets the IServerAutomaticTuningOperations. /// - public virtual IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; private set; } + public virtual IServerAutomaticTuningOperations ServerAutomaticTuning { get; private set; } /// - /// Gets the ISyncGroupsOperations. + /// Gets the IServerAzureADAdministratorsOperations. /// - public virtual ISyncGroupsOperations SyncGroups { get; private set; } + public virtual IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; private set; } /// - /// Gets the ISyncMembersOperations. + /// Gets the IServerAzureADOnlyAuthenticationsOperations. /// - public virtual ISyncMembersOperations SyncMembers { get; private set; } + public virtual IServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications { get; private set; } /// - /// Gets the IImportExportOperations. + /// Gets the IServerDevOpsAuditSettingsOperations. /// - public virtual IImportExportOperations ImportExport { get; private set; } + public virtual IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; private set; } /// - /// Gets the IManagedDatabasesOperations. + /// Gets the IServerDnsAliasesOperations. /// - public virtual IManagedDatabasesOperations ManagedDatabases { get; private set; } + public virtual IServerDnsAliasesOperations ServerDnsAliases { get; private set; } /// - /// Gets the IManagedDatabaseRestoreDetailsOperations. + /// Gets the IServerKeysOperations. /// - public virtual IManagedDatabaseRestoreDetailsOperations ManagedDatabaseRestoreDetails { get; private set; } + public virtual IServerKeysOperations ServerKeys { get; private set; } /// - /// Gets the IServerAzureADOnlyAuthenticationsOperations. + /// Gets the IServerOperations. /// - public virtual IServerAzureADOnlyAuthenticationsOperations ServerAzureADOnlyAuthentications { get; private set; } + public virtual IServerOperations ServerOperations { get; private set; } /// - /// Gets the IManagedInstancesOperations. + /// Gets the IServersOperations. /// - public virtual IManagedInstancesOperations ManagedInstances { get; private set; } + public virtual IServersOperations Servers { get; private set; } /// - /// Gets the IManagedInstanceAzureADOnlyAuthenticationsOperations. + /// Gets the IServerSecurityAlertPoliciesOperations. /// - public virtual IManagedInstanceAzureADOnlyAuthenticationsOperations ManagedInstanceAzureADOnlyAuthentications { get; private set; } + public virtual IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; private set; } /// /// Gets the IServerTrustGroupsOperations. @@ -533,24 +603,64 @@ public partial class SqlManagementClient : ServiceClient, I public virtual IServerTrustGroupsOperations ServerTrustGroups { get; private set; } /// - /// Gets the IServerDevOpsAuditSettingsOperations. + /// Gets the IServerVulnerabilityAssessmentsOperations. /// - public virtual IServerDevOpsAuditSettingsOperations ServerDevOpsAuditSettings { get; private set; } + public virtual IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; private set; } /// - /// Gets the ILongTermRetentionBackupsOperations. + /// Gets the ISqlAgentOperations. /// - public virtual ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; private set; } + public virtual ISqlAgentOperations SqlAgent { get; private set; } /// - /// Gets the ILongTermRetentionPoliciesOperations. + /// Gets the ISubscriptionUsagesOperations. /// - public virtual ILongTermRetentionPoliciesOperations LongTermRetentionPolicies { get; private set; } + public virtual ISubscriptionUsagesOperations SubscriptionUsages { get; private set; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the ISyncAgentsOperations. /// - public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + public virtual ISyncAgentsOperations SyncAgents { get; private set; } + + /// + /// Gets the ISyncGroupsOperations. + /// + public virtual ISyncGroupsOperations SyncGroups { get; private set; } + + /// + /// Gets the ISyncMembersOperations. + /// + public virtual ISyncMembersOperations SyncMembers { get; private set; } + + /// + /// Gets the ITdeCertificatesOperations. + /// + public virtual ITdeCertificatesOperations TdeCertificates { get; private set; } + + /// + /// Gets the ITimeZonesOperations. + /// + public virtual ITimeZonesOperations TimeZones { get; private set; } + + /// + /// Gets the IVirtualClustersOperations. + /// + public virtual IVirtualClustersOperations VirtualClusters { get; private set; } + + /// + /// Gets the IVirtualNetworkRulesOperations. + /// + public virtual IVirtualNetworkRulesOperations VirtualNetworkRules { get; private set; } + + /// + /// Gets the IWorkloadClassifiersOperations. + /// + public virtual IWorkloadClassifiersOperations WorkloadClassifiers { get; private set; } + + /// + /// Gets the IWorkloadGroupsOperations. + /// + public virtual IWorkloadGroupsOperations WorkloadGroups { get; private set; } /// /// Initializes a new instance of the SqlManagementClient class. @@ -794,41 +904,47 @@ public SqlManagementClient(System.Uri baseUri, ServiceClientCredentials credenti private void Initialize() { RecoverableDatabases = new RecoverableDatabasesOperations(this); - RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); ServerConnectionPolicies = new ServerConnectionPoliciesOperations(this); - DatabaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesOperations(this); DataMaskingPolicies = new DataMaskingPoliciesOperations(this); DataMaskingRules = new DataMaskingRulesOperations(this); - FirewallRules = new FirewallRulesOperations(this); GeoBackupPolicies = new GeoBackupPoliciesOperations(this); Databases = new DatabasesOperations(this); ElasticPools = new ElasticPoolsOperations(this); - RecommendedElasticPools = new RecommendedElasticPoolsOperations(this); ReplicationLinks = new ReplicationLinksOperations(this); ServerCommunicationLinks = new ServerCommunicationLinksOperations(this); ServiceObjectives = new ServiceObjectivesOperations(this); ElasticPoolActivities = new ElasticPoolActivitiesOperations(this); ElasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesOperations(this); - ServiceTierAdvisors = new ServiceTierAdvisorsOperations(this); TransparentDataEncryptions = new TransparentDataEncryptionsOperations(this); TransparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesOperations(this); ServerUsages = new ServerUsagesOperations(this); - DatabaseUsages = new DatabaseUsagesOperations(this); - DatabaseAutomaticTuning = new DatabaseAutomaticTuningOperations(this); - EncryptionProtectors = new EncryptionProtectorsOperations(this); - FailoverGroups = new FailoverGroupsOperations(this); - Operations = new Operations(this); - ServerKeys = new ServerKeysOperations(this); - SyncAgents = new SyncAgentsOperations(this); - SubscriptionUsages = new SubscriptionUsagesOperations(this); - VirtualClusters = new VirtualClustersOperations(this); - VirtualNetworkRules = new VirtualNetworkRulesOperations(this); + Usages = new UsagesOperations(this); + BackupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesOperations(this); ExtendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesOperations(this); ExtendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesOperations(this); ServerBlobAuditingPolicies = new ServerBlobAuditingPoliciesOperations(this); DatabaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesOperations(this); + DatabaseAdvisors = new DatabaseAdvisorsOperations(this); + DatabaseAutomaticTuning = new DatabaseAutomaticTuningOperations(this); + DatabaseColumns = new DatabaseColumnsOperations(this); + DatabaseExtensions = new DatabaseExtensionsOperations(this); + DatabaseOperations = new DatabaseOperations(this); + DatabaseRecommendedActions = new DatabaseRecommendedActionsOperations(this); + DatabaseSchemas = new DatabaseSchemasOperations(this); + DatabaseSecurityAlertPolicies = new DatabaseSecurityAlertPoliciesOperations(this); + DatabaseTables = new DatabaseTablesOperations(this); + DatabaseUsages = new DatabaseUsagesOperations(this); DatabaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesOperations(this); DatabaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsOperations(this); + DatabaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansOperations(this); + DataWarehouseUserActivities = new DataWarehouseUserActivitiesOperations(this); + DeletedServers = new DeletedServersOperations(this); + ElasticPoolOperations = new ElasticPoolOperations(this); + EncryptionProtectors = new EncryptionProtectorsOperations(this); + FailoverGroups = new FailoverGroupsOperations(this); + FirewallRules = new FirewallRulesOperations(this); + InstanceFailoverGroups = new InstanceFailoverGroupsOperations(this); + InstancePools = new InstancePoolsOperations(this); JobAgents = new JobAgentsOperations(this); JobCredentials = new JobCredentialsOperations(this); JobExecutions = new JobExecutionsOperations(this); @@ -838,57 +954,73 @@ private void Initialize() JobTargetExecutions = new JobTargetExecutionsOperations(this); JobTargetGroups = new JobTargetGroupsOperations(this); JobVersions = new JobVersionsOperations(this); + Capabilities = new CapabilitiesOperations(this); + LongTermRetentionBackups = new LongTermRetentionBackupsOperations(this); + LongTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsOperations(this); + LongTermRetentionPolicies = new LongTermRetentionPoliciesOperations(this); + MaintenanceWindowOptions = new MaintenanceWindowOptionsOperations(this); + MaintenanceWindows = new MaintenanceWindowsOperations(this); ManagedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesOperations(this); - ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations(this); - ServerAutomaticTuning = new ServerAutomaticTuningOperations(this); - ServerDnsAliases = new ServerDnsAliasesOperations(this); - ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); - RestorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesOperations(this); - RestorePoints = new RestorePointsOperations(this); + ManagedDatabaseColumns = new ManagedDatabaseColumnsOperations(this); + ManagedDatabaseQueries = new ManagedDatabaseQueriesOperations(this); + ManagedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsOperations(this); + ManagedDatabases = new ManagedDatabasesOperations(this); + ManagedDatabaseSchemas = new ManagedDatabaseSchemasOperations(this); ManagedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesOperations(this); - ManagedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesOperations(this); - SensitivityLabels = new SensitivityLabelsOperations(this); - ManagedInstanceAdministrators = new ManagedInstanceAdministratorsOperations(this); - DatabaseOperations = new DatabaseOperations(this); - ElasticPoolOperations = new ElasticPoolOperations(this); - DatabaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansOperations(this); + ManagedDatabaseSecurityEvents = new ManagedDatabaseSecurityEventsOperations(this); + ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); + ManagedDatabaseRecommendedSensitivityLabels = new ManagedDatabaseRecommendedSensitivityLabelsOperations(this); + ManagedDatabaseTables = new ManagedDatabaseTablesOperations(this); + ManagedDatabaseTransparentDataEncryption = new ManagedDatabaseTransparentDataEncryptionOperations(this); ManagedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(this); - ManagedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansOperations(this); ManagedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsOperations(this); - InstanceFailoverGroups = new InstanceFailoverGroupsOperations(this); - TdeCertificates = new TdeCertificatesOperations(this); - ManagedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesOperations(this); - ManagedInstanceKeys = new ManagedInstanceKeysOperations(this); + ManagedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansOperations(this); + ManagedInstanceAdministrators = new ManagedInstanceAdministratorsOperations(this); + ManagedInstanceAzureADOnlyAuthentications = new ManagedInstanceAzureADOnlyAuthenticationsOperations(this); ManagedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsOperations(this); - RecoverableManagedDatabases = new RecoverableManagedDatabasesOperations(this); - BackupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesOperations(this); - ManagedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsOperations(this); - ServerVulnerabilityAssessments = new ServerVulnerabilityAssessmentsOperations(this); - ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); - InstancePools = new InstancePoolsOperations(this); - Usages = new UsagesOperations(this); - PrivateLinkResources = new PrivateLinkResourcesOperations(this); - Servers = new ServersOperations(this); - Capabilities = new CapabilitiesOperations(this); - LongTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsOperations(this); + ManagedInstanceKeys = new ManagedInstanceKeysOperations(this); ManagedInstanceLongTermRetentionPolicies = new ManagedInstanceLongTermRetentionPoliciesOperations(this); - WorkloadGroups = new WorkloadGroupsOperations(this); - WorkloadClassifiers = new WorkloadClassifiersOperations(this); ManagedInstanceOperations = new ManagedInstanceOperations(this); + ManagedInstancePrivateEndpointConnections = new ManagedInstancePrivateEndpointConnectionsOperations(this); + ManagedInstancePrivateLinkResources = new ManagedInstancePrivateLinkResourcesOperations(this); + ManagedInstances = new ManagedInstancesOperations(this); + ManagedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesOperations(this); + ManagedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsOperations(this); + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations(this); + ManagedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesOperations(this); + Operations = new Operations(this); + OperationsHealth = new OperationsHealthOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); + RecoverableManagedDatabases = new RecoverableManagedDatabasesOperations(this); + RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); + RestorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesOperations(this); + RestorePoints = new RestorePointsOperations(this); + SensitivityLabels = new SensitivityLabelsOperations(this); + RecommendedSensitivityLabels = new RecommendedSensitivityLabelsOperations(this); + ServerAdvisors = new ServerAdvisorsOperations(this); + ServerAutomaticTuning = new ServerAutomaticTuningOperations(this); ServerAzureADAdministrators = new ServerAzureADAdministratorsOperations(this); - SyncGroups = new SyncGroupsOperations(this); - SyncMembers = new SyncMembersOperations(this); - ImportExport = new ImportExportOperations(this); - ManagedDatabases = new ManagedDatabasesOperations(this); - ManagedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsOperations(this); ServerAzureADOnlyAuthentications = new ServerAzureADOnlyAuthenticationsOperations(this); - ManagedInstances = new ManagedInstancesOperations(this); - ManagedInstanceAzureADOnlyAuthentications = new ManagedInstanceAzureADOnlyAuthenticationsOperations(this); - ServerTrustGroups = new ServerTrustGroupsOperations(this); ServerDevOpsAuditSettings = new ServerDevOpsAuditSettingsOperations(this); - LongTermRetentionBackups = new LongTermRetentionBackupsOperations(this); - LongTermRetentionPolicies = new LongTermRetentionPoliciesOperations(this); - PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + ServerDnsAliases = new ServerDnsAliasesOperations(this); + ServerKeys = new ServerKeysOperations(this); + ServerOperations = new ServerOperations(this); + Servers = new ServersOperations(this); + ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); + ServerTrustGroups = new ServerTrustGroupsOperations(this); + ServerVulnerabilityAssessments = new ServerVulnerabilityAssessmentsOperations(this); + SqlAgent = new SqlAgentOperations(this); + SubscriptionUsages = new SubscriptionUsagesOperations(this); + SyncAgents = new SyncAgentsOperations(this); + SyncGroups = new SyncGroupsOperations(this); + SyncMembers = new SyncMembersOperations(this); + TdeCertificates = new TdeCertificatesOperations(this); + TimeZones = new TimeZonesOperations(this); + VirtualClusters = new VirtualClustersOperations(this); + VirtualNetworkRules = new VirtualNetworkRulesOperations(this); + WorkloadClassifiers = new WorkloadClassifiersOperations(this); + WorkloadGroups = new WorkloadGroupsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SubscriptionUsagesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SubscriptionUsagesOperations.cs index bb1f5687eef5c..2a37432e91635 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SubscriptionUsagesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SubscriptionUsagesOperations.cs @@ -87,7 +87,7 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -279,7 +279,7 @@ internal SubscriptionUsagesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncAgentsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncAgentsOperations.cs index 7a923e9f4ef58..771b5a8e751ff 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncAgentsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncAgentsOperations.cs @@ -102,7 +102,7 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +354,7 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -556,7 +556,7 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -760,7 +760,7 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -971,7 +971,7 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1197,7 +1197,7 @@ internal SyncAgentsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncGroupsOperations.cs index 71d69dcc0a8f3..d42242c9b1e85 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncGroupsOperations.cs @@ -87,7 +87,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -323,7 +323,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -561,7 +561,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -791,7 +791,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -983,7 +983,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1178,7 +1178,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1477,7 +1477,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1685,7 +1685,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1883,11 +1883,15 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2122,7 +2126,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2324,7 +2328,7 @@ internal SyncGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncMembersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncMembersOperations.cs index 0b4acf9c35349..a50119061bcde 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncMembersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/SyncMembersOperations.cs @@ -116,7 +116,7 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -433,7 +433,7 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -653,7 +653,7 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -914,7 +914,7 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1158,7 +1158,7 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1369,7 +1369,7 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1595,7 +1595,7 @@ internal SyncMembersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TdeCertificatesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TdeCertificatesOperations.cs index 9b4ebb3764401..d24f21934ff5a 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TdeCertificatesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TdeCertificatesOperations.cs @@ -129,7 +129,7 @@ internal TdeCertificatesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-10-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperations.cs new file mode 100644 index 0000000000000..e7d85077381fd --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperations.cs @@ -0,0 +1,603 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TimeZonesOperations operations. + /// + internal partial class TimeZonesOperations : IServiceOperations, ITimeZonesOperations + { + /// + /// Initializes a new instance of the TimeZonesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TimeZonesOperations(SqlManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SqlManagementClient + /// + public SqlManagementClient Client { get; private set; } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a managed instance time zone. + /// + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string locationName, string timeZoneId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (timeZoneId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "timeZoneId"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("timeZoneId", timeZoneId); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId}").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{timeZoneId}", System.Uri.EscapeDataString(timeZoneId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperationsExtensions.cs new file mode 100644 index 0000000000000..c550a15e1b6be --- /dev/null +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/TimeZonesOperationsExtensions.cs @@ -0,0 +1,127 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Sql +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TimeZonesOperations. + /// + public static partial class TimeZonesOperationsExtensions + { + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static IPage ListByLocation(this ITimeZonesOperations operations, string locationName) + { + return operations.ListByLocationAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this ITimeZonesOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a managed instance time zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static TimeZone Get(this ITimeZonesOperations operations, string locationName, string timeZoneId) + { + return operations.GetAsync(locationName, timeZoneId).GetAwaiter().GetResult(); + } + + /// + /// Gets a managed instance time zone. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ITimeZonesOperations operations, string locationName, string timeZoneId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, timeZoneId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this ITimeZonesOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed instance time zones by location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this ITimeZonesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperations.cs index 73d877d3653b5..501d7220df7fc 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperations.cs @@ -50,6 +50,202 @@ internal VirtualClustersOperations(SqlManagementClient client) /// public SqlManagementClient Client { get; private set; } + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateDnsServersWithHttpMessagesAsync(string resourceGroupName, string virtualClusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualClusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualClusterName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-11-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("virtualClusterName", virtualClusterName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateDnsServers", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}/updateManagedInstanceDnsServers").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualClusterName}", System.Uri.EscapeDataString(virtualClusterName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets a list of all virtualClusters in the subscription. /// @@ -80,7 +276,7 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -264,7 +460,7 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -457,7 +653,7 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -641,7 +837,7 @@ internal VirtualClustersOperations(SqlManagementClient client) /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The headers that will be added to request. @@ -698,7 +894,7 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -841,7 +1037,7 @@ internal VirtualClustersOperations(SqlManagementClient client) /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// Headers that will be added to request. @@ -882,7 +1078,7 @@ internal VirtualClustersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperationsExtensions.cs index 473eec8ddc003..899ad52853828 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperationsExtensions.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualClustersOperationsExtensions.cs @@ -21,6 +21,50 @@ namespace Microsoft.Azure.Management.Sql /// public static partial class VirtualClustersOperationsExtensions { + /// + /// Synchronizes the DNS server settings used by the managed instances inside + /// the given virtual cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static UpdateManagedInstanceDnsServersOperation UpdateDnsServers(this IVirtualClustersOperations operations, string resourceGroupName, string virtualClusterName) + { + return operations.UpdateDnsServersAsync(resourceGroupName, virtualClusterName).GetAwaiter().GetResult(); + } + + /// + /// Synchronizes the DNS server settings used by the managed instances inside + /// the given virtual cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the 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. + /// + public static async Task UpdateDnsServersAsync(this IVirtualClustersOperations operations, string resourceGroupName, string virtualClusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateDnsServersWithHttpMessagesAsync(resourceGroupName, virtualClusterName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets a list of all virtualClusters in the subscription. /// @@ -180,7 +224,7 @@ public static void Delete(this IVirtualClustersOperations operations, string res /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// public static VirtualCluster Update(this IVirtualClustersOperations operations, string resourceGroupName, string virtualClusterName, VirtualClusterUpdate parameters) { @@ -201,7 +245,7 @@ public static VirtualCluster Update(this IVirtualClustersOperations operations, /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The cancellation token. @@ -267,7 +311,7 @@ public static void BeginDelete(this IVirtualClustersOperations operations, strin /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// public static VirtualCluster BeginUpdate(this IVirtualClustersOperations operations, string resourceGroupName, string virtualClusterName, VirtualClusterUpdate parameters) { @@ -288,7 +332,7 @@ public static VirtualCluster BeginUpdate(this IVirtualClustersOperations operati /// The name of the virtual cluster. /// /// - /// The requested managed instance resource state. + /// The requested virtual cluster resource state. /// /// /// The cancellation token. diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualNetworkRulesOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualNetworkRulesOperations.cs index cfc3d41df2559..270694e5713e9 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualNetworkRulesOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/VirtualNetworkRulesOperations.cs @@ -102,7 +102,7 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +354,7 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -567,7 +567,7 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -793,7 +793,7 @@ internal VirtualNetworkRulesOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-05-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadClassifiersOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadClassifiersOperations.cs index 3aca3cda1e20f..c83bee47afa81 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadClassifiersOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadClassifiersOperations.cs @@ -116,7 +116,7 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -398,7 +398,7 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -629,7 +629,7 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -873,7 +873,7 @@ internal WorkloadClassifiersOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadGroupsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadGroupsOperations.cs index 186476f749316..a59a7b7c025c6 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadGroupsOperations.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.Sql/src/Generated/WorkloadGroupsOperations.cs @@ -109,7 +109,7 @@ internal WorkloadGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -376,7 +376,7 @@ internal WorkloadGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -598,7 +598,7 @@ internal WorkloadGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -833,7 +833,7 @@ internal WorkloadGroupsOperations(SqlManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-06-01-preview"; + string apiVersion = "2020-11-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null;