/// <summary> /// This method is responsible to call the right API in the communication layer that will eventually send the information in the /// object to the REST endpoint /// </summary> /// <param name="model">The model object with the data to be sent to the REST endpoints</param> protected override AuditingPolicyModel PersistChanges(AuditingPolicyModel model) { ModelAdapter.IgnoreStorage = true; base.PersistChanges(model); AuditType = AuditType.Blob; var blobModel = GetEntity(); blobModel.AuditState = AuditStateType.Disabled; base.PersistChanges(blobModel); return null; }
/// <summary> /// Updates the given model element with the cmdlet specific operation /// </summary> /// <param name="baseModel">A model object</param> protected override AuditingPolicyModel ApplyUserInputToModel(AuditingPolicyModel baseModel) { base.ApplyUserInputToModel(baseModel); if (AuditType == AuditType.Table) { DatabaseAuditingPolicyModel model = baseModel as DatabaseAuditingPolicyModel; if (model.AuditState == AuditStateType.New) { model.AuditState = AuditStateType.Enabled; } model.UseServerDefault = UseServerDefaultOptions.Enabled; model.StorageAccountName = GetStorageAccountName(); } return baseModel; }
/// <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 AuditingPolicyModel PersistChanges(AuditingPolicyModel model) { return null; }
protected override AuditingPolicyModel PersistChanges(AuditingPolicyModel model) { base.PersistChanges(model); ModelAdapter.IgnoreStorage = true; Action swapAuditType = () => { AuditType = AuditType == AuditType.Blob ? AuditType.Table : AuditType.Blob; }; swapAuditType(); var otherAuditingTypePolicyModel = GetEntity(); if (otherAuditingTypePolicyModel != null) { otherAuditingTypePolicyModel.AuditState = AuditStateType.Disabled; base.PersistChanges(otherAuditingTypePolicyModel); } swapAuditType(); return model; }
/// <summary> /// Updates the given model element with the cmdlet specific operation /// </summary> /// <param name="baseModel">A model object</param> protected override AuditingPolicyModel ApplyUserInputToModel(AuditingPolicyModel baseModel) { base.ApplyUserInputToModel(baseModel); if (AuditType == AuditType.Table) { ApplyUserInputToTableAuditingModel(baseModel as DatabaseAuditingPolicyModel); } else { ApplyUserInputToBlobAuditingModel(baseModel as DatabaseBlobAuditingPolicyModel); } return baseModel; }
/// <summary> /// Updates the given model element with the cmdlet specific operation /// </summary> /// <param name="model">A model object</param> protected override AuditingPolicyModel ApplyUserInputToModel(AuditingPolicyModel model) { base.ApplyUserInputToModel(model); model.AuditState = AuditStateType.Disabled; return model; }