/// <summary>
        /// Gets the database server security policy of the given database server in the given resource group
        /// </summary>
        public DatabaseSecurityPolicy GetServerSecurityPolicy(string resourceGroupName, string serverName, string clientRequestId)
        {
            ISecurityOperations operations             = GetCurrentSqlClient(clientRequestId).DatabaseSecurity;
            DatabaseSecurityPolicyGetResponse response = operations.Get(resourceGroupName, serverName, Constants.ServerPolicyId);

            return(response.DatabaseSecurityPolicy);
        }
Пример #2
0
 /// <summary>
 /// Gets Azure SQL Database security policy object according to a given
 /// Azure SQL Database Server and Database.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Management.Sql.ISecurityOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the Azure SQL
 /// Database Server belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Database Server on which the
 /// Azure SQL Database hosted.
 /// </param>
 /// <param name='databaseName'>
 /// Required. The name of the Azure SQL Database for which the security
 /// policy is being retreived.
 /// </param>
 /// <returns>
 /// Represents the response to a get Azure SQL Database security policy
 /// request
 /// </returns>
 public static DatabaseSecurityPolicyGetResponse Get(this ISecurityOperations operations, string resourceGroupName, string serverName, string databaseName)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ISecurityOperations)s).GetAsync(resourceGroupName, serverName, databaseName);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the SqlManagementClient class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 private SqlManagementClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._databases        = new DatabaseOperations(this);
     this._firewallRules    = new FirewallRuleOperations(this);
     this._databaseSecurity = new SecurityOperations(this);
     this._servers          = new ServerOperations(this);
     this._apiVersion       = "2014-04-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
 /// <summary>
 /// Initializes a new instance of the SqlManagementClient class.
 /// </summary>
 public SqlManagementClient()
     : base()
 {
     this._auditingPolicy   = new AuditingPolicyOperations(this);
     this._databases        = new DatabaseOperations(this);
     this._dataMasking      = new DataMaskingOperations(this);
     this._firewallRules    = new FirewallRuleOperations(this);
     this._secureConnection = new SecureConnectionPolicyOperations(this);
     this._databaseSecurity = new SecurityOperations(this);
     this._servers          = new ServerOperations(this);
     this._apiVersion       = "2014-04-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
        /// <summary>
        /// Sets the database server security policy of the given database server in the given resource group
        /// </summary>
        public void SetServerSecurityPolicy(string resourceGroupName, string serverName, string clientRequestId, DatabaseSecurityPolicyUpdateParameters parameters)
        {
            ISecurityOperations operations = GetCurrentSqlClient(clientRequestId).DatabaseSecurity;

            operations.Update(resourceGroupName, serverName, Constants.ServerPolicyId, parameters);
        }
Пример #6
0
 /// <summary>
 /// Gets Azure SQL Database security policy object according to a given
 /// Azure SQL Database Server and Database.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Management.Sql.ISecurityOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the Azure SQL
 /// Database Server belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Database Server on which the
 /// Azure SQL Database hosted.
 /// </param>
 /// <param name='databaseName'>
 /// Required. The name of the Azure SQL Database for which the security
 /// policy is being retreived.
 /// </param>
 /// <returns>
 /// Represents the response to a get Azure SQL Database security policy
 /// request
 /// </returns>
 public static Task <DatabaseSecurityPolicyGetResponse> GetAsync(this ISecurityOperations operations, string resourceGroupName, string serverName, string databaseName)
 {
     return(operations.GetAsync(resourceGroupName, serverName, databaseName, CancellationToken.None));
 }
Пример #7
0
 /// <summary>
 /// Updates an Azure SQL Database security policy object.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.Azure.Management.Sql.ISecurityOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the Resource Group to which the Azure SQL
 /// Database Server belongs.
 /// </param>
 /// <param name='serverName'>
 /// Required. The name of the Azure SQL Database Server to which the
 /// Azure SQL Database belongs.
 /// </param>
 /// <param name='databaseName'>
 /// Required. The name of the Azure SQL Database to which the security
 /// policy is applied.
 /// </param>
 /// <param name='parameters'>
 /// Required. The required parameters for updating a security policy.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task <AzureOperationResponse> UpdateAsync(this ISecurityOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityPolicyUpdateParameters parameters)
 {
     return(operations.UpdateAsync(resourceGroupName, serverName, databaseName, parameters, CancellationToken.None));
 }