CloudWatchLogsClient.put_resource_policy
rboto-cloudwatch-logs==0.4.0 · Service index · Types
Model summary (excerpt): Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53. This API has the following restrictions: Supported actions - Policy only supports logs:PutLogEvents and logs:CreateLogStream actions Supported principals - Policy only applies when operations are invoked by Amazon Web Services service principals (not IAM...
Install and imports
from rboto import CloudWatchLogsClient
from rboto_cloudwatch_logs.types import (
PutResourcePolicyOutput,
)
Signature
async def put_resource_policy(
*,
policy_name: str | None = None,
policy_document: str | None = None,
resource_arn: str | None = None,
expected_revision_id: str | None = None,
) -> PutResourcePolicyOutput: ...
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 |
No | Name of the new policy. This parameter is required. |
policy_document |
No | Details of the new policy, including the identity of the principal that is enabled to put logs to this account. This is formatted as a JSON string. This parameter is required. The following example creates a resource policy enabling the Route 53 service to put DNS query logs in to the specified log group. Replace "logArn" with the ARN of your CloudWatch Logs resource, such as a log group or... |
resource_arn |
No | The ARN of the CloudWatch Logs resource to which the resource policy needs to be added or attached. Currently only supports LogGroup ARN. |
expected_revision_id |
No | The expected revision ID of the resource policy. Required when resourceArn is provided to prevent concurrent modifications. Use null when creating a resource policy for the first time. |
Output
PutResourcePolicyOutput.
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 |
|---|---|---|---|
resource_policy |
ResourcePolicyOutput | None |
Always present | ResourcePolicyOutput |
revision_id |
str | None |
Always present | — |
| 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.
Related types
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, ResourceNotFoundError, ServiceUnavailableError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.