private void ApplyUserInputToBlobAuditingModel(ServerBlobAuditingPolicyModel model) { model.AuditState = AuditStateType.Enabled; if (RetentionInDays != null) { model.RetentionInDays = RetentionInDays; } if (StorageAccountName != null) { model.StorageAccountName = StorageAccountName; } if (MyInvocation.BoundParameters.ContainsKey(SecurityConstants.StorageKeyType)) // the user enter a key type - we use it (and running over the previously defined key type) { model.StorageKeyType = (StorageKeyType == SecurityConstants.Primary) ? StorageKeyKind.Primary : StorageKeyKind.Secondary; } if (AuditActionGroup != null && AuditActionGroup.Length != 0) { model.AuditActionGroup = AuditActionGroup; } model.StorageAccountSubscriptionId = Guid.Parse(DefaultProfile.DefaultContext.Subscription.Id); }
/// <summary> /// Transforms the given server policy object to its cmdlet model representation /// </summary> private ServerBlobAuditingPolicyModel ModelizeServerAuditPolicy(BlobAuditingPolicy policy) { var serverPolicyModel = new ServerBlobAuditingPolicyModel(); var properties = policy.Properties; serverPolicyModel.AuditState = ModelizeAuditState(properties.State); ModelizeStorageInfo(serverPolicyModel, properties.StorageEndpoint, properties.IsStorageSecondaryKeyInUse); ModelizeAuditActionsAndGroupsInfo(serverPolicyModel, properties.AuditActionsAndGroups); ModelizeRetentionInfo(serverPolicyModel, properties.RetentionDays); return(serverPolicyModel); }
/// <summary> /// Provides a database server audit policy model for the given database /// </summary> public void GetServerAuditingPolicy(string resourceGroup, string serverName, out ServerBlobAuditingPolicyModel model) { BlobAuditingPolicy policy; model = new ServerBlobAuditingPolicyModel(); Communicator.GetServerAuditingPolicy(resourceGroup, serverName, out policy); ModelizeServerAuditPolicy(policy, model); model.AuditType = AuditType.Blob; model.ResourceGroupName = resourceGroup; model.ServerName = serverName; }
/// <summary> /// Provides a database server audit policy model for the given database /// </summary> public void GetServerAuditingPolicy(string resourceGroup, string serverName, out ServerBlobAuditingPolicyModel model) { BlobAuditingPolicy policy; Communicator.GetServerAuditingPolicy(resourceGroup, serverName, out policy); var serverPolicyModel = ModelizeServerAuditPolicy(policy); serverPolicyModel.AuditType = AuditType.Blob; serverPolicyModel.ResourceGroupName = resourceGroup; serverPolicyModel.ServerName = serverName; model = serverPolicyModel; }
private void ApplyUserInputToBlobAuditingModel(ServerBlobAuditingPolicyModel 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; } }
private AuditingPolicyModel GetEntityHelper() { if (AuditType == AuditType.Table) { ServerAuditingPolicyModel model; ModelAdapter.GetServerAuditingPolicy(ResourceGroupName, ServerName, out model); return(model); } if (AuditType == AuditType.Blob) { ServerBlobAuditingPolicyModel blobModel = new ServerBlobAuditingPolicyModel { AuditType = AuditType.Blob }; ModelAdapter.GetServerBlobAuditingPolicy(ResourceGroupName, ServerName, blobModel); return(blobModel); } return(null); }
/// <summary> /// Transforms the given model to its endpoints acceptable structure and sends it to the endpoint /// </summary> public void SetServerAuditingPolicy(ServerBlobAuditingPolicyModel model, string clientId, string storageEndpointSuffix) { var parameters = PolicizeBlobAuditingModel(model, storageEndpointSuffix); Communicator.SetServerAuditingPolicy(model.ResourceGroupName, model.ServerName, clientId, parameters); }
private void ApplyUserInputToBlobAuditingModel(ServerBlobAuditingPolicyModel 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; } }
/// <summary> /// Transforms the given model to its endpoints acceptable structure and sends it to the endpoint /// </summary> public void SetServerAuditingPolicy(ServerBlobAuditingPolicyModel model, string clientId, string storageEndpointSuffix) { var parameters = PolicizeBlobAuditingModel(model, storageEndpointSuffix); Communicator.SetServerAuditingPolicy(model.ResourceGroupName, model.ServerName, clientId, parameters); }
/// <summary> /// Transforms the given server policy object to its cmdlet model representation /// </summary> private ServerBlobAuditingPolicyModel ModelizeServerAuditPolicy(BlobAuditingPolicy policy) { var serverPolicyModel = new ServerBlobAuditingPolicyModel(); var properties = policy.Properties; serverPolicyModel.AuditState = ModelizeAuditState(properties.State); ModelizeStorageInfo(serverPolicyModel, properties.StorageEndpoint); ModelizeAuditActionsAndGroupsInfo(serverPolicyModel, properties.AuditActionsAndGroups); ModelizeRetentionInfo(serverPolicyModel, properties.RetentionDays); return serverPolicyModel; }
/// <summary> /// Provides a database server audit policy model for the given database /// </summary> public void GetServerAuditingPolicy(string resourceGroup, string serverName, string requestId, out ServerBlobAuditingPolicyModel model) { BlobAuditingPolicy policy; Communicator.GetServerAuditingPolicy(resourceGroup, serverName, requestId, out policy); var serverPolicyModel = ModelizeServerAuditPolicy(policy); serverPolicyModel.ResourceGroupName = resourceGroup; serverPolicyModel.ServerName = serverName; model = serverPolicyModel; }