From f8ee73ed07eea3b77fe3180e50d9b7218d7684bc Mon Sep 17 00:00:00 2001 From: Sanja Malesevic Date: Wed, 7 Aug 2019 14:50:09 +0200 Subject: [PATCH] Revert "Update .net client to support get/set/remove of AAD admin on MI. These files are automatically generated based on json file. And there is written test for these operationnew operations." This reverts commit caf83b0a99dc12c78eb4ddeb71876e82d1920b9e. --- .../1565174261$SqlManagementClient.cs | 849 ------------- ...nstanceActiveDirectoryAdministratorTest.cs | 53 - ...nstanceActiveDirectoryAdministratorTest.cs | 53 - .../1565174288$SqlManagementTestContext.cs | 179 --- .../1565174702$TestEnvironmentUtilities.cs | 207 ---- .../1565180173$TestEnvironmentUtilities.cs | 207 ---- .../1565180967$TestEnvironmentUtilities.cs | 207 ---- ...ManagedInstanceAdministratorsOperations.cs | 226 ---- .../src/Generated/ISqlManagementClient.cs | 5 - ...ManagedInstanceAdministratorsOperations.cs | 1104 ----------------- ...tanceAdministratorsOperationsExtensions.cs | 347 ------ .../Models/ManagedInstanceAdministrator.cs | 105 -- .../Generated/SdkInfo_SqlManagementClient.cs | 11 +- .../src/Generated/SqlManagementClient.cs | 6 - .../src/Microsoft.Azure.Management.Sql.csproj | 2 +- .../src/Properties/AssemblyInfo.cs | 2 +- ...nstanceActiveDirectoryAdministratorTest.cs | 53 - 17 files changed, 12 insertions(+), 3604 deletions(-) delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/1565174261$SqlManagementClient.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/1565178698$ManagedInstanceActiveDirectoryAdministratorTest.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/1565179929$ManagedInstanceActiveDirectoryAdministratorTest.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565174288$SqlManagementTestContext.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565174702$TestEnvironmentUtilities.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565180173$TestEnvironmentUtilities.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565180967$TestEnvironmentUtilities.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/IManagedInstanceAdministratorsOperations.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceAdministratorsOperations.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceAdministratorsOperationsExtensions.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceAdministrator.cs delete mode 100644 sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/ManagedInstanceActiveDirectoryAdministratorTest.cs diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/1565174261$SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/1565174261$SqlManagementClient.cs deleted file mode 100644 index 60e927a0d1a8..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/1565174261$SqlManagementClient.cs +++ /dev/null @@ -1,849 +0,0 @@ -// ADAdministrators -// Copyright (c) Microsoft Corporation. All rights 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.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - - /// - /// The Azure SQL Database management API provides a RESTful set of web - /// services that interact with Azure SQL Database services to manage your - /// databases. The API enables you to create, retrieve, update, and delete - /// databases. - /// - public partial class SqlManagementClient : ServiceClient, ISqlManagementClient, IAzureClient - { - /// - /// The base URI of the service. - /// - public System.Uri BaseUri { get; set; } - - /// - /// Gets or sets json serialization settings. - /// - public JsonSerializerSettings SerializationSettings { get; private set; } - - /// - /// Gets or sets json deserialization settings. - /// - public JsonSerializerSettings DeserializationSettings { get; private set; } - - /// - /// Credentials needed for the client to connect to Azure. - /// - public ServiceClientCredentials Credentials { get; private set; } - - /// - /// The subscription ID that identifies an Azure subscription. - /// - public string SubscriptionId { get; set; } - - /// - /// The preferred language for the response. - /// - public string AcceptLanguage { get; set; } - - /// - /// The retry timeout in seconds for Long Running Operations. Default value is - /// 30. - /// - public int? LongRunningOperationRetryTimeout { get; set; } - - /// - /// Whether a unique x-ms-client-request-id should be generated. When set to - /// true a unique x-ms-client-request-id value is generated and included in - /// each request. Default is true. - /// - public bool? GenerateClientRequestId { get; set; } - - /// - /// Gets the IRecoverableDatabasesOperations. - /// - public virtual IRecoverableDatabasesOperations RecoverableDatabases { get; private set; } - - /// - /// Gets the IRestorableDroppedDatabasesOperations. - /// - public virtual IRestorableDroppedDatabasesOperations RestorableDroppedDatabases { get; private set; } - - /// - /// Gets the IServersOperations. - /// - public virtual IServersOperations Servers { 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. - /// - public virtual IDataMaskingPoliciesOperations DataMaskingPolicies { get; private set; } - - /// - /// Gets the IDataMaskingRulesOperations. - /// - public virtual IDataMaskingRulesOperations DataMaskingRules { get; private set; } - - /// - /// Gets the IFirewallRulesOperations. - /// - public virtual IFirewallRulesOperations FirewallRules { get; private set; } - - /// - /// Gets the IGeoBackupPoliciesOperations. - /// - public virtual IGeoBackupPoliciesOperations GeoBackupPolicies { get; private set; } - - /// - /// Gets the IDatabasesOperations. - /// - public virtual IDatabasesOperations Databases { get; private set; } - - /// - /// Gets the IElasticPoolsOperations. - /// - public virtual IElasticPoolsOperations ElasticPools { get; private set; } - - /// - /// Gets the IRecommendedElasticPoolsOperations. - /// - public virtual IRecommendedElasticPoolsOperations RecommendedElasticPools { get; private set; } - - /// - /// Gets the IReplicationLinksOperations. - /// - public virtual IReplicationLinksOperations ReplicationLinks { get; private set; } - - /// - /// Gets the IServerAzureADAdministratorsOperations. - /// - public virtual IServerAzureADAdministratorsOperations ServerAzureADAdministrators { get; private set; } - - /// - /// Gets the IServerCommunicationLinksOperations. - /// - public virtual IServerCommunicationLinksOperations ServerCommunicationLinks { get; private set; } - - /// - /// Gets the IServiceObjectivesOperations. - /// - public virtual IServiceObjectivesOperations ServiceObjectives { get; private set; } - - /// - /// Gets the IElasticPoolActivitiesOperations. - /// - public virtual IElasticPoolActivitiesOperations ElasticPoolActivities { get; private set; } - - /// - /// Gets the IElasticPoolDatabaseActivitiesOperations. - /// - public virtual IElasticPoolDatabaseActivitiesOperations ElasticPoolDatabaseActivities { get; private set; } - - /// - /// Gets the IServiceTierAdvisorsOperations. - /// - public virtual IServiceTierAdvisorsOperations ServiceTierAdvisors { get; private set; } - - /// - /// Gets the ITransparentDataEncryptionsOperations. - /// - public virtual ITransparentDataEncryptionsOperations TransparentDataEncryptions { get; private set; } - - /// - /// Gets the ITransparentDataEncryptionActivitiesOperations. - /// - public virtual ITransparentDataEncryptionActivitiesOperations TransparentDataEncryptionActivities { get; private set; } - - /// - /// Gets the IServerUsagesOperations. - /// - public virtual IServerUsagesOperations ServerUsages { get; private set; } - - /// - /// Gets the IDatabaseUsagesOperations. - /// - public virtual IDatabaseUsagesOperations DatabaseUsages { get; private set; } - - /// - /// Gets the IDatabaseAutomaticTuningOperations. - /// - public virtual IDatabaseAutomaticTuningOperations DatabaseAutomaticTuning { 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 IOperations. - /// - public virtual IOperations Operations { get; private set; } - - /// - /// Gets the IServerKeysOperations. - /// - public virtual IServerKeysOperations ServerKeys { get; private set; } - - /// - /// Gets the ISyncAgentsOperations. - /// - 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 ISubscriptionUsagesOperations. - /// - public virtual ISubscriptionUsagesOperations SubscriptionUsages { 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 IExtendedDatabaseBlobAuditingPoliciesOperations. - /// - public virtual IExtendedDatabaseBlobAuditingPoliciesOperations ExtendedDatabaseBlobAuditingPolicies { get; private set; } - - /// - /// Gets the IExtendedServerBlobAuditingPoliciesOperations. - /// - public virtual IExtendedServerBlobAuditingPoliciesOperations ExtendedServerBlobAuditingPolicies { get; private set; } - - /// - /// Gets the IServerBlobAuditingPoliciesOperations. - /// - public virtual IServerBlobAuditingPoliciesOperations ServerBlobAuditingPolicies { get; private set; } - - /// - /// Gets the IDatabaseBlobAuditingPoliciesOperations. - /// - public virtual IDatabaseBlobAuditingPoliciesOperations DatabaseBlobAuditingPolicies { get; private set; } - - /// - /// Gets the IDatabaseVulnerabilityAssessmentRuleBaselinesOperations. - /// - public virtual IDatabaseVulnerabilityAssessmentRuleBaselinesOperations DatabaseVulnerabilityAssessmentRuleBaselines { get; private set; } - - /// - /// Gets the IDatabaseVulnerabilityAssessmentsOperations. - /// - public virtual IDatabaseVulnerabilityAssessmentsOperations DatabaseVulnerabilityAssessments { get; private set; } - - /// - /// Gets the IJobAgentsOperations. - /// - public virtual IJobAgentsOperations JobAgents { get; private set; } - - /// - /// Gets the IJobCredentialsOperations. - /// - public virtual IJobCredentialsOperations JobCredentials { get; private set; } - - /// - /// Gets the IJobExecutionsOperations. - /// - public virtual IJobExecutionsOperations JobExecutions { get; private set; } - - /// - /// Gets the IJobsOperations. - /// - public virtual IJobsOperations Jobs { get; private set; } - - /// - /// Gets the IJobStepExecutionsOperations. - /// - public virtual IJobStepExecutionsOperations JobStepExecutions { get; private set; } - - /// - /// Gets the IJobStepsOperations. - /// - public virtual IJobStepsOperations JobSteps { get; private set; } - - /// - /// Gets the IJobTargetExecutionsOperations. - /// - public virtual IJobTargetExecutionsOperations JobTargetExecutions { get; private set; } - - /// - /// Gets the IJobTargetGroupsOperations. - /// - public virtual IJobTargetGroupsOperations JobTargetGroups { get; private set; } - - /// - /// Gets the IJobVersionsOperations. - /// - public virtual IJobVersionsOperations JobVersions { get; private set; } - - /// - /// Gets the ILongTermRetentionBackupsOperations. - /// - public virtual ILongTermRetentionBackupsOperations LongTermRetentionBackups { get; private set; } - - /// - /// Gets the IBackupLongTermRetentionPoliciesOperations. - /// - public virtual IBackupLongTermRetentionPoliciesOperations BackupLongTermRetentionPolicies { get; private set; } - - /// - /// Gets the IManagedBackupShortTermRetentionPoliciesOperations. - /// - public virtual IManagedBackupShortTermRetentionPoliciesOperations ManagedBackupShortTermRetentionPolicies { get; private set; } - - /// - /// Gets the IManagedDatabasesOperations. - /// - public virtual IManagedDatabasesOperations ManagedDatabases { get; private set; } - - /// - /// Gets the IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations. - /// - public virtual IManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { get; private set; } - - /// - /// Gets the IServerAutomaticTuningOperations. - /// - public virtual IServerAutomaticTuningOperations ServerAutomaticTuning { get; private set; } - - /// - /// Gets the IServerDnsAliasesOperations. - /// - public virtual IServerDnsAliasesOperations ServerDnsAliases { get; private set; } - - /// - /// Gets the IServerSecurityAlertPoliciesOperations. - /// - public virtual IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; private set; } - - /// - /// Gets the IRestorableDroppedManagedDatabasesOperations. - /// - public virtual IRestorableDroppedManagedDatabasesOperations RestorableDroppedManagedDatabases { get; private set; } - - /// - /// Gets the IRestorePointsOperations. - /// - public virtual IRestorePointsOperations RestorePoints { get; private set; } - - /// - /// Gets the IManagedDatabaseSecurityAlertPoliciesOperations. - /// - public virtual IManagedDatabaseSecurityAlertPoliciesOperations ManagedDatabaseSecurityAlertPolicies { get; private set; } - - /// - /// Gets the IManagedServerSecurityAlertPoliciesOperations. - /// - public virtual IManagedServerSecurityAlertPoliciesOperations ManagedServerSecurityAlertPolicies { get; private set; } - - /// - /// Gets the ISensitivityLabelsOperations. - /// - public virtual ISensitivityLabelsOperations SensitivityLabels { get; private set; } - - /// - /// Gets the IManagedInstanceAdministratorsOperations. - /// - public virtual IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; private set; } - - /// - /// Gets the IDatabaseOperations. - /// - public virtual IDatabaseOperations DatabaseOperations { get; private set; } - - /// - /// Gets the IElasticPoolOperations. - /// - public virtual IElasticPoolOperations ElasticPoolOperations { get; private set; } - - /// - /// Gets the ICapabilitiesOperations. - /// - public virtual ICapabilitiesOperations Capabilities { get; private set; } - - /// - /// Gets the IDatabaseVulnerabilityAssessmentScansOperations. - /// - public virtual IDatabaseVulnerabilityAssessmentScansOperations DatabaseVulnerabilityAssessmentScans { get; private set; } - - /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations. - /// - public virtual IManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations ManagedDatabaseVulnerabilityAssessmentRuleBaselines { get; private set; } - - /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentScansOperations. - /// - public virtual IManagedDatabaseVulnerabilityAssessmentScansOperations ManagedDatabaseVulnerabilityAssessmentScans { get; private set; } - - /// - /// Gets the IManagedDatabaseVulnerabilityAssessmentsOperations. - /// - public virtual IManagedDatabaseVulnerabilityAssessmentsOperations ManagedDatabaseVulnerabilityAssessments { get; private set; } - - /// - /// Gets the IInstanceFailoverGroupsOperations. - /// - public virtual IInstanceFailoverGroupsOperations InstanceFailoverGroups { get; private set; } - - /// - /// Gets the IBackupShortTermRetentionPoliciesOperations. - /// - public virtual IBackupShortTermRetentionPoliciesOperations BackupShortTermRetentionPolicies { get; private set; } - - /// - /// Gets the ITdeCertificatesOperations. - /// - public virtual ITdeCertificatesOperations TdeCertificates { get; private set; } - - /// - /// Gets the IManagedInstanceTdeCertificatesOperations. - /// - public virtual IManagedInstanceTdeCertificatesOperations ManagedInstanceTdeCertificates { get; private set; } - - /// - /// Gets the IManagedInstanceKeysOperations. - /// - public virtual IManagedInstanceKeysOperations ManagedInstanceKeys { get; private set; } - - /// - /// Gets the IManagedInstanceEncryptionProtectorsOperations. - /// - public virtual IManagedInstanceEncryptionProtectorsOperations ManagedInstanceEncryptionProtectors { get; private set; } - - /// - /// Gets the IRecoverableManagedDatabasesOperations. - /// - public virtual IRecoverableManagedDatabasesOperations RecoverableManagedDatabases { get; private set; } - - /// - /// Gets the IManagedInstanceVulnerabilityAssessmentsOperations. - /// - public virtual IManagedInstanceVulnerabilityAssessmentsOperations ManagedInstanceVulnerabilityAssessments { get; private set; } - - /// - /// Gets the IServerVulnerabilityAssessmentsOperations. - /// - public virtual IServerVulnerabilityAssessmentsOperations ServerVulnerabilityAssessments { get; private set; } - - /// - /// Gets the IManagedDatabaseSensitivityLabelsOperations. - /// - public virtual IManagedDatabaseSensitivityLabelsOperations ManagedDatabaseSensitivityLabels { get; private set; } - - /// - /// Gets the IInstancePoolsOperations. - /// - public virtual IInstancePoolsOperations InstancePools { get; private set; } - - /// - /// Gets the IUsagesOperations. - /// - public virtual IUsagesOperations Usages { get; private set; } - - /// - /// Gets the IManagedInstancesOperations. - /// - public virtual IManagedInstancesOperations ManagedInstances { get; private set; } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling SqlManagementClient.Dispose(). False: will not dispose provided httpClient - protected SqlManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) - { - Initialize(); - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected SqlManagementClient(params DelegatingHandler[] handlers) : base(handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected SqlManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - protected SqlManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - BaseUri = baseUri; - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - protected SqlManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - BaseUri = baseUri; - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public SqlManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling SqlManagementClient.Dispose(). False: will not dispose provided httpClient - /// - /// Thrown when a required parameter is null - /// - public SqlManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public SqlManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public SqlManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the SqlManagementClient class. - /// - /// - /// Optional. The base URI of the service. - /// - /// - /// Required. Credentials needed for the client to connect to Azure. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public SqlManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (baseUri == null) - { - throw new System.ArgumentNullException("baseUri"); - } - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// An optional partial-method to perform custom initialization. - /// - partial void CustomInitialize(); - /// - /// Initializes client properties. - /// - private void Initialize() - { - RecoverableDatabases = new RecoverableDatabasesOperations(this); - RestorableDroppedDatabases = new RestorableDroppedDatabasesOperations(this); - Servers = new ServersOperations(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); - ServerAzureADAdministrators = new ServerAzureADAdministratorsOperations(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); - SyncGroups = new SyncGroupsOperations(this); - SyncMembers = new SyncMembersOperations(this); - SubscriptionUsages = new SubscriptionUsagesOperations(this); - VirtualClusters = new VirtualClustersOperations(this); - VirtualNetworkRules = new VirtualNetworkRulesOperations(this); - ExtendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesOperations(this); - ExtendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesOperations(this); - ServerBlobAuditingPolicies = new ServerBlobAuditingPoliciesOperations(this); - DatabaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesOperations(this); - DatabaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesOperations(this); - DatabaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsOperations(this); - JobAgents = new JobAgentsOperations(this); - JobCredentials = new JobCredentialsOperations(this); - JobExecutions = new JobExecutionsOperations(this); - Jobs = new JobsOperations(this); - JobStepExecutions = new JobStepExecutionsOperations(this); - JobSteps = new JobStepsOperations(this); - JobTargetExecutions = new JobTargetExecutionsOperations(this); - JobTargetGroups = new JobTargetGroupsOperations(this); - JobVersions = new JobVersionsOperations(this); - LongTermRetentionBackups = new LongTermRetentionBackupsOperations(this); - BackupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesOperations(this); - ManagedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesOperations(this); - ManagedDatabases = new ManagedDatabasesOperations(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); - ManagedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesOperations(this); - ManagedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesOperations(this); - SensitivityLabels = new SensitivityLabelsOperations(this); - ManagedInstanceAdministrators = new ManagedInstanceAdministratorsOperations(this); - DatabaseOperations = new DatabaseOperations(this); - ElasticPoolOperations = new ElasticPoolOperations(this); - Capabilities = new CapabilitiesOperations(this); - DatabaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansOperations(this); - ManagedDatabaseVulnerabilityAssessmentRuleBaselines = new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations(this); - ManagedDatabaseVulnerabilityAssessmentScans = new ManagedDatabaseVulnerabilityAssessmentScansOperations(this); - ManagedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsOperations(this); - InstanceFailoverGroups = new InstanceFailoverGroupsOperations(this); - BackupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesOperations(this); - TdeCertificates = new TdeCertificatesOperations(this); - ManagedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesOperations(this); - ManagedInstanceKeys = new ManagedInstanceKeysOperations(this); - ManagedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsOperations(this); - RecoverableManagedDatabases = new RecoverableManagedDatabasesOperations(this); - ManagedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsOperations(this); - ServerVulnerabilityAssessments = new ServerVulnerabilityAssessmentsOperations(this); - ManagedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsOperations(this); - InstancePools = new InstancePoolsOperations(this); - Usages = new UsagesOperations(this); - ManagedInstances = new ManagedInstancesOperations(this); - BaseUri = new System.Uri("https://management.azure.com"); - AcceptLanguage = "en-US"; - LongRunningOperationRetryTimeout = 30; - GenerateClientRequestId = true; - SerializationSettings = new JsonSerializerSettings - { - Formatting = Newtonsoft.Json.Formatting.Indented, - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, - ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List - { - new Iso8601TimeSpanConverter() - } - }; - SerializationSettings.Converters.Add(new TransformationJsonConverter()); - DeserializationSettings = new JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, - ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List - { - new Iso8601TimeSpanConverter() - } - }; - CustomInitialize(); - DeserializationSettings.Converters.Add(new TransformationJsonConverter()); - DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/1565178698$ManagedInstanceActiveDirectoryAdministratorTest.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/1565178698$ManagedInstanceActiveDirectoryAdministratorTest.cs deleted file mode 100644 index dd85ea09e23b..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/1565178698$ManagedInstanceActiveDirectoryAdministratorTest.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -using Microsoft.Azure.Management.ResourceManager; -using Microsoft.Azure.Management.Sql; -using Microsoft.Azure.Management.Sql.Models; -using System; -using Xunit; - -namespace Sql.Tests -{ - public class ManagedInstanceActiveDirectoryAdministratorTest - { - // Use existing resource group and MI for testing. - // - private const string ResourceGroupName = "cl_pilot"; - private const string ManagedInstanceName = "t45-bc-wcus"; - - [Fact] - public void TestSetManagedInstanceActiveDirectoryAdministrator() - { - string aadAdmin = "DSEngAll"; - - using (SqlManagementTestContext context = new SqlManagementTestContext(this)) - { - Guid objectId = new Guid(TestEnvironmentUtilities.GetUserObjectId()); - Guid tenantId = new Guid(TestEnvironmentUtilities.GetTenantId()); - - SqlManagementClient sqlClient = context.GetClient(); - ResourceManagementClient resourceClient = context.GetClient(); - ManagedInstance instance = sqlClient.ManagedInstances.Get(ResourceGroupName, ManagedInstanceName); - - // Add new Active Directory Admin - ManagedInstanceAdministrator newAdmin = new ManagedInstanceAdministrator(login: aadAdmin, sid: objectId, tenantId: tenantId); - ManagedInstanceAdministrator createResult = sqlClient.ManagedInstanceAdministrators.CreateOrUpdate(ResourceGroupName, instance.Name, "ActiveDirectory", newAdmin); - Assert.Equal(aadAdmin, createResult.Login); - - // Get the current Active Directory Admin - ManagedInstanceAdministrator getResult = sqlClient.ManagedInstanceAdministrators.Get(ResourceGroupName, instance.Name, "ActiveDirectory"); - Assert.Equal(aadAdmin, getResult.Login); - Assert.Equal(objectId, getResult.Sid); - Assert.Equal(tenantId, getResult.TenantId); - - // Delete the Active Directory Admin on server - sqlClient.ManagedInstanceAdministrators.Delete(ResourceGroupName, instance.Name, "ActiveDirectory"); - - // List all Active Directory Admins for isntance. - Page1 admins = (Page1) sqlClient.ManagedInstanceAdministrators.ListByInstance(ResourceGroupName, instance.Name); - Assert.True(admins == null || !admins.GetEnumerator().MoveNext()); - } - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/1565179929$ManagedInstanceActiveDirectoryAdministratorTest.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/1565179929$ManagedInstanceActiveDirectoryAdministratorTest.cs deleted file mode 100644 index 61a81f195e17..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/1565179929$ManagedInstanceActiveDirectoryAdministratorTest.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -using Microsoft.Azure.Management.ResourceManager; -using Microsoft.Azure.Management.Sql; -using Microsoft.Azure.Management.Sql.Models; -using System; -using Xunit; - -namespace Sql.Tests -{ - public class ManagedInstanceActiveDirectoryAdministratorTest - { - // Use existing resource group and MI for testing. - // - private const string ResourceGroupName = "cl_pilot"; - private const string ManagedInstanceName = "t45-bc-wcus"; - - [Fact] - public void TestSetManagedInstanceActiveDirectoryAdministrator() - { - string aadAdmin = "DSEngAll"; - - using (SqlManagementTestContext context = new SqlManagementTestContext(this)) - { - Guid tenantId = new Guid(TestEnvironmentUtilities.GetTenantId()); - Guid objectId = new Guid(TestEnvironmentUtilities.GetUserObjectId()); - - SqlManagementClient sqlClient = context.GetClient(); - ResourceManagementClient resourceClient = context.GetClient(); - ManagedInstance instance = sqlClient.ManagedInstances.Get(ResourceGroupName, ManagedInstanceName); - - // Add new Active Directory Admin - ManagedInstanceAdministrator newAdmin = new ManagedInstanceAdministrator(login: aadAdmin, sid: objectId, tenantId: tenantId); - ManagedInstanceAdministrator createResult = sqlClient.ManagedInstanceAdministrators.CreateOrUpdate(ResourceGroupName, instance.Name, "ActiveDirectory", newAdmin); - Assert.Equal(aadAdmin, createResult.Login); - - // Get the current Active Directory Admin - ManagedInstanceAdministrator getResult = sqlClient.ManagedInstanceAdministrators.Get(ResourceGroupName, instance.Name, "ActiveDirectory"); - Assert.Equal(aadAdmin, getResult.Login); - Assert.Equal(objectId, getResult.Sid); - Assert.Equal(tenantId, getResult.TenantId); - - // Delete the Active Directory Admin on server - sqlClient.ManagedInstanceAdministrators.Delete(ResourceGroupName, instance.Name, "ActiveDirectory"); - - // List all Active Directory Admins for isntance. - Page1 admins = (Page1) sqlClient.ManagedInstanceAdministrators.ListByInstance(ResourceGroupName, instance.Name); - Assert.True(admins == null || !admins.GetEnumerator().MoveNext()); - } - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565174288$SqlManagementTestContext.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565174288$SqlManagementTestContext.cs deleted file mode 100644 index b53a9f118b46..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565174288$SqlManagementTestContext.cs +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -using Microsoft.Azure.Management.Network.Models; -using Microsoft.Azure.Management.ResourceManager; -using Microsoft.Azure.Management.ResourceManager.Models; -using Microsoft.Azure.Management.Sql; -using Microsoft.Azure.Management.Sql.Models; -using Microsoft.Azure.Test.HttpRecorder; -using Microsoft.Rest.ClientRuntime.Azure.TestFramework; -using Sql.Tests.Utilities; -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace Sql.Tests -{ - public class SqlManagementTestContext : IDisposable - { - public SqlManagementTestContext( - object suiteObject, - [CallerMemberName] - string testName="error_determining_test_name") - { - var providersToIgnore = new Dictionary - { - {"Microsoft.Sql", null} - }; - - var userAgentsToIgnore = new Dictionary - { - }; - - HttpMockServer.Matcher = new PermissiveRecordMatcherWithApiExclusion(true, providersToIgnore, userAgentsToIgnore); - - _mockContext = MockContext.Start(suiteObject.GetType().FullName, testName); - } - - private readonly MockContext _mockContext; - - private bool disposedValue = false; // To detect redundant calls - - private readonly Dictionary _serviceClientCache = new Dictionary(); - - private readonly List _resourceGroups = new List(); - - public TServiceClient GetClient() where TServiceClient :class, IDisposable - { - if (_serviceClientCache.TryGetValue(typeof(TServiceClient), out IDisposable clientObject)) - { - return (TServiceClient)clientObject; - } - - TServiceClient client = _mockContext.GetServiceClient(); - _serviceClientCache.Add(typeof(TServiceClient), client); - return client; - } - - public ResourceGroup CreateResourceGroup() - { - return CreateResourceGroup(TestEnvironmentUtilities.DefaultLocation); - } - - public ResourceGroup CreateResourceGroup(string location) - { - ResourceManagementClient resourceClient = GetClient(); - - string rgName = SqlManagementTestUtilities.GenerateName(); - ResourceGroup resourceGroup = resourceClient.ResourceGroups.CreateOrUpdate( - rgName, - new ResourceGroup - { - Location = location, - Tags = new Dictionary() { { rgName, DateTime.UtcNow.ToString("u") } } - }); - - _resourceGroups.Add(resourceGroup); - - return resourceGroup; - } - - public void DeleteResourceGroup(string resourceGroupName) - { - ResourceManagementClient resourceClient = GetClient(); - resourceClient.ResourceGroups.BeginDelete(resourceGroupName); - } - - public Server CreateServer(ResourceGroup resourceGroup) - { - return CreateServer(resourceGroup, TestEnvironmentUtilities.DefaultLocation); - } - - public Server CreateServer(ResourceGroup resourceGroup, string location) - { - SqlManagementClient sqlClient = GetClient(); - - string version12 = "12.0"; - string serverName = SqlManagementTestUtilities.GenerateName(); - Dictionary tags = new Dictionary(); - - var v12Server = sqlClient.Servers.CreateOrUpdate(resourceGroup.Name, serverName, new Server() - { - AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, - AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, - Version = version12, - Tags = tags, - Location = location, - }); - - SqlManagementTestUtilities.ValidateServer(v12Server, serverName, SqlManagementTestUtilities.DefaultLogin, version12, tags, location); - - return v12Server; - } - - public ManagedInstance CreateManagedInstance(ResourceGroup resourceGroup) - { - return CreateManagedInstance(resourceGroup, TestEnvironmentUtilities.DefaultLocationId); - } - - public ManagedInstance CreateManagedInstance(ResourceGroup resourceGroup, string location) - { - SqlManagementClient sqlClient = GetClient(); - - // Create vnet and get the subnet id - // VirtualNetwork vnet = ManagedInstanceTestFixture.CreateVirtualNetwork(this, resourceGroup, TestEnvironmentUtilities.DefaultLocationId); - - string miName = "crud-tests-" + SqlManagementTestUtilities.GenerateName(); - Dictionary tags = new Dictionary(); - string subnetId = "/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/RG_MIPlayground/providers/Microsoft.Network/virtualNetworks/VNET_MIPlayground/subnets/MISubnet"; - Microsoft.Azure.Management.Sql.Models.Sku sku = new Microsoft.Azure.Management.Sql.Models.Sku(name: "MIGP8G4", tier: "GeneralPurpose"); - - var managedInstance = sqlClient.ManagedInstances.CreateOrUpdate(resourceGroup.Name, miName, new ManagedInstance() - { - AdministratorLogin = SqlManagementTestUtilities.DefaultLogin, - AdministratorLoginPassword = SqlManagementTestUtilities.DefaultPassword, - Sku = sku, - SubnetId = subnetId, - Tags = tags, - Location = location, - }); - - SqlManagementTestUtilities.ValidateManagedInstance(managedInstance, miName, SqlManagementTestUtilities.DefaultLogin, tags, location); - - return managedInstance; - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) - { - // Dispose managed state (managed objects). - - // Begin deleting resource groups - ResourceManagementClient resourceClient = GetClient(); - _resourceGroups.ForEach(rg => resourceClient.ResourceGroups.BeginDelete(rg.Name)); - - // Dispose clients - foreach (IDisposable client in _serviceClientCache.Values) - { - client.Dispose(); - } - - // Dispose context - _mockContext.Dispose(); - } - - disposedValue = true; - } - } - - // This code added to correctly implement the disposable pattern. - public void Dispose() - { - Dispose(true); - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565174702$TestEnvironmentUtilities.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565174702$TestEnvironmentUtilities.cs deleted file mode 100644 index 79d46ad41d14..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565174702$TestEnvironmentUtilities.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -using Microsoft.Azure.KeyVault; -using Microsoft.Azure.Test.HttpRecorder; -using Microsoft.IdentityModel.Clients.ActiveDirectory; -using Microsoft.Rest.ClientRuntime.Azure.TestFramework; -using Sql.Tests.Utilities; -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; - -namespace Sql.Tests -{ - public static class TestEnvironmentUtilities - { - private const string _environmentVariableName = "TEST_CSM_ORGID_AUTHENTICATION"; - - private static readonly TestEnvironment _environment = - new TestEnvironment(Environment.GetEnvironmentVariable(_environmentVariableName)); - - // We now load default locations from environment variable. - // Tests were recorded with this appended to DefaultLocationId=japaneast;DefaultLocation=Japan East;DefaultSecondaryLocationId=centralus;DefaultSecondaryLocation=Central US;DefaultStagePrimaryLocation=North Europe;DefaultStageSecondaryLocation=SouthEast Asia;DefaultEuapPrimaryLocation=East US 2 EUAP;DefaultEuapPrimaryLocationId=eastus2euap - public static string DefaultLocation - { - get - { - return GetValueFromEnvironment("DefaultLocation"); - } - } - public static string DefaultLocationId - { - get - { - return GetValueFromEnvironment("DefaultLocationId"); - } - } - - public static string DefaultSecondaryLocationId - { - get - { - return GetValueFromEnvironment("DefaultSecondaryLocationId"); - } - } - - public static string DefaultSecondaryLocation - { - get - { - return GetValueFromEnvironment("DefaultSecondaryLocation"); - } - } - public static string DefaultStagePrimaryLocation - { - get - { - return GetValueFromEnvironment("DefaultStagePrimaryLocation", DefaultLocation); - } - } - - public static string DefaultStageSecondaryLocation - { - get - { - return GetValueFromEnvironment("DefaultStageSecondaryLocation", DefaultSecondaryLocation); - } - } - - public static string DefaultEuapPrimaryLocation - { - get - { - return GetValueFromEnvironment("DefaultEuapPrimaryLocation", DefaultLocation); - } - } - - public static string DefaultEuapPrimaryLocationId - { - get - { - return GetValueFromEnvironment("DefaultEuapPrimaryLocationId", DefaultLocationId); - } - } - - public static async Task GetAccessToken(string authority, string resource, string scope) - { - TestEnvironment testEnvironment = TestEnvironmentFactory.GetTestEnvironment(); - - var context = new AuthenticationContext(authority); - string authClientId = testEnvironment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalKey]; - string authSecret = testEnvironment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalSecretKey]; - var clientCredential = new ClientCredential(authClientId, authSecret); - var result = await context.AcquireTokenAsync(resource, clientCredential).ConfigureAwait(false); - - return result.AccessToken; - } - - /// - /// Gets the AAD user object id. - /// - /// - /// This could potentially be determined at runtime by requesting the service principal's object id - /// from Azure AD graph API. However in practice this was difficult because the AAD graph client - /// (Microsoft.Azure.ActiveDirectory.GraphClient) does not support .NET Core, and Microsoft graph client - /// (Microsoft.Graph) does not yet support AAD Application API. - /// - public static string GetUserObjectId() - { - const string objectIdKey = "ServicePrincipal"; - - return GetOrAddVariable( - objectIdKey, - () => - { - string objectId; - if (_environment.ConnectionString.KeyValuePairs.TryGetValue(objectIdKey, out objectId)) - { - return objectId; - } - else - { - string servicePrincipal = _environment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalKey]; - - throw new KeyNotFoundException( - string.Format( - "Connection string key {0} not found. You can determine the correct value by running this in PowerShell:" + - " `Get-AzureRmADServicePrincipal -ServicePrincipalName {1}`, then add `ObjectId=` to your" + - " TEST_CSM_ORGID_AUTHENTICATION connection string.", - objectIdKey, - servicePrincipal)); - } - }); - } - - /// - /// Gets the AAD tenant id from the test environment. - /// - public static string GetTenantId() - { - const string tenantIdKey = "AADTenant"; - - return GetOrAddVariable( - tenantIdKey, - () => - { - return _environment.Tenant; - }); - } - - /// - /// Gets a variable from HTTP recording (when test is in playback mode) or writes a variable to HTTP recording - /// (when test is in recording mode). - /// - /// Key that the variable value is stored under in HTTP recording file. - /// Function that generates the variable value if necessary. - /// The variable value. - private static string GetOrAddVariable(string key, Func generateValueFunc) - { - if (HttpMockServer.Mode == HttpRecorderMode.Record) - { - string value = generateValueFunc(); - HttpMockServer.Variables[key] = value; - return value; - } - else - { - return HttpMockServer.Variables[key]; - } - } - - /// - /// Gets values from the loaded environment - /// - private static string GetValueFromEnvironment(string key, string backupValue = null) - { - return GetOrAddVariable(key, () => - { - string value; - bool successful = _environment.ConnectionString.KeyValuePairs.TryGetValue(key, out value); - - if (!successful) - { - // For variables that may default to other locations (i.e. stage location, if not provided, should default to default production location), - // Check if the backup value is not null and return that if the the environment variable is not found. - if(backupValue != null) - { - return backupValue; - } - - throw new KeyNotFoundException( - string.Format("Value for key '{0}' was not found in environment variable '{1}'. Ensure this value is included in the environment variable.", - key, _environmentVariableName)); - } - - return value; - }); - } - - public static KeyVaultClient GetKeyVaultClient() - { - DelegatingHandler mockServer = HttpMockServer.CreateInstance(); - return new KeyVaultClient(new TestKeyVaultCredential(GetAccessToken), handlers: mockServer); - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565180173$TestEnvironmentUtilities.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565180173$TestEnvironmentUtilities.cs deleted file mode 100644 index f9b70626368f..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565180173$TestEnvironmentUtilities.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -using Microsoft.Azure.KeyVault; -using Microsoft.Azure.Test.HttpRecorder; -using Microsoft.IdentityModel.Clients.ActiveDirectory; -using Microsoft.Rest.ClientRuntime.Azure.TestFramework; -using Sql.Tests.Utilities; -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; - -namespace Sql.Tests -{ - public static class TestEnvironmentUtilities - { - private const string _environmentVariableName = "TEST_CSM_ORGID_AUTHENTICATION"; - - private static readonly TestEnvironment _environment = - new TestEnvironment(Environment.GetEnvironmentVariable(_environmentVariableName)); - - // We now load default locations from environment variable. - // Tests were recorded with this appended to DefaultLocationId=japaneast;DefaultLocation=Japan East;DefaultSecondaryLocationId=centralus;DefaultSecondaryLocation=Central US;DefaultStagePrimaryLocation=North Europe;DefaultStageSecondaryLocation=SouthEast Asia;DefaultEuapPrimaryLocation=East US 2 EUAP;DefaultEuapPrimaryLocationId=eastus2euap - public static string DefaultLocation - { - get - { - return GetValueFromEnvironment("DefaultLocation"); - } - } - public static string DefaultLocationId - { - get - { - return GetValueFromEnvironment("DefaultLocationId"); - } - } - - public static string DefaultSecondaryLocationId - { - get - { - return GetValueFromEnvironment("DefaultSecondaryLocationId"); - } - } - - public static string DefaultSecondaryLocation - { - get - { - return GetValueFromEnvironment("DefaultSecondaryLocation"); - } - } - public static string DefaultStagePrimaryLocation - { - get - { - return GetValueFromEnvironment("DefaultStagePrimaryLocation", DefaultLocation); - } - } - - public static string DefaultStageSecondaryLocation - { - get - { - return GetValueFromEnvironment("DefaultStageSecondaryLocation", DefaultSecondaryLocation); - } - } - - public static string DefaultEuapPrimaryLocation - { - get - { - return GetValueFromEnvironment("DefaultEuapPrimaryLocation", DefaultLocation); - } - } - - public static string DefaultEuapPrimaryLocationId - { - get - { - return GetValueFromEnvironment("DefaultEuapPrimaryLocationId", DefaultLocationId); - } - } - - public static async Task GetAccessToken(string authority, string resource, string scope) - { - TestEnvironment testEnvironment = TestEnvironmentFactory.GetTestEnvironment(); - - var context = new AuthenticationContext(authority); - string authClientId = testEnvironment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalKey]; - string authSecret = testEnvironment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalSecretKey]; - var clientCredential = new ClientCredential(authClientId, authSecret); - var result = await context.AcquireTokenAsync(resource, clientCredential).ConfigureAwait(false); - - return result.AccessToken; - } - - /// - /// Gets the AAD user object id. - /// - /// - /// This could potentially be determined at runtime by requesting the service principal's object id - /// from Azure AD graph API. However in practice this was difficult because the AAD graph client - /// (Microsoft.Azure.ActiveDirectory.GraphClient) does not support .NET Core, and Microsoft graph client - /// (Microsoft.Graph) does not yet support AAD Application API. - /// - public static string GetUserObjectId() - { - const string objectIdKey = "ObjectId"; - - return GetOrAddVariable( - objectIdKey, - () => - { - string objectId; - if (_environment.ConnectionString.KeyValuePairs.TryGetValue(objectIdKey, out objectId)) - { - return objectId; - } - else - { - string servicePrincipal = _environment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalKey]; - - throw new KeyNotFoundException( - string.Format( - "Connection string key {0} not found. You can determine the correct value by running this in PowerShell:" + - " `Get-AzureRmADServicePrincipal -ServicePrincipalName {1}`, then add `ObjectId=` to your" + - " TEST_CSM_ORGID_AUTHENTICATION connection string.", - objectIdKey, - servicePrincipal)); - } - }); - } - - /// - /// Gets the AAD tenant id from the test environment. - /// - public static string GetTenantId() - { - const string tenantIdKey = "TenantId"; - - return GetOrAddVariable( - tenantIdKey, - () => - { - return _environment.Tenant; - }); - } - - /// - /// Gets a variable from HTTP recording (when test is in playback mode) or writes a variable to HTTP recording - /// (when test is in recording mode). - /// - /// Key that the variable value is stored under in HTTP recording file. - /// Function that generates the variable value if necessary. - /// The variable value. - private static string GetOrAddVariable(string key, Func generateValueFunc) - { - if (HttpMockServer.Mode == HttpRecorderMode.Record) - { - string value = generateValueFunc(); - HttpMockServer.Variables[key] = value; - return value; - } - else - { - return HttpMockServer.Variables[key]; - } - } - - /// - /// Gets values from the loaded environment - /// - private static string GetValueFromEnvironment(string key, string backupValue = null) - { - return GetOrAddVariable(key, () => - { - string value; - bool successful = _environment.ConnectionString.KeyValuePairs.TryGetValue(key, out value); - - if (!successful) - { - // For variables that may default to other locations (i.e. stage location, if not provided, should default to default production location), - // Check if the backup value is not null and return that if the the environment variable is not found. - if(backupValue != null) - { - return backupValue; - } - - throw new KeyNotFoundException( - string.Format("Value for key '{0}' was not found in environment variable '{1}'. Ensure this value is included in the environment variable.", - key, _environmentVariableName)); - } - - return value; - }); - } - - public static KeyVaultClient GetKeyVaultClient() - { - DelegatingHandler mockServer = HttpMockServer.CreateInstance(); - return new KeyVaultClient(new TestKeyVaultCredential(GetAccessToken), handlers: mockServer); - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565180967$TestEnvironmentUtilities.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565180967$TestEnvironmentUtilities.cs deleted file mode 100644 index 8d7884f36be5..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/.localhistory/D/azure-sdk-for-net/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/tests/Utilities/1565180967$TestEnvironmentUtilities.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -using Microsoft.Azure.KeyVault; -using Microsoft.Azure.Test.HttpRecorder; -using Microsoft.IdentityModel.Clients.ActiveDirectory; -using Microsoft.Rest.ClientRuntime.Azure.TestFramework; -using Sql.Tests.Utilities; -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; - -namespace Sql.Tests -{ - public static class TestEnvironmentUtilities - { - private const string _environmentVariableName = "TEST_CSM_ORGID_AUTHENTICATION"; - - private static readonly TestEnvironment _environment = - new TestEnvironment(Environment.GetEnvironmentVariable(_environmentVariableName)); - - // We now load default locations from environment variable. - // Tests were recorded with this appended to DefaultLocationId=japaneast;DefaultLocation=Japan East;DefaultSecondaryLocationId=centralus;DefaultSecondaryLocation=Central US;DefaultStagePrimaryLocation=North Europe;DefaultStageSecondaryLocation=SouthEast Asia;DefaultEuapPrimaryLocation=East US 2 EUAP;DefaultEuapPrimaryLocationId=eastus2euap - public static string DefaultLocation - { - get - { - return GetValueFromEnvironment("DefaultLocation"); - } - } - public static string DefaultLocationId - { - get - { - return GetValueFromEnvironment("DefaultLocationId"); - } - } - - public static string DefaultSecondaryLocationId - { - get - { - return GetValueFromEnvironment("DefaultSecondaryLocationId"); - } - } - - public static string DefaultSecondaryLocation - { - get - { - return GetValueFromEnvironment("DefaultSecondaryLocation"); - } - } - public static string DefaultStagePrimaryLocation - { - get - { - return GetValueFromEnvironment("DefaultStagePrimaryLocation", DefaultLocation); - } - } - - public static string DefaultStageSecondaryLocation - { - get - { - return GetValueFromEnvironment("DefaultStageSecondaryLocation", DefaultSecondaryLocation); - } - } - - public static string DefaultEuapPrimaryLocation - { - get - { - return GetValueFromEnvironment("DefaultEuapPrimaryLocation", DefaultLocation); - } - } - - public static string DefaultEuapPrimaryLocationId - { - get - { - return GetValueFromEnvironment("DefaultEuapPrimaryLocationId", DefaultLocationId); - } - } - - public static async Task GetAccessToken(string authority, string resource, string scope) - { - TestEnvironment testEnvironment = TestEnvironmentFactory.GetTestEnvironment(); - - var context = new AuthenticationContext(authority); - string authClientId = testEnvironment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalKey]; - string authSecret = testEnvironment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalSecretKey]; - var clientCredential = new ClientCredential(authClientId, authSecret); - var result = await context.AcquireTokenAsync(resource, clientCredential).ConfigureAwait(false); - - return result.AccessToken; - } - - /// - /// Gets the AAD user object id. - /// - /// - /// This could potentially be determined at runtime by requesting the service principal's object id - /// from Azure AD graph API. However in practice this was difficult because the AAD graph client - /// (Microsoft.Azure.ActiveDirectory.GraphClient) does not support .NET Core, and Microsoft graph client - /// (Microsoft.Graph) does not yet support AAD Application API. - /// - public static string GetUserObjectId() - { - const string objectIdKey = "ServicePrincipal"; - - return GetOrAddVariable( - objectIdKey, - () => - { - string objectId; - if (_environment.ConnectionString.KeyValuePairs.TryGetValue(objectIdKey, out objectId)) - { - return objectId; - } - else - { - string servicePrincipal = _environment.ConnectionString.KeyValuePairs[ConnectionStringKeys.ServicePrincipalKey]; - - throw new KeyNotFoundException( - string.Format( - "Connection string key {0} not found. You can determine the correct value by running this in PowerShell:" + - " `Get-AzureRmADServicePrincipal -ServicePrincipalName {1}`, then add `ObjectId=` to your" + - " TEST_CSM_ORGID_AUTHENTICATION connection string.", - objectIdKey, - servicePrincipal)); - } - }); - } - - /// - /// Gets the AAD tenant id from the test environment. - /// - public static string GetTenantId() - { - const string tenantIdKey = "TenantId"; - - return GetOrAddVariable( - tenantIdKey, - () => - { - return _environment.Tenant; - }); - } - - /// - /// Gets a variable from HTTP recording (when test is in playback mode) or writes a variable to HTTP recording - /// (when test is in recording mode). - /// - /// Key that the variable value is stored under in HTTP recording file. - /// Function that generates the variable value if necessary. - /// The variable value. - private static string GetOrAddVariable(string key, Func generateValueFunc) - { - if (HttpMockServer.Mode == HttpRecorderMode.Record) - { - string value = generateValueFunc(); - HttpMockServer.Variables[key] = value; - return value; - } - else - { - return HttpMockServer.Variables[key]; - } - } - - /// - /// Gets values from the loaded environment - /// - private static string GetValueFromEnvironment(string key, string backupValue = null) - { - return GetOrAddVariable(key, () => - { - string value; - bool successful = _environment.ConnectionString.KeyValuePairs.TryGetValue(key, out value); - - if (!successful) - { - // For variables that may default to other locations (i.e. stage location, if not provided, should default to default production location), - // Check if the backup value is not null and return that if the the environment variable is not found. - if(backupValue != null) - { - return backupValue; - } - - throw new KeyNotFoundException( - string.Format("Value for key '{0}' was not found in environment variable '{1}'. Ensure this value is included in the environment variable.", - key, _environmentVariableName)); - } - - return value; - }); - } - - public static KeyVaultClient GetKeyVaultClient() - { - DelegatingHandler mockServer = HttpMockServer.CreateInstance(); - return new KeyVaultClient(new TestKeyVaultCredential(GetAccessToken), handlers: mockServer); - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/IManagedInstanceAdministratorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/IManagedInstanceAdministratorsOperations.cs deleted file mode 100644 index 9d1f5e541999..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/IManagedInstanceAdministratorsOperations.cs +++ /dev/null @@ -1,226 +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 -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ManagedInstanceAdministratorsOperations operations. - /// - public partial interface IManagedInstanceAdministratorsOperations - { - /// - /// Gets a list of managed instance administrators. - /// - /// - /// The name of the resource group that 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>> ListByInstanceWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The administrator 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 managedInstanceName, string administratorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The requested administrator name. - /// - /// - /// The requested administrator 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 managedInstanceName, string administratorName, ManagedInstanceAdministrator parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The administrator name. - /// - /// - /// 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 administratorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The requested administrator name. - /// - /// - /// The requested administrator 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 managedInstanceName, string administratorName, ManagedInstanceAdministrator parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The administrator name. - /// - /// - /// 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 administratorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of managed instance administrators. - /// - /// - /// 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>> ListByInstanceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ISqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ISqlManagementClient.cs index 8936e41bd40c..5b66d4e9f264 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ISqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ISqlManagementClient.cs @@ -377,11 +377,6 @@ public partial interface ISqlManagementClient : System.IDisposable /// ISensitivityLabelsOperations SensitivityLabels { get; } - /// - /// Gets the IManagedInstanceAdministratorsOperations. - /// - IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; } - /// /// Gets the IDatabaseOperations. /// diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceAdministratorsOperations.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceAdministratorsOperations.cs deleted file mode 100644 index c8c2446903d3..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceAdministratorsOperations.cs +++ /dev/null @@ -1,1104 +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 -{ - 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; - - /// - /// ManagedInstanceAdministratorsOperations operations. - /// - internal partial class ManagedInstanceAdministratorsOperations : IServiceOperations, IManagedInstanceAdministratorsOperations - { - /// - /// Initializes a new instance of the ManagedInstanceAdministratorsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ManagedInstanceAdministratorsOperations(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 administrators. - /// - /// - /// The name of the resource group 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>> ListByInstanceWithHttpMessagesAsync(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 = "2017-03-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, "ListByInstance", 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}/administrators").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 managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The administrator name. - /// - /// - /// 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 administratorName, 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 (administratorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "administratorName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2017-03-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("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/managedInstances/{managedInstanceName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); - _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); - _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 administrator. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The requested administrator name. - /// - /// - /// The requested administrator parameters. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string administratorName, ManagedInstanceAdministrator parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, administratorName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The administrator name. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string administratorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, administratorName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates or updates a managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The requested administrator name. - /// - /// - /// The requested administrator 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 managedInstanceName, string administratorName, ManagedInstanceAdministrator 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 (administratorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "administratorName"); - } - 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 = "2017-03-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("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/managedInstances/{managedInstanceName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); - _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); - _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 && (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); - } - } - // 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; - } - - /// - /// Deletes a managed instance administrator. - /// - /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. - /// - /// - /// The name of the managed instance. - /// - /// - /// The administrator name. - /// - /// - /// 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 administratorName, 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 (administratorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "administratorName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2017-03-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("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/managedInstances/{managedInstanceName}/administrators/{administratorName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); - _url = _url.Replace("{administratorName}", System.Uri.EscapeDataString(administratorName)); - _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) - { - 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 a list of managed instance administrators. - /// - /// - /// 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>> ListByInstanceNextWithHttpMessagesAsync(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, "ListByInstanceNext", 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.SqlManagement/src/Generated/ManagedInstanceAdministratorsOperationsExtensions.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceAdministratorsOperationsExtensions.cs deleted file mode 100644 index 86533cd9675b..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/ManagedInstanceAdministratorsOperationsExtensions.cs +++ /dev/null @@ -1,347 +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 -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ManagedInstanceAdministratorsOperations. - /// - public static partial class ManagedInstanceAdministratorsOperationsExtensions - { - /// - /// Gets a list of managed instance administrators. - /// - /// - /// 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 ListByInstance(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName) - { - return operations.ListByInstanceAsync(resourceGroupName, managedInstanceName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of managed instance administrators. - /// - /// - /// 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> ListByInstanceAsync(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInstanceWithHttpMessagesAsync(resourceGroupName, managedInstanceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a managed instance administrator. - /// - /// - /// 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 administrator name. - /// - public static ManagedInstanceAdministrator Get(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName) - { - return operations.GetAsync(resourceGroupName, managedInstanceName, administratorName).GetAwaiter().GetResult(); - } - - /// - /// Gets a managed instance administrator. - /// - /// - /// 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 administrator name. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, administratorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates a managed instance administrator. - /// - /// - /// 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 requested administrator name. - /// - /// - /// The requested administrator parameters. - /// - public static ManagedInstanceAdministrator CreateOrUpdate(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName, ManagedInstanceAdministrator parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a managed instance administrator. - /// - /// - /// 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 requested administrator name. - /// - /// - /// The requested administrator parameters. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, administratorName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a managed instance administrator. - /// - /// - /// 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 administrator name. - /// - public static void Delete(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName) - { - operations.DeleteAsync(resourceGroupName, managedInstanceName, administratorName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a managed instance administrator. - /// - /// - /// 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 administrator name. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, administratorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Creates or updates a managed instance administrator. - /// - /// - /// 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 requested administrator name. - /// - /// - /// The requested administrator parameters. - /// - public static ManagedInstanceAdministrator BeginCreateOrUpdate(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName, ManagedInstanceAdministrator parameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a managed instance administrator. - /// - /// - /// 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 requested administrator name. - /// - /// - /// The requested administrator parameters. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName, ManagedInstanceAdministrator parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, administratorName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a managed instance administrator. - /// - /// - /// 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 administrator name. - /// - public static void BeginDelete(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName) - { - operations.BeginDeleteAsync(resourceGroupName, managedInstanceName, administratorName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a managed instance administrator. - /// - /// - /// 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 administrator name. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IManagedInstanceAdministratorsOperations operations, string resourceGroupName, string managedInstanceName, string administratorName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, managedInstanceName, administratorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a list of managed instance administrators. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByInstanceNext(this IManagedInstanceAdministratorsOperations operations, string nextPageLink) - { - return operations.ListByInstanceNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of managed instance administrators. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInstanceNextAsync(this IManagedInstanceAdministratorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInstanceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceAdministrator.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceAdministrator.cs deleted file mode 100644 index ae722758adb5..000000000000 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/Models/ManagedInstanceAdministrator.cs +++ /dev/null @@ -1,105 +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.Linq; - - /// - /// An Azure SQL managed instance administrator. - /// - [Rest.Serialization.JsonTransformation] - public partial class ManagedInstanceAdministrator : ProxyResource - { - /// - /// Initializes a new instance of the ManagedInstanceAdministrator - /// class. - /// - public ManagedInstanceAdministrator() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ManagedInstanceAdministrator - /// class. - /// - /// Login name of the managed instance - /// administrator. - /// SID (object ID) of the managed instance - /// administrator. - /// Resource ID. - /// Resource name. - /// Resource type. - /// Tenant ID of the managed instance - /// administrator. - public ManagedInstanceAdministrator(string login, System.Guid sid, string id = default(string), string name = default(string), string type = default(string), System.Guid? tenantId = default(System.Guid?)) - : base(id, name, type) - { - Login = login; - Sid = sid; - TenantId = tenantId; - CustomInit(); - } - /// - /// Static constructor for ManagedInstanceAdministrator class. - /// - static ManagedInstanceAdministrator() - { - AdministratorType = "ActiveDirectory"; - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets login name of the managed instance administrator. - /// - [JsonProperty(PropertyName = "properties.login")] - public string Login { get; set; } - - /// - /// Gets or sets SID (object ID) of the managed instance administrator. - /// - [JsonProperty(PropertyName = "properties.sid")] - public System.Guid Sid { get; set; } - - /// - /// Gets or sets tenant ID of the managed instance administrator. - /// - [JsonProperty(PropertyName = "properties.tenantId")] - public System.Guid? TenantId { get; set; } - - /// - /// Type of the managed instance administrator. - /// - [JsonProperty(PropertyName = "properties.administratorType")] - public static string AdministratorType { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Login == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Login"); - } - } - } -} diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SdkInfo_SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SdkInfo_SqlManagementClient.cs index 6cfd3178c9d0..8fd6deae69dd 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SdkInfo_SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SdkInfo_SqlManagementClient.cs @@ -66,7 +66,6 @@ public static IEnumerable> ApiInfo_SqlManagementCl new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessmentScans", "2017-10-01-preview"), new Tuple("Sql", "ManagedDatabaseVulnerabilityAssessments", "2017-10-01-preview"), new Tuple("Sql", "ManagedDatabases", "2017-03-01-preview"), - new Tuple("Sql", "ManagedInstanceAdministrators", "2017-03-01-preview"), new Tuple("Sql", "ManagedInstanceEncryptionProtectors", "2017-10-01-preview"), new Tuple("Sql", "ManagedInstanceKeys", "2017-10-01-preview"), new Tuple("Sql", "ManagedInstanceTdeCertificates", "2017-10-01-preview"), @@ -110,5 +109,15 @@ public static IEnumerable> ApiInfo_SqlManagementCl }.AsEnumerable(); } } + // BEGIN: Code Generation Metadata Section + public static readonly String AutoRestVersion = "latest"; + public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/sql/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=."; + public static readonly String GithubForkName = "Azure"; + public static readonly String GithubBranchName = "master"; + public static readonly String GithubCommidId = "737110f8edd3689144c45d6fd34e7c6143171ab8"; + public static readonly String CodeGenerationErrors = ""; + public static readonly String GithubRepoName = "azure-rest-api-specs"; + // END: Code Generation Metadata Section } } diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SqlManagementClient.cs b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SqlManagementClient.cs index 52bd2532b2bf..1cc3bd45f2da 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SqlManagementClient.cs +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Generated/SqlManagementClient.cs @@ -382,11 +382,6 @@ public partial class SqlManagementClient : ServiceClient, I /// public virtual ISensitivityLabelsOperations SensitivityLabels { get; private set; } - /// - /// Gets the IManagedInstanceAdministratorsOperations. - /// - public virtual IManagedInstanceAdministratorsOperations ManagedInstanceAdministrators { get; private set; } - /// /// Gets the IDatabaseOperations. /// @@ -790,7 +785,6 @@ private void Initialize() ManagedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesOperations(this); ManagedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesOperations(this); SensitivityLabels = new SensitivityLabelsOperations(this); - ManagedInstanceAdministrators = new ManagedInstanceAdministratorsOperations(this); DatabaseOperations = new DatabaseOperations(this); ElasticPoolOperations = new ElasticPoolOperations(this); Capabilities = new CapabilitiesOperations(this); diff --git a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Microsoft.Azure.Management.Sql.csproj b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Microsoft.Azure.Management.Sql.csproj index 84ff4c0e9aae..61232e89661e 100644 --- a/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Microsoft.Azure.Management.Sql.csproj +++ b/sdk/sqlmanagement/Microsoft.Azure.Management.SqlManagement/src/Microsoft.Azure.Management.Sql.csproj @@ -7,7 +7,7 @@ Microsoft.Azure.Management.Sql Azure SQL Management SDK library Microsoft.Azure.Management.Sql - 1.34.0-preview + 1.33.0-preview Microsoft Azure SQL Management;SQL;SQL Management; (); - ResourceManagementClient resourceClient = context.GetClient(); - ManagedInstance instance = sqlClient.ManagedInstances.Get(ResourceGroupName, ManagedInstanceName); - - // Add new Active Directory Admin - ManagedInstanceAdministrator newAdmin = new ManagedInstanceAdministrator(login: aadAdmin, sid: objectId, tenantId: tenantId); - ManagedInstanceAdministrator createResult = sqlClient.ManagedInstanceAdministrators.CreateOrUpdate(ResourceGroupName, instance.Name, "ActiveDirectory", newAdmin); - Assert.Equal(aadAdmin, createResult.Login); - - // Get the current Active Directory Admin - ManagedInstanceAdministrator getResult = sqlClient.ManagedInstanceAdministrators.Get(ResourceGroupName, instance.Name, "ActiveDirectory"); - Assert.Equal(aadAdmin, getResult.Login); - Assert.Equal(objectId, getResult.Sid); - Assert.Equal(tenantId, getResult.TenantId); - - // Delete the Active Directory Admin on server - sqlClient.ManagedInstanceAdministrators.Delete(ResourceGroupName, instance.Name, "ActiveDirectory"); - - // List all Active Directory Admins for isntance. - Page1 admins = (Page1) sqlClient.ManagedInstanceAdministrators.ListByInstance(ResourceGroupName, instance.Name); - Assert.True(admins == null || !admins.GetEnumerator().MoveNext()); - } - } - } -}