The class that defines the model of database blob auditing policy
Наследование: BaseBlobAuditingPolicyModel
        private void ApplyUserInputToBlobAuditingModel(DatabaseBlobAuditingPolicyModel model)
        {
            model.AuditState = AuditStateType.Enabled;
            if (RetentionInDays != null)
            {
                model.RetentionInDays = RetentionInDays;
            }
            if (StorageAccountName != null)
            {
                model.StorageAccountName = StorageAccountName;
            }

            if (AuditActionGroup != null &&  AuditActionGroup.Length != 0)
            {
                model.AuditActionGroup = AuditActionGroup;
            }

            if (AuditAction != null && AuditAction.Length != 0)
            {
                model.AuditAction = AuditAction;
            }

        }
Пример #2
0
 private DatabaseBlobAuditingPolicyModel ModelizeDatabaseAuditPolicy(BlobAuditingPolicy policy)
 {
     var dbPolicyModel = new DatabaseBlobAuditingPolicyModel();
     var properties = policy.Properties;
     dbPolicyModel.AuditState = ModelizeAuditState(properties.State);
     ModelizeStorageInfo(dbPolicyModel, properties.StorageEndpoint);
     ModelizeAuditActionsAndGroupsInfo(dbPolicyModel, properties.AuditActionsAndGroups);
     ModelizeRetentionInfo(dbPolicyModel, properties.RetentionDays);
     return dbPolicyModel;
 }
Пример #3
0
 /// <summary>
 /// Transforms the given model to its endpoints acceptable structure and sends it to the endpoint
 /// </summary>
 public void SetDatabaseAuditingPolicy(DatabaseBlobAuditingPolicyModel model, string clientId, string storageEndpointSuffix)
 {
     if (!IsDatabaseInServiceTierForPolicy(model.ResourceGroupName, model.ServerName, model.DatabaseName, clientId))
     {
         throw new Exception(Properties.Resources.DatabaseNotInServiceTierForAuditingPolicy);
     }
     var parameters = PolicizeBlobAuditingModel(model, storageEndpointSuffix);
     Communicator.SetDatabaseAuditingPolicy(model.ResourceGroupName, model.ServerName, model.DatabaseName, clientId, parameters);
 }
Пример #4
0
        /// <summary>
        /// Provides a database audit policy model for the given database
        /// </summary>
        public void GetDatabaseAuditingPolicy(string resourceGroup, string serverName, string databaseName, string requestId, out DatabaseBlobAuditingPolicyModel model)
        {
            BlobAuditingPolicy policy;
            Communicator.GetDatabaseAuditingPolicy(resourceGroup, serverName, databaseName, requestId, out policy);
            var dbPolicyModel = ModelizeDatabaseAuditPolicy(policy);

            dbPolicyModel.ResourceGroupName = resourceGroup;
            dbPolicyModel.ServerName = serverName;
            dbPolicyModel.DatabaseName = databaseName;

            model = dbPolicyModel;
        }