This class is responsible for all the REST communication with the audit REST endpoints
示例#1
0
 /// <summary>
 /// Constructs a database adapter
 /// </summary>
 /// <param name="profile">The current azure profile</param>
 /// <param name="subscription">The current azure subscription</param>
 public AzureSqlDatabaseAdapter(AzureContext context)
 {
     Context                 = context;
     _subscription           = context.Subscription;
     Communicator            = new AzureSqlDatabaseCommunicator(Context);
     ElasticPoolCommunicator = new AzureSqlElasticPoolCommunicator(Context);
 }
 /// <summary>
 /// Constructs a database adapter
 /// </summary>
 /// <param name="profile">The current azure profile</param>
 /// <param name="subscription">The current azure subscription</param>
 public AzureSqlDatabaseAdapter(AzureProfile Profile, AzureSubscription subscription)
 {
     this.Profile = Profile;
     this._subscription = subscription;
     Communicator = new AzureSqlDatabaseCommunicator(Profile, subscription);
     ElasticPoolCommunicator = new AzureSqlElasticPoolCommunicator(Profile, subscription);
 }
 /// <summary>
 /// Constructs a database adapter
 /// </summary>
 /// <param name="profile">The current azure profile</param>
 /// <param name="subscription">The current azure subscription</param>
 public AzureSqlDatabaseAdapter(AzureContext context)
 {
     Context = context;
     _subscription = context.Subscription;
     Communicator = new AzureSqlDatabaseCommunicator(Context);
     ElasticPoolCommunicator = new AzureSqlElasticPoolCommunicator(Context);
 }
 /// <summary>
 /// Constructs a database adapter
 /// </summary>
 /// <param name="profile">The current azure profile</param>
 /// <param name="subscription">The current azure subscription</param>
 public AzureSqlDatabaseAdapter(AzureProfile Profile, AzureSubscription subscription)
 {
     this.Profile            = Profile;
     this._subscription      = subscription;
     Communicator            = new AzureSqlDatabaseCommunicator(Profile, subscription);
     ElasticPoolCommunicator = new AzureSqlElasticPoolCommunicator(Profile, subscription);
 }
 /// <summary>
 /// Constructs a database adapter
 /// </summary>
 /// <param name="profile">The current azure profile</param>
 /// <param name="subscription">The current azure subscription</param>
 public AzureSqlDatabaseReplicationAdapter(AzureContext context)
 {
     Context = context;
     _subscription = context.Subscription;
     ReplicationCommunicator = new AzureSqlDatabaseReplicationCommunicator(Context);
     DatabaseCommunicator = new AzureSqlDatabaseCommunicator(Context);
     ServerCommunicator = new AzureSqlServerCommunicator(Context);
 }
 /// <summary>
 /// Constructs a database adapter
 /// </summary>
 /// <param name="profile">The current azure profile</param>
 /// <param name="subscription">The current azure subscription</param>
 public AzureSqlDatabaseReplicationAdapter(AzureProfile Profile, AzureSubscription subscription)
 {
     this.Profile = Profile;
     this._subscription = subscription;
     ReplicationCommunicator = new AzureSqlDatabaseReplicationCommunicator(Profile, subscription);
     DatabaseCommunicator = new AzureSqlDatabaseCommunicator(Profile, subscription);
     ServerCommunicator = new AzureSqlServerCommunicator(Profile, subscription);
 }
 private bool IsDatabaseInServiceTierForPolicy(DatabaseAuditingPolicyModel model, string clientId)
 {
     AzureSqlDatabaseCommunicator dbCommunicator = new AzureSqlDatabaseCommunicator(Profile, Subscription);
     Management.Sql.Models.Database database = dbCommunicator.Get(model.ResourceGroupName, model.ServerName, model.DatabaseName, clientId);
     DatabaseEdition edition = DatabaseEdition.None;
     Enum.TryParse<DatabaseEdition>(database.Properties.Edition, true, out edition);
     if(edition == DatabaseEdition.Basic || edition == DatabaseEdition.Standard || edition == DatabaseEdition.Premium || edition == DatabaseEdition.DataWarehouse)
     {
         return true;
     }
     return false;
 }
 private bool IsDatabaseInServiceTierForPolicy(string resourceGroupName, string serverName, string databaseName, string clientId)
 {
     var dbCommunicator = new AzureSqlDatabaseCommunicator(Context);
     var database = dbCommunicator.Get(resourceGroupName, serverName, databaseName, clientId);
     DatabaseEdition edition;
     Enum.TryParse(database.Properties.Edition, true, out edition);
     if (edition != DatabaseEdition.None && edition != DatabaseEdition.Free)
     {
         return true;
     }
     return false;
 }