Skip to content

CloudWatchLogsClient.put_account_policy

rboto-cloudwatch-logs==0.4.0 · Service index · Types

Model summary (excerpt): Creates an account-level data protection policy, subscription filter policy, field index policy, transformer policy, metric extraction policy, or retention policy that applies to all log groups, a subset of log groups, or a data source name and type combination in the account. Account-level policies are Region-specific: a policy applies only to log groups in the Region where you create it. To...

Install and imports

python -m pip install "rboto[cloudwatch-logs]==0.4.0"
from rboto import CloudWatchLogsClient
from rboto_cloudwatch_logs.types import (
    PolicyType,
    PutAccountPolicyOutput,
    Scope,
)

Signature

async def put_account_policy(
    *,
    policy_name: str,
    policy_document: str,
    policy_type: PolicyType,
    scope: Scope | None = None,
    selection_criteria: str | None = None,
    dry_run: bool | None = None,
) -> PutAccountPolicyOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
policy_name Yes A name for the policy. This must be unique within the account and cannot start with aws/ .
policy_document Yes Specify the policy, in JSON. Data protection policy A data protection policy must include two JSON blocks: The first block must include both a DataIdentifer array and an Operation property with an Audit action. The DataIdentifer array lists the types of sensitive data that you want to mask. For more information about the available options, see Types of data that you can mask . The Operation...
policy_type Yes The type of policy that you're creating or updating.
scope No Currently the only valid value for this parameter is ALL , which specifies that the data protection policy applies to all log groups in the account. If you omit this parameter, the default of ALL is used.
selection_criteria No Use this parameter to apply the new policy to a subset of log groups in the account or a data source name and type combination. Specifying selectionCriteria is valid only when you specify SUBSCRIPTION_FILTER_POLICY , FIELD_INDEX_POLICY , TRANSFORMER_POLICY , or RETENTION_POLICY for policyType . If policyType is SUBSCRIPTION_FILTER_POLICY , the only supported selectionCriteria filter is...
dry_run No Specifies whether to preview the impact of the policy without creating or updating it. If you specify true , CloudWatch Logs validates the request, does not save the policy, and returns the estimated impact in dryRunResult instead of accountPolicy . The default is false . Specifying dryRun is valid only when you specify RETENTION_POLICY for policyType . Only one dry run can be in progress for...

Output

PutAccountPolicyOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
account_policy AccountPolicyOutput | None Always present AccountPolicyOutput
dry_run_result DryRunResultOutput | None Always present DryRunResultOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

PolicyType, PutAccountPolicyOutput, Scope

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_cloudwatch_logs.exceptions:

InvalidParameterError, LimitExceededError, OperationAbortedError, ServiceUnavailableError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model