aws_sdk_cloudwatchlogs/client/
put_account_policy.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
impl super::Client {
    /// Constructs a fluent builder for the [`PutAccountPolicy`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder) operation.
    ///
    /// - The fluent builder is configurable:
    ///   - [`policy_name(impl Into<String>)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::policy_name) / [`set_policy_name(Option<String>)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::set_policy_name):<br>required: **true**<br><p>A name for the policy. This must be unique within the account.</p><br>
    ///   - [`policy_document(impl Into<String>)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::policy_document) / [`set_policy_document(Option<String>)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::set_policy_document):<br>required: **true**<br><p>Specify the policy, in JSON.</p> <p><b>Data protection policy</b></p> <p>A data protection 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, 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 the two <code>DataIdentifer</code> arrays must match exactly.</p> </important> <p>In addition to the two JSON blocks, the <code>policyDocument</code> can also include <code>Name</code>, <code>Description</code>, and <code>Version</code> fields. The <code>Name</code> is different than the operation's <code>policyName</code> parameter, and is used as a dimension when CloudWatch Logs reports audit findings metrics to CloudWatch.</p> <p>The JSON specified in <code>policyDocument</code> can be up to 30,720 characters long.</p> <p><b>Subscription filter policy</b></p> <p>A subscription filter policy can include the following attributes in a JSON block:</p> <ul>  <li>   <p><b>DestinationArn</b> The ARN of the destination to deliver log events to. Supported destinations are:</p>   <ul>    <li>     <p>An Kinesis Data Streams data stream in the same account as the subscription policy, for same-account delivery.</p></li>    <li>     <p>An Firehose data stream in the same account as the subscription policy, for same-account delivery.</p></li>    <li>     <p>A Lambda function in the same account as the subscription policy, for same-account delivery.</p></li>    <li>     <p>A logical destination in a different account created with <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestination.html">PutDestination</a>, for cross-account delivery. Kinesis Data Streams and Firehose are supported as logical destinations.</p></li>   </ul></li>  <li>   <p><b>RoleArn</b> The ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.</p></li>  <li>   <p><b>FilterPattern</b> A filter pattern for subscribing to a filtered stream of log events.</p></li>  <li>   <p><b>Distribution</b> The method used to distribute log data to the destination. By default, log data is grouped by log stream, but the grouping can be set to <code>Random</code> for a more even distribution. This property is only applicable when the destination is an Kinesis Data Streams data stream.</p></li> </ul> <p><b>Transformer policy</b></p> <p>A transformer policy must include one JSON block with the array of processors and their configurations. For more information about available processors, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation.html#CloudWatch-Logs-Transformation-Processors"> Processors that you can use</a>.</p> <p><b>Field index policy</b></p> <p>A field index filter policy can include the following attribute in a JSON block:</p> <ul>  <li>   <p><b>Fields</b> The array of field indexes to create.</p></li> </ul> <p>It must contain at least one field index.</p> <p>The following is an example of an index policy document that creates two indexes, <code>RequestId</code> and <code>TransactionId</code>.</p> <p><code>"policyDocument": "{ \"Fields\": \[ \"RequestId\", \"TransactionId\" \] }"</code></p><br>
    ///   - [`policy_type(PolicyType)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::policy_type) / [`set_policy_type(Option<PolicyType>)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::set_policy_type):<br>required: **true**<br><p>The type of policy that you're creating or updating.</p><br>
    ///   - [`scope(Scope)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::scope) / [`set_scope(Option<Scope>)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::set_scope):<br>required: **false**<br><p>Currently the only valid value for this parameter is <code>ALL</code>, which specifies that the data protection policy applies to all log groups in the account. If you omit this parameter, the default of <code>ALL</code> is used.</p><br>
    ///   - [`selection_criteria(impl Into<String>)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::selection_criteria) / [`set_selection_criteria(Option<String>)`](crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::set_selection_criteria):<br>required: **false**<br><p>Use this parameter to apply the new policy to a subset of log groups in the account.</p> <p>Specifing <code>selectionCriteria</code> is valid only when you specify <code>SUBSCRIPTION_FILTER_POLICY</code>, <code>FIELD_INDEX_POLICY</code> or <code>TRANSFORMER_POLICY</code>for <code>policyType</code>.</p> <p>If <code>policyType</code> is <code>SUBSCRIPTION_FILTER_POLICY</code>, the only supported <code>selectionCriteria</code> filter is <code>LogGroupName NOT IN \[\]</code></p> <p>If <code>policyType</code> is <code>FIELD_INDEX_POLICY</code> or <code>TRANSFORMER_POLICY</code>, the only supported <code>selectionCriteria</code> filter is <code>LogGroupNamePrefix</code></p> <p>The <code>selectionCriteria</code> string can be up to 25KB in length. The length is determined by using its UTF-8 bytes.</p> <p>Using the <code>selectionCriteria</code> parameter with <code>SUBSCRIPTION_FILTER_POLICY</code> is useful to help prevent infinite loops. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Subscriptions-recursion-prevention.html">Log recursion prevention</a>.</p><br>
    /// - On success, responds with [`PutAccountPolicyOutput`](crate::operation::put_account_policy::PutAccountPolicyOutput) with field(s):
    ///   - [`account_policy(Option<AccountPolicy>)`](crate::operation::put_account_policy::PutAccountPolicyOutput::account_policy): <p>The account policy that you created.</p>
    /// - On failure, responds with [`SdkError<PutAccountPolicyError>`](crate::operation::put_account_policy::PutAccountPolicyError)
    pub fn put_account_policy(&self) -> crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder {
        crate::operation::put_account_policy::builders::PutAccountPolicyFluentBuilder::new(self.handle.clone())
    }
}