Skip to content

SecretsManagerClient.put_resource_policy

rboto-secrets-manager==0.4.0 · Service index · Types

Model summary (excerpt): Attaches a resource-based permission policy to a secret. A resource-based policy is optional. For more information, see Authentication and access control for Secrets Manager For information about attaching a policy in the console, see Attach a permissions policy to a secret . Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in...

Install and imports

python -m pip install "rboto[secrets-manager]==0.4.0"
from rboto import SecretsManagerClient
from rboto_secrets_manager.types import (
    PutResourcePolicyOutput,
)

Signature

async def put_resource_policy(
    *,
    secret_id: str,
    resource_policy: str,
    policy_name: str | None = None,
    block_public_policy: bool | 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)
secret_id Yes The ARN or name of the secret to attach the resource-based policy. For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN .
resource_policy Yes A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions policy examples .
policy_name No The name of the resource policy to attach. If you don't specify this field, Secrets Manager uses default . You can only attach the default policy; if you specify any other name, the operation returns an InvalidParameterException .
block_public_policy No Specifies whether to block resource-based policies that allow broad access to the secret, for example those that use a wildcard for the principal. By default, public policies aren't blocked. Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public access from being granted through the resource policies that are directly attached to your...

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
arn str | None Always present —
name str | None Always present —
policy_name 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.

PutResourcePolicyOutput

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_secrets_manager.exceptions:

InternalServiceError, InvalidParameterError, InvalidRequestError, MalformedPolicyDocumentError, PublicPolicyError, ResourceNotFoundError.

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

Service guide · Pinned model