/// <summary>
        /// Updates the given model element with the cmdlet specific operation 
        /// </summary>
        /// <param name="model">A model object</param>
        protected override DatabaseDataMaskingPolicyModel ApplyUserInputToModel(DatabaseDataMaskingPolicyModel model)
        {
            base.ApplyUserInputToModel(model);

            if (PrivilegedLogins != null) // empty string here means that the user clears the logins list
            {
                model.PrivilegedLogins = PrivilegedLogins;
            }
            
            if (!string.IsNullOrEmpty(DataMaskingState))
            {
                model.DataMaskingState = (DataMaskingState == SecurityConstants.Enabled) ? DataMaskingStateType.Enabled : DataMaskingStateType.Disabled;
            }

            return model;
        }
コード例 #2
0
        /// <summary>
        /// Updates the given model element with the cmdlet specific operation
        /// </summary>
        /// <param name="model">A model object</param>
        protected override DatabaseDataMaskingPolicyModel UpdateModel(DatabaseDataMaskingPolicyModel model)
        {
            base.UpdateModel(model);

            if (PrivilegedLogins != null) // empty string here means that the user clears the logins list
            {
                model.PrivilegedLogins = PrivilegedLogins;
            }

            if (!string.IsNullOrEmpty(DataMaskingState))
            {
                model.DataMaskingState = (DataMaskingState == Constants.Enabled) ? DataMaskingStateType.Enabled : DataMaskingStateType.Disabled;
            }

            if (!string.IsNullOrEmpty(MaskingLevel))
            {
                model.MaskingLevel = (MaskingLevel == Constants.Standard) ? MaskingLevelType.Standard : MaskingLevelType.Extended;
            }
            return(model);
        }
        /// <summary>
        /// Updates the given model element with the cmdlet specific operation
        /// </summary>
        /// <param name="model">A model object</param>
        protected override DatabaseDataMaskingPolicyModel ApplyUserInputToModel(DatabaseDataMaskingPolicyModel model)
        {
            base.ApplyUserInputToModel(model);

            if (PrivilegedLogins != null) // empty string here means that the user clears the logins list
            {
                WriteWarning("The parameter PrivilegedLogins is being deprecated and will be removed in a future release. Use the PrivilegedUsers parameter to provide SQL users excluded from masking.");
                model.PrivilegedUsers = PrivilegedLogins;
            }

            if (PrivilegedUsers != null) // empty string here means that the user clears the users list
            {
                model.PrivilegedUsers = PrivilegedUsers;
            }

            if (!string.IsNullOrEmpty(DataMaskingState))
            {
                model.DataMaskingState = (DataMaskingState == SecurityConstants.Enabled) ? DataMaskingStateType.Enabled : DataMaskingStateType.Disabled;
            }

            return(model);
        }
コード例 #4
0
        /// <summary>
        /// Takes the cmdlets model object and transform it to the policy as expected by the endpoint
        /// </summary>
        /// <param name="model">The data masking Policy model object</param>
        /// <returns>The communication model object</returns>
        private DataMaskingPolicyCreateOrUpdateParameters PolicizeDatabaseDataMaskingModel(DatabaseDataMaskingPolicyModel model)
        {
            DataMaskingPolicyCreateOrUpdateParameters updateParameters = new DataMaskingPolicyCreateOrUpdateParameters();
            DataMaskingPolicyProperties properties = new DataMaskingPolicyProperties();

            updateParameters.Properties = properties;
            properties.DataMaskingState = (model.DataMaskingState == DataMaskingStateType.Disabled) ? SecurityConstants.DataMaskingEndpoint.Disabled : SecurityConstants.DataMaskingEndpoint.Enabled;
            properties.ExemptPrincipals = model.PrivilegedUsers ?? "";
            return(updateParameters);
        }
コード例 #5
0
 /// <summary>
 /// No sending is needed as this is a Get cmdlet
 /// </summary>
 /// <param name="model">The model object with the data to be sent to the REST endpoints</param>
 protected override DatabaseDataMaskingPolicyModel PersistChanges(DatabaseDataMaskingPolicyModel model)
 {
     return(null);
 }
コード例 #6
0
        /// <summary>
        /// Sets the data masking policy of a specific database to be based on the information provided by the model object
        /// </summary>
        public void SetDatabaseDataMaskingPolicy(DatabaseDataMaskingPolicyModel model, String clientId)
        {
            DataMaskingPolicyCreateOrUpdateParameters parameters = PolicizeDatabaseDataMaskingModel(model);

            Communicator.SetDatabaseDataMaskingPolicy(model.ResourceGroupName, model.ServerName, model.DatabaseName, clientId, parameters);
        }
コード例 #7
0
        /// <summary>
        /// Takes the cmdlets model object and transform it to the policy as expected by the endpoint
        /// </summary>
        /// <param name="policy">The data masking Policy object</param>
        /// <returns>The communication model object</returns>
        private DataMaskingPolicyCreateOrUpdateParameters PolicizeDatabaseDataMaskingModel(DatabaseDataMaskingPolicyModel model)
        {
            DataMaskingPolicyCreateOrUpdateParameters updateParameters = new DataMaskingPolicyCreateOrUpdateParameters();
            DataMaskingPolicyProperties properties = new DataMaskingPolicyProperties();

            updateParameters.Properties = properties;
            properties.DataMaskingState = (model.DataMaskingState == DataMaskingStateType.Enabled) ? Constants.DataMaskingEndpoint.Enabled : Constants.DataMaskingEndpoint.Disabled;
            properties.MaskingLevel     = (model.MaskingLevel == MaskingLevelType.Standard) ? Constants.DataMaskingEndpoint.Standard: Constants.DataMaskingEndpoint.Extended;
            properties.ExemptPrincipals = (model.PrivilegedLogins == null) ? "" : model.PrivilegedLogins;
            return(updateParameters);
        }
コード例 #8
0
 /// <summary>
 /// No sending is needed as this is a Get cmdlet
 /// </summary>
 /// <param name="model">The model object with the data to be sent to the REST endpoints</param>
 protected override void SendModel(DatabaseDataMaskingPolicyModel model)
 {
 }
 /// <summary>
 /// No sending is needed as this is a Get cmdlet
 /// </summary>
 /// <param name="model">The model object with the data to be sent to the REST endpoints</param>
 protected override DatabaseDataMaskingPolicyModel PersistChanges(DatabaseDataMaskingPolicyModel model) 
 {
     return null;
 }
コード例 #10
0
 /// <summary>
 /// Sets the data masking policy of a specific database to be based on the information provided by the model object
 /// </summary>
 public void SetDatabaseDataMaskingPolicy(DatabaseDataMaskingPolicyModel model, String clientId)
 {
     DataMaskingPolicyCreateOrUpdateParameters parameters = PolicizeDatabaseDataMaskingModel(model);
     Communicator.SetDatabaseDataMaskingPolicy(model.ResourceGroupName, model.ServerName, model.DatabaseName, clientId, parameters);
 }
コード例 #11
0
 /// <summary>
 /// Takes the cmdlets model object and transform it to the policy as expected by the endpoint
 /// </summary>
 /// <param name="model">The data masking Policy model object</param>
 /// <returns>The communication model object</returns>
 private DataMaskingPolicyCreateOrUpdateParameters PolicizeDatabaseDataMaskingModel(DatabaseDataMaskingPolicyModel model)
 {
     DataMaskingPolicyCreateOrUpdateParameters updateParameters = new DataMaskingPolicyCreateOrUpdateParameters();
     DataMaskingPolicyProperties properties = new DataMaskingPolicyProperties();
     updateParameters.Properties = properties;
     properties.DataMaskingState = (model.DataMaskingState == DataMaskingStateType.Enabled) ? SecurityConstants.DataMaskingEndpoint.Enabled : SecurityConstants.DataMaskingEndpoint.Disabled;
     properties.MaskingLevel = (model.MaskingLevel == MaskingLevelType.Standard) ? SecurityConstants.DataMaskingEndpoint.Standard : SecurityConstants.DataMaskingEndpoint.Extended;
     properties.ExemptPrincipals = model.PrivilegedLogins ?? "";
     return updateParameters;
 }
コード例 #12
0
 /// <summary>
 /// Transforms a data masking policy to its cmdlet model representation
 /// </summary>
 private DatabaseDataMaskingPolicyModel ModelizeDatabaseDataMaskingPolicy(DataMaskingPolicy policy)
 {
     DatabaseDataMaskingPolicyModel dbPolicyModel = new DatabaseDataMaskingPolicyModel();
     DataMaskingPolicyProperties properties = policy.Properties;
     dbPolicyModel.DataMaskingState = (properties.DataMaskingState == SecurityConstants.DataMaskingEndpoint.Enabled) ? DataMaskingStateType.Enabled : DataMaskingStateType.Disabled;
     dbPolicyModel.MaskingLevel = (properties.MaskingLevel == SecurityConstants.DataMaskingEndpoint.Standard) ? MaskingLevelType.Standard : MaskingLevelType.Extended;
     dbPolicyModel.PrivilegedLogins = properties.ExemptPrincipals;
     return dbPolicyModel;
 }