aws-sdk-cloudwatchlogs 1.84.0

AWS SDK for Amazon CloudWatch Logs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct PutAccountPolicyInput {
    /// <p>A name for the policy. This must be unique within the account.</p>
    pub policy_name: ::std::option::Option<::std::string::String>,
    /// <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>
    pub policy_document: ::std::option::Option<::std::string::String>,
    /// <p>The type of policy that you're creating or updating.</p>
    pub policy_type: ::std::option::Option<crate::types::PolicyType>,
    /// <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>
    pub scope: ::std::option::Option<crate::types::Scope>,
    /// <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>
    pub selection_criteria: ::std::option::Option<::std::string::String>,
}
impl PutAccountPolicyInput {
    /// <p>A name for the policy. This must be unique within the account.</p>
    pub fn policy_name(&self) -> ::std::option::Option<&str> {
        self.policy_name.as_deref()
    }
    /// <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>
    pub fn policy_document(&self) -> ::std::option::Option<&str> {
        self.policy_document.as_deref()
    }
    /// <p>The type of policy that you're creating or updating.</p>
    pub fn policy_type(&self) -> ::std::option::Option<&crate::types::PolicyType> {
        self.policy_type.as_ref()
    }
    /// <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>
    pub fn scope(&self) -> ::std::option::Option<&crate::types::Scope> {
        self.scope.as_ref()
    }
    /// <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>
    pub fn selection_criteria(&self) -> ::std::option::Option<&str> {
        self.selection_criteria.as_deref()
    }
}
impl PutAccountPolicyInput {
    /// Creates a new builder-style object to manufacture [`PutAccountPolicyInput`](crate::operation::put_account_policy::PutAccountPolicyInput).
    pub fn builder() -> crate::operation::put_account_policy::builders::PutAccountPolicyInputBuilder {
        crate::operation::put_account_policy::builders::PutAccountPolicyInputBuilder::default()
    }
}

/// A builder for [`PutAccountPolicyInput`](crate::operation::put_account_policy::PutAccountPolicyInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PutAccountPolicyInputBuilder {
    pub(crate) policy_name: ::std::option::Option<::std::string::String>,
    pub(crate) policy_document: ::std::option::Option<::std::string::String>,
    pub(crate) policy_type: ::std::option::Option<crate::types::PolicyType>,
    pub(crate) scope: ::std::option::Option<crate::types::Scope>,
    pub(crate) selection_criteria: ::std::option::Option<::std::string::String>,
}
impl PutAccountPolicyInputBuilder {
    /// <p>A name for the policy. This must be unique within the account.</p>
    /// This field is required.
    pub fn policy_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A name for the policy. This must be unique within the account.</p>
    pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_name = input;
        self
    }
    /// <p>A name for the policy. This must be unique within the account.</p>
    pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_name
    }
    /// <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>
    /// This field is required.
    pub fn policy_document(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_document = ::std::option::Option::Some(input.into());
        self
    }
    /// <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>
    pub fn set_policy_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_document = input;
        self
    }
    /// <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>
    pub fn get_policy_document(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_document
    }
    /// <p>The type of policy that you're creating or updating.</p>
    /// This field is required.
    pub fn policy_type(mut self, input: crate::types::PolicyType) -> Self {
        self.policy_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of policy that you're creating or updating.</p>
    pub fn set_policy_type(mut self, input: ::std::option::Option<crate::types::PolicyType>) -> Self {
        self.policy_type = input;
        self
    }
    /// <p>The type of policy that you're creating or updating.</p>
    pub fn get_policy_type(&self) -> &::std::option::Option<crate::types::PolicyType> {
        &self.policy_type
    }
    /// <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>
    pub fn scope(mut self, input: crate::types::Scope) -> Self {
        self.scope = ::std::option::Option::Some(input);
        self
    }
    /// <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>
    pub fn set_scope(mut self, input: ::std::option::Option<crate::types::Scope>) -> Self {
        self.scope = input;
        self
    }
    /// <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>
    pub fn get_scope(&self) -> &::std::option::Option<crate::types::Scope> {
        &self.scope
    }
    /// <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>
    pub fn selection_criteria(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.selection_criteria = ::std::option::Option::Some(input.into());
        self
    }
    /// <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>
    pub fn set_selection_criteria(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.selection_criteria = input;
        self
    }
    /// <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>
    pub fn get_selection_criteria(&self) -> &::std::option::Option<::std::string::String> {
        &self.selection_criteria
    }
    /// Consumes the builder and constructs a [`PutAccountPolicyInput`](crate::operation::put_account_policy::PutAccountPolicyInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::put_account_policy::PutAccountPolicyInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::put_account_policy::PutAccountPolicyInput {
            policy_name: self.policy_name,
            policy_document: self.policy_document,
            policy_type: self.policy_type,
            scope: self.scope,
            selection_criteria: self.selection_criteria,
        })
    }
}