Skip to content
v2.278.0

ConditionBuilder Class ​

Builder for condition expressions in Cedar policies.

Conditions define when a policy statement should apply or not apply. Supports logical operators (AND, OR) and various comparison operators.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';
const conditionBuilder = new bedrock_agentcore_alpha.ConditionBuilder();
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha

condition_builder = bedrock_agentcore_alpha.ConditionBuilder()
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;

ConditionBuilder conditionBuilder = new ConditionBuilder();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;

var conditionBuilder = new ConditionBuilder();
go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_agentcore_alpha "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"

conditionBuilder := bedrock_agentcore_alpha.NewConditionBuilder()

Initializer ​

ts
new ConditionBuilder()
python
ConditionBuilder()
java
new ConditionBuilder()
csharp
new ConditionBuilder()
go
NewConditionBuilder()

Methods ​

and(): ConditionBuilder // chainabledef and(self, ) -> ConditionBuilderpublic ConditionBuilder and()public ConditionBuilder And()func And() ConditionBuilder #
Logical AND operator - all conditions must be true.
contextAttribute(attribute: string): AttributeAccessordef context_attribute(self, attribute: str) -> AttributeAccessorpublic AttributeAccessor contextAttribute(String attribute)public AttributeAccessor ContextAttribute(string attribute)func ContextAttribute(Attribute *string) AttributeAccessor #
Access a context attribute for comparison.

Context attributes come from the request environment. Common attributes: sourceIp, timestamp, environment, region, etc.

1 parameter

Parameters

  • attributeattributeattributeattributeAttribute — - The attribute name (e.g., 'sourceIp', 'environment', 'timestamp').
or(): ConditionBuilder // chainabledef or(self, ) -> ConditionBuilderpublic ConditionBuilder or()public ConditionBuilder Or()func Or() ConditionBuilder #
Logical OR operator - at least one condition must be true.
principalAttribute(attribute: string): AttributeAccessordef principal_attribute(self, attribute: str) -> AttributeAccessorpublic AttributeAccessor principalAttribute(String attribute)public AttributeAccessor PrincipalAttribute(string attribute)func PrincipalAttribute(Attribute *string) AttributeAccessor #
Access a principal attribute for comparison.

Principal attributes come from the authenticated user/service making the request. Common attributes: username, role, department, groups, etc.

1 parameter

Parameters

  • attributeattributeattributeattributeAttribute — - The attribute name (e.g., 'department', 'role', 'username').
resourceAttribute(attribute: string): AttributeAccessordef resource_attribute(self, attribute: str) -> AttributeAccessorpublic AttributeAccessor resourceAttribute(String attribute)public AttributeAccessor ResourceAttribute(string attribute)func ResourceAttribute(Attribute *string) AttributeAccessor #
Access a resource attribute for comparison.

Resource attributes come from the target resource being accessed. Common attributes: arn, type, tags, owner, etc.

1 parameter

Parameters

  • attributeattributeattributeattributeAttribute — - The attribute name (e.g., 'confidential', 'owner', 'classification').