GrantWithResourceOptions

class aws_cdk.aws_iam.GrantWithResourceOptions(*, actions, grantee, resource_arns, resource, resource_self_arns=None)

Bases: aws_cdk.aws_iam.CommonGrantOptions

Options for a grant operation.

Parameters
  • actions (Sequence[str]) – The actions to grant.

  • grantee (IGrantable) – The principal to grant to. Default: if principal is undefined, no work is done.

  • resource_arns (Sequence[str]) – The resource ARNs to grant to.

  • resource (IResourceWithPolicy) – The resource with a resource policy. The statement will be added to the resource policy if it couldn’t be added to the principal policy.

  • resource_self_arns (Optional[Sequence[str]]) – When referring to the resource in a resource policy, use this as ARN. (Depending on the resource type, this needs to be ‘*’ in a resource policy). Default: Same as regular resource ARNs

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_iam as iam

# grantable is of type IGrantable
# resource_with_policy is of type IResourceWithPolicy

grant_with_resource_options = iam.GrantWithResourceOptions(
    actions=["actions"],
    grantee=grantable,
    resource=resource_with_policy,
    resource_arns=["resourceArns"],

    # the properties below are optional
    resource_self_arns=["resourceSelfArns"]
)

Attributes

actions

The actions to grant.

Return type

List[str]

grantee

The principal to grant to.

Default

if principal is undefined, no work is done.

Return type

IGrantable

resource

The resource with a resource policy.

The statement will be added to the resource policy if it couldn’t be added to the principal policy.

Return type

IResourceWithPolicy

resource_arns

The resource ARNs to grant to.

Return type

List[str]

resource_self_arns

When referring to the resource in a resource policy, use this as ARN.

(Depending on the resource type, this needs to be ‘*’ in a resource policy).

Default

Same as regular resource ARNs

Return type

Optional[List[str]]