Skip to content
v2.273.0

PolicyAttribute Class ​

An attribute of the request that a condition can compare against.

Cedar exposes three sources of attributes. Which one you want depends on where the value comes from: the caller, the thing being accessed, or the request environment.

Example ​

ts
import { PolicyAttribute } from 'aws-cdk-lib/aws-bedrockagentcore';

PolicyAttribute.principal('department'); // principal.department
PolicyAttribute.resource('confidential'); // resource.confidential
PolicyAttribute.context('sourceIp'); // context.sourceIp

Methods ​

context(attribute: string): PolicyAttribute // chainable@staticmethod def context(attribute: str) -> PolicyAttributepublic static PolicyAttribute context(String attribute)public static PolicyAttribute Context(string attribute)func Context(Attribute *string) PolicyAttributestatic#
An attribute of the request context, meaning the request environment rather than either entity.

For example sourceIp, environment or timestamp.

1 parameter

Parameters

  • attributeattributeattributeattributeAttribute — - The attribute name.
principal(attribute: string): PolicyAttribute // chainable@staticmethod def principal(attribute: str) -> PolicyAttributepublic static PolicyAttribute principal(String attribute)public static PolicyAttribute Principal(string attribute)func Principal(Attribute *string) PolicyAttributestatic#
An attribute of the principal, meaning the authenticated user or service making the request.

For example username, department or groups.

1 parameter

Parameters

  • attributeattributeattributeattributeAttribute — - The attribute name.
resource(attribute: string): PolicyAttribute // chainable@staticmethod def resource(attribute: str) -> PolicyAttributepublic static PolicyAttribute resource(String attribute)public static PolicyAttribute Resource(string attribute)func Resource(Attribute *string) PolicyAttributestatic#
An attribute of the resource being accessed.

For example owner or classification.

1 parameter

Parameters

  • attributeattributeattributeattributeAttribute — - The attribute name.