put_resource_policy
async
¶
put_resource_policy(
resource_arn: ResourceArn,
resource_policy: ResourcePolicy,
*,
config_overrides: Optional[AsyncCloudTrailClientConfig] = None,
) -> PutResourcePolicyResponse
Attaches a resource-based permission policy to a CloudTrail event data store, dashboard, or channel. For more information about resource-based policies, see CloudTrail resource-based policy examples in the CloudTrail User Guide.
Parameters:
-
resource_arn(ResourceArn) –The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy.
Example event data store ARN format:
arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLEExample dashboard ARN format:
arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDashExample channel ARN format:
arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890 -
resource_policy(ResourcePolicy) –A JSON-formatted string for an Amazon Web Services resource-based policy.
For example resource-based policies, see CloudTrail resource-based policy examples in the CloudTrail User Guide.
Raises:
-
ConflictException–This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.
-
OperationNotPermittedException–This exception is thrown when the requested operation is not permitted.
-
ResourceARNNotValidException–This exception is thrown when the provided resource does not exist, or the ARN format of the resource is not valid.
The following is the format of an event data store ARN:
arn:aws:cloudtrail:us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLEThe following is the format of a dashboard ARN:
arn:aws:cloudtrail:us-east-1:123456789012:dashboard/exampleDashThe following is the format of a channel ARN:
arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890 -
ResourceNotFoundException–This exception is thrown when the specified resource is not found.
-
ResourcePolicyNotValidException–This exception is thrown when the resouce-based policy has syntax errors, or contains a principal that is not valid.
-
ResourceTypeNotSupportedException–This exception is thrown when the specified resource type is not supported by CloudTrail.
-
UnsupportedOperationException–This exception is thrown when the requested operation is not supported.
-
UnknownServiceError–The service returned an error code this client does not model.