Ejemplo n.º 1
0
 /// <summary>
 /// Transforms the given database policy object to its cmdlet model representation
 /// </summary>
 private DatabaseAuditingPolicyModel ModelizeDatabaseAuditPolicy(DatabaseAuditingPolicy policy)
 {
     DatabaseAuditingPolicyModel dbPolicyModel = new DatabaseAuditingPolicyModel();
     DatabaseAuditingPolicyProperties properties = policy.Properties;
     dbPolicyModel.AuditState = ModelizeAuditState(properties.AuditingState);
     dbPolicyModel.UseServerDefault = properties.UseServerDefault == SecurityConstants.AuditingEndpoint.Enabled ? UseServerDefaultOptions.Enabled : UseServerDefaultOptions.Disabled;
     ModelizeStorageInfo(dbPolicyModel, properties.StorageAccountName, properties.StorageAccountKey, properties.StorageAccountSecondaryKey);
     ModelizeEventTypesInfo(dbPolicyModel, properties.EventTypesToAudit);
     ModelizeRetentionInfo(dbPolicyModel, properties.RetentionDays, properties.AuditLogsTableName);
     return dbPolicyModel;
 }
 /// <summary>
 /// Gets the database auditing policy for the given database in the given database server in the given resource group
 /// </summary>
 public void GetDatabaseAuditingPolicy(string resourceGroupName, string serverName, string databaseName, string clientRequestId, out DatabaseAuditingPolicy policy)
 {
     IAuditingPolicyOperations operations = GetCurrentSqlClient(clientRequestId).AuditingPolicy;
     DatabaseAuditingPolicyGetResponse response = operations.GetDatabasePolicy(resourceGroupName, serverName, databaseName);
     policy = response.AuditingPolicy;
 }