WorkloadIdentity

class aws_cdk.aws_bedrock_agentcore_alpha.WorkloadIdentity(scope, id, *, allowed_resource_oauth2_return_urls=None, tags=None, workload_identity_name=None)

Bases: Resource

(experimental) L2 construct for AWS::BedrockAgentCore::WorkloadIdentity.

A workload identity is the stable identity of an agent in an AWS account. It ties together IAM roles, OAuth2 flows, API keys, and workload access tokens for consistent authentication across environments.

See:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-bedrockagentcore-workloadidentity.html

Stability:

experimental

Resource:

AWS::BedrockAgentCore::WorkloadIdentity

ExampleMetadata:

fixture=default infused

Example:

agentcore.WorkloadIdentity(self, "MyWorkloadIdentity",
    workload_identity_name="customer-support-agent-prod",
    allowed_resource_oauth2_return_urls=["https://app.example.com/oauth/callback"],
    tags={"team": "agents", "env": "prod"}
)
Parameters:
  • scope (Construct)

  • id (str)

  • allowed_resource_oauth2_return_urls (Optional[Sequence[str]]) – (experimental) Allowed OAuth2 return URLs for resources associated with this workload identity. Default: - no return URLs

  • tags (Optional[Mapping[str, str]]) – (experimental) Tags for this workload identity. Default: - no tags

  • workload_identity_name (Optional[str]) – (experimental) Name of the workload identity. Default: - a name generated by CDK

Stability:

experimental

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy)

Return type:

None

grant(grantee, *actions)

(experimental) [disable-awslint:no-grants].

Parameters:
Stability:

experimental

Return type:

Grant

grant_admin(grantee)

(experimental) [disable-awslint:no-grants].

Parameters:

grantee (IGrantable)

Stability:

experimental

Return type:

Grant

grant_full_access(grantee)

(experimental) [disable-awslint:no-grants].

Parameters:

grantee (IGrantable)

Stability:

experimental

Return type:

Grant

grant_read(grantee)

(experimental) [disable-awslint:no-grants].

Parameters:

grantee (IGrantable)

Stability:

experimental

Return type:

Grant

grant_use(grantee)

(experimental) [disable-awslint:no-grants].

Parameters:

grantee (IGrantable)

Stability:

experimental

Return type:

Grant

to_string()

Returns a string representation of this construct.

Return type:

str

with_(*mixins)

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

mixins (IMixin)

Return type:

IConstruct

Attributes

PROPERTY_INJECTION_ID = '@aws-cdk.aws-bedrock-agentcore-alpha.WorkloadIdentity'
created_time

(experimental) Timestamp when the workload identity was created.

Stability:

experimental

env

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

grant_principal

(experimental) The principal to grant permissions to.

Stability:

experimental

last_updated_time

(experimental) Timestamp when the workload identity was last updated.

Stability:

experimental

node

The tree node.

stack

The stack in which this resource is defined.

workload_identity_arn

(experimental) The ARN of this workload identity.

Stability:

experimental

workload_identity_name

(experimental) The name of this workload identity.

Stability:

experimental

workload_identity_ref

(experimental) A reference to a WorkloadIdentity resource.

Stability:

experimental

Static Methods

classmethod from_workload_identity_attributes(scope, id, *, workload_identity_arn, workload_identity_name, created_time=None, last_updated_time=None)

(experimental) Import an existing workload identity.

Parameters:
  • scope (Construct)

  • id (str)

  • workload_identity_arn (str) – (experimental) ARN of the workload identity.

  • workload_identity_name (str) – (experimental) Name of the workload identity.

  • created_time (Optional[str]) – (experimental) Resource creation time. Default: - not set

  • last_updated_time (Optional[str]) – (experimental) Resource last-updated time. Default: - not set

Stability:

experimental

Return type:

IWorkloadIdentity

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct)

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct)

Return type:

bool