/// <summary>
 /// Initializes a new instance of the SqlManagementClient class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 public SqlManagementClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._auditingPolicy                       = new AuditingPolicyOperations(this);
     this._capabilities                         = new CapabilitiesOperations(this);
     this._databaseActivation                   = new DatabaseActivationOperations(this);
     this._databaseBackup                       = new DatabaseBackupOperations(this);
     this._databases                            = new DatabaseOperations(this);
     this._dataMasking                          = new DataMaskingOperations(this);
     this._elasticPools                         = new ElasticPoolOperations(this);
     this._firewallRules                        = new FirewallRuleOperations(this);
     this._recommendedElasticPools              = new RecommendedElasticPoolOperations(this);
     this._recommendedIndexes                   = new RecommendedIndexOperations(this);
     this._databaseReplicationLinks             = new ReplicationLinkOperations(this);
     this._secureConnection                     = new SecureConnectionPolicyOperations(this);
     this._securityAlertPolicy                  = new SecurityAlertPolicyOperations(this);
     this._serverAdministrators                 = new ServerAdministratorOperations(this);
     this._communicationLinks                   = new ServerCommunicationLinkOperations(this);
     this._serverDisasterRecoveryConfigurations = new ServerDisasterRecoveryConfigurationOperations(this);
     this._servers                            = new ServerOperations(this);
     this._serverUpgrades                     = new ServerUpgradeOperations(this);
     this._serviceObjectives                  = new ServiceObjectiveOperations(this);
     this._serviceTierAdvisors                = new ServiceTierAdvisorOperations(this);
     this._transparentDataEncryption          = new TransparentDataEncryptionOperations(this);
     this._apiVersion                         = "2014-04-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout                  = TimeSpan.FromSeconds(300);
 }
示例#2
0
        /// <summary>
        /// Gets the database security alert policy for the given database in the given database server in the given resource group
        /// </summary>
        public Management.Sql.LegacySdk.Models.DatabaseSecurityAlertPolicy GetDatabaseSecurityAlertPolicy(string resourceGroupName, string serverName, string databaseName)
        {
            ISecurityAlertPolicyOperations         operations = GetLegacySqlClient().SecurityAlertPolicy;
            DatabaseSecurityAlertPolicyGetResponse response   = operations.GetDatabaseSecurityAlertPolicy(resourceGroupName, serverName, databaseName);

            return(response.SecurityAlertPolicy);
        }
示例#3
0
        /// <summary>
        /// Gets the server security alert policy for the given server in the given resource group
        /// </summary>
        public ServerSecurityAlertPolicy GetServerSecurityAlertPolicy(string resourceGroupName, string serverName, string clientRequestId)
        {
            ISecurityAlertPolicyOperations operations = GetCurrentSqlClient(clientRequestId).SecurityAlertPolicy;
            var response = operations.GetServerSecurityAlertPolicy(resourceGroupName, serverName);

            return(response.SecurityAlertPolicy);
        }
        /// <summary>
        /// Gets the database security alert policy for the given database in the given database server in the given resource group
        /// </summary>
        public DatabaseSecurityAlertPolicy GetDatabaseSecurityAlertPolicy(string resourceGroupName, string serverName, string databaseName)
        {
            ISecurityAlertPolicyOperations         operations = GetCurrentSqlClient().SecurityAlertPolicy;
            DatabaseSecurityAlertPolicyGetResponse response   = operations.GetDatabaseSecurityAlertPolicy(resourceGroupName, serverName, databaseName);

            return(response.SecurityAlertPolicy);
        }
示例#5
0
 /// <summary>
 /// Gets the status of an Azure Sql Server security alert policy create
 /// or update operation.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.LegacySdk.ISecurityAlertPolicyOperations.
 /// </param>
 /// <param name='operationStatusLink'>
 /// Required. Server blob auditing status link returned by the
 /// CreateOrUpdate operation
 /// </param>
 /// <returns>
 /// Response for long running Azure Sql server threat detection create
 /// or update operations.
 /// </returns>
 public static ServerSecurityAlertPolicyOperationResponse GetOperationStatus(this ISecurityAlertPolicyOperations operations, string operationStatusLink)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ISecurityAlertPolicyOperations)s).GetOperationStatusAsync(operationStatusLink);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
示例#6
0
        /// <summary>
        /// Calls the set security alert APIs for the server security alert policy in the given resource group
        /// </summary>
        public void SetServerSecurityAlertPolicy(string resourceGroupName, string serverName, string clientRequestId, ServerSecurityAlertPolicyCreateOrUpdateParameters parameters)
        {
            ISecurityAlertPolicyOperations operations = GetCurrentSqlClient(clientRequestId).SecurityAlertPolicy;
            var statusLink = operations.CreateOrUpdateServerSecurityAlertPolicy(resourceGroupName, serverName, parameters).OperationStatusLink;

            if (string.IsNullOrEmpty(statusLink))
            {
                return;
            }
            for (var iterationCount = 0; iterationCount < 1800; iterationCount++) // wait for at most an hour
            {
                var status = GetServerCreateOrUpdateOperationStatus(statusLink, clientRequestId);
                if (status == OperationStatus.Succeeded)
                {
                    break;
                }
                TestMockSupport.Delay(2000); // wait 2 seconds between each poll
            }
        }
示例#7
0
 /// <summary>
 /// Creates or updates an Azure SQL Database security alert policy.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.LegacySdk.ISecurityAlertPolicyOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the server
 /// belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Database Server on which the
 /// database is hosted.
 /// </param>
 /// <param name='databaseName'>
 /// Required. The name of the Azure SQL Database for which the security
 /// alert policy applies.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for creating or updating a Azure
 /// SQL Database security alert policy.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AzureOperationResponse CreateOrUpdateDatabaseSecurityAlertPolicy(this ISecurityAlertPolicyOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicyCreateOrUpdateParameters parameters)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ISecurityAlertPolicyOperations)s).CreateOrUpdateDatabaseSecurityAlertPolicyAsync(resourceGroupName, serverName, databaseName, parameters);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
示例#8
0
 /// <summary>
 /// Returns an Azure SQL Database security alert policy.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.LegacySdk.ISecurityAlertPolicyOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the server
 /// belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Database Server on which the
 /// database is hosted.
 /// </param>
 /// <returns>
 /// Represents the response to a get server security alert policy
 /// request.
 /// </returns>
 public static Task <ServerSecurityAlertPolicyGetResponse> GetServerSecurityAlertPolicyAsync(this ISecurityAlertPolicyOperations operations, string resourceGroupName, string serverName)
 {
     return(operations.GetServerSecurityAlertPolicyAsync(resourceGroupName, serverName, CancellationToken.None));
 }
示例#9
0
 /// <summary>
 /// Returns an Azure SQL Database security alert policy.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.LegacySdk.ISecurityAlertPolicyOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the server
 /// belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Database Server on which the
 /// database is hosted.
 /// </param>
 /// <returns>
 /// Represents the response to a get server security alert policy
 /// request.
 /// </returns>
 public static ServerSecurityAlertPolicyGetResponse GetServerSecurityAlertPolicy(this ISecurityAlertPolicyOperations operations, string resourceGroupName, string serverName)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ISecurityAlertPolicyOperations)s).GetServerSecurityAlertPolicyAsync(resourceGroupName, serverName);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
示例#10
0
 /// <summary>
 /// Gets the status of an Azure Sql Server security alert policy create
 /// or update operation.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.LegacySdk.ISecurityAlertPolicyOperations.
 /// </param>
 /// <param name='operationStatusLink'>
 /// Required. Server blob auditing status link returned by the
 /// CreateOrUpdate operation
 /// </param>
 /// <returns>
 /// Response for long running Azure Sql server threat detection create
 /// or update operations.
 /// </returns>
 public static Task <ServerSecurityAlertPolicyOperationResponse> GetOperationStatusAsync(this ISecurityAlertPolicyOperations operations, string operationStatusLink)
 {
     return(operations.GetOperationStatusAsync(operationStatusLink, CancellationToken.None));
 }
示例#11
0
 /// <summary>
 /// Creates or updates an Azure SQL Server security alert policy.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.LegacySdk.ISecurityAlertPolicyOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the server
 /// belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Database Server on which the
 /// database is hosted.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for creating or updating a Azure
 /// SQL Database security alert policy.
 /// </param>
 /// <returns>
 /// Response to Azure Sql Server security alert policy create or update
 /// operation.
 /// </returns>
 public static Task <ServerSecurityAlertPolicyCreateOrUpdateResponse> CreateOrUpdateServerSecurityAlertPolicyAsync(this ISecurityAlertPolicyOperations operations, string resourceGroupName, string serverName, ServerSecurityAlertPolicyCreateOrUpdateParameters parameters)
 {
     return(operations.CreateOrUpdateServerSecurityAlertPolicyAsync(resourceGroupName, serverName, parameters, CancellationToken.None));
 }
示例#12
0
        /// <summary>
        /// Calls the set security alert APIs for the database security alert policy for the given database in the given database server in the given resource group
        /// </summary>
        public void SetDatabaseSecurityAlertPolicy(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicyCreateOrUpdateParameters parameters)
        {
            ISecurityAlertPolicyOperations operations = GetLegacySqlClient().SecurityAlertPolicy;

            operations.CreateOrUpdateDatabaseSecurityAlertPolicy(resourceGroupName, serverName, databaseName, parameters);
        }
示例#13
0
        /// <summary>
        /// Calls the set security alert APIs for the database security alert policy for the given database in the given database server in the given resource group
        /// </summary>
        public void SetDatabaseSecurityAlertPolicy(string resourceGroupName, string serverName, string databaseName, string clientRequestId, DatabaseSecurityAlertPolicyCreateOrUpdateParameters parameters)
        {
            ISecurityAlertPolicyOperations operations = GetCurrentSqlClient(clientRequestId).SecurityAlertPolicy;

            operations.CreateOrUpdateDatebaseSecurityAlertPolicy(resourceGroupName, serverName, databaseName, parameters);
        }
示例#14
0
 /// <summary>
 /// Creates or updates an Azure SQL Database security alert policy.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Sql.ISecurityAlertPolicyOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the server
 /// belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Database Server on which the
 /// database is hosted.
 /// </param>
 /// <param name='databaseName'>
 /// Required. The name of the Azure SQL Database for which the security
 /// alert policy applies.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for creating or updating a Azure
 /// SQL Database security alert policy.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> CreateOrUpdateDatabaseSecurityAlertPolicyAsync(this ISecurityAlertPolicyOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicyCreateOrUpdateParameters parameters)
 {
     return operations.CreateOrUpdateDatabaseSecurityAlertPolicyAsync(resourceGroupName, serverName, databaseName, parameters, CancellationToken.None);
 }