// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::put_data_protection_policy::_put_data_protection_policy_output::PutDataProtectionPolicyOutputBuilder;
pub use crate::operation::put_data_protection_policy::_put_data_protection_policy_input::PutDataProtectionPolicyInputBuilder;
/// Fluent builder constructing a request to `PutDataProtectionPolicy`.
///
/// <p>Creates a data protection policy for the specified log group. A data protection policy can help safeguard sensitive data that's ingested by the log group by auditing and masking the sensitive log data.</p> <important>
/// <p>Sensitive data is detected and masked when it is ingested into the log group. When you set a data protection policy, log events ingested into the log group before that time are not masked.</p>
/// </important>
/// <p>By default, when a user views a log event that includes masked data, the sensitive data is replaced by asterisks. A user who has the <code>logs:Unmask</code> permission can use a <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogEvents.html">GetLogEvents</a> or <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_FilterLogEvents.html">FilterLogEvents</a> operation with the <code>unmask</code> parameter set to <code>true</code> to view the unmasked log events. Users with the <code>logs:Unmask</code> can also view unmasked data in the CloudWatch Logs console by running a CloudWatch Logs Insights query with the <code>unmask</code> query command.</p>
/// <p>For more information, including a list of types of data that can be audited and masked, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html">Protect sensitive log data with masking</a>.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct PutDataProtectionPolicyFluentBuilder {
handle: std::sync::Arc<crate::client::Handle>,
inner:
crate::operation::put_data_protection_policy::builders::PutDataProtectionPolicyInputBuilder,
}
impl PutDataProtectionPolicyFluentBuilder {
/// Creates a new `PutDataProtectionPolicy`.
pub(crate) fn new(handle: std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::put_data_protection_policy::PutDataProtectionPolicy,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::result::SdkError<
crate::operation::put_data_protection_policy::PutDataProtectionPolicyError,
>,
> {
let handle = self.handle.clone();
let operation = self
.inner
.build()
.map_err(aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&handle.conf)
.await
.map_err(aws_smithy_http::result::SdkError::construction_failure)?;
Ok(crate::client::customize::CustomizableOperation { handle, operation })
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::operation::put_data_protection_policy::PutDataProtectionPolicyOutput,
aws_smithy_http::result::SdkError<
crate::operation::put_data_protection_policy::PutDataProtectionPolicyError,
>,
> {
let op = self
.inner
.build()
.map_err(aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&self.handle.conf)
.await
.map_err(aws_smithy_http::result::SdkError::construction_failure)?;
self.handle.client.call(op).await
}
/// <p>Specify either the log group name or log group ARN.</p>
pub fn log_group_identifier(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.log_group_identifier(input.into());
self
}
/// <p>Specify either the log group name or log group ARN.</p>
pub fn set_log_group_identifier(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.inner = self.inner.set_log_group_identifier(input);
self
}
/// <p>Specify the data protection policy, in JSON.</p>
/// <p>This policy must include two JSON blocks:</p>
/// <ul>
/// <li> <p>The first block must include both a <code>DataIdentifer</code> array and an <code>Operation</code> property with an <code>Audit</code> action. The <code>DataIdentifer</code> array lists the types of sensitive data that you want to mask. For more information about the available options, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data-types.html">Types of data that you can mask</a>.</p> <p>The <code>Operation</code> property with an <code>Audit</code> action is required to find the sensitive data terms. This <code>Audit</code> action must contain a <code>FindingsDestination</code> object. You can optionally use that <code>FindingsDestination</code> object to list one or more destinations to send audit findings to. If you specify destinations such as log groups, Kinesis Data Firehose streams, and S3 buckets, they must already exist.</p> </li>
/// <li> <p>The second block must include both a <code>DataIdentifer</code> array and an <code>Operation</code> property with an <code>Deidentify</code> action. The <code>DataIdentifer</code> array must exactly match the <code>DataIdentifer</code> array in the first block of the policy.</p> <p>The <code>Operation</code> property with the <code>Deidentify</code> action is what actually masks the data, and it must contain the <code> "MaskConfig": {}</code> object. The <code> "MaskConfig": {}</code> object must be empty.</p> </li>
/// </ul>
/// <p>For an example data protection policy, see the <b>Examples</b> section on this page.</p> <important>
/// <p>The contents of two <code>DataIdentifer</code> arrays must match exactly.</p>
/// </important>
pub fn policy_document(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.policy_document(input.into());
self
}
/// <p>Specify the data protection policy, in JSON.</p>
/// <p>This policy must include two JSON blocks:</p>
/// <ul>
/// <li> <p>The first block must include both a <code>DataIdentifer</code> array and an <code>Operation</code> property with an <code>Audit</code> action. The <code>DataIdentifer</code> array lists the types of sensitive data that you want to mask. For more information about the available options, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data-types.html">Types of data that you can mask</a>.</p> <p>The <code>Operation</code> property with an <code>Audit</code> action is required to find the sensitive data terms. This <code>Audit</code> action must contain a <code>FindingsDestination</code> object. You can optionally use that <code>FindingsDestination</code> object to list one or more destinations to send audit findings to. If you specify destinations such as log groups, Kinesis Data Firehose streams, and S3 buckets, they must already exist.</p> </li>
/// <li> <p>The second block must include both a <code>DataIdentifer</code> array and an <code>Operation</code> property with an <code>Deidentify</code> action. The <code>DataIdentifer</code> array must exactly match the <code>DataIdentifer</code> array in the first block of the policy.</p> <p>The <code>Operation</code> property with the <code>Deidentify</code> action is what actually masks the data, and it must contain the <code> "MaskConfig": {}</code> object. The <code> "MaskConfig": {}</code> object must be empty.</p> </li>
/// </ul>
/// <p>For an example data protection policy, see the <b>Examples</b> section on this page.</p> <important>
/// <p>The contents of two <code>DataIdentifer</code> arrays must match exactly.</p>
/// </important>
pub fn set_policy_document(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_policy_document(input);
self
}
}