Class Policy
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.bedrockagentcore.PolicyBase
software.amazon.awscdk.services.bedrockagentcore.Policy
- All Implemented Interfaces:
IPolicyRef,IEnvironmentAware,IResource,IPolicy,IGrantable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)",
date="2026-09-10T17:51:40.337Z")
@Stability(Stable)
public class Policy
extends PolicyBase
Individual Cedar policy defining what agents can access.
Policies use Cedar language to specify precise access control rules that are evaluated deterministically by the PolicyEngine.
Example:
PolicyEngine policyEngine;
Policy advancedPolicy = Policy.Builder.create(this, "AdvancedPolicy")
.policyEngine(policyEngine)
.statement(PolicyStatement.fromCedar("permit(principal, action, resource) when { context.custom > 10 };"))
.description("Advanced policy with custom Cedar logic")
.build();
policyEngine.addPolicy("CustomPolicy", AddPolicyOptions.builder()
.statement(PolicyStatement.fromCedar("forbid(principal, action, resource) when { resource.confidential == true };"))
.description("Custom policy from Cedar string")
.build());
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrockagentcore.IPolicy
IPolicy.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedPolicy(software.amazon.jsii.JsiiObjectRef objRef) Policy(software.constructs.Construct scope, String id, PolicyProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IPolicyfromPolicyAttributes(software.constructs.Construct scope, String id, PolicyAttributes attrs) Creates a Policy reference from an existing policy's attributes.The Cedar policy definition.The description of the policy.The principal to grant permissions to.The ARN of the policy resource.The policy engine this policy belongs to.The ID of the policy.The name of the policy.The validation mode for the policy.Methods inherited from class software.amazon.awscdk.services.bedrockagentcore.PolicyBase
getPolicyRef, grant, grantRead, metric, metric, metricEvaluationLatency, metricEvaluationLatency, metricEvaluations, metricEvaluationsMethods inherited from class software.amazon.awscdk.Resource
applyCrossStackReferenceStrength, applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource, withMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNode, withMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
Policy
protected Policy(software.amazon.jsii.JsiiObjectRef objRef) -
Policy
protected Policy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Policy
@Stability(Stable) public Policy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull PolicyProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromPolicyAttributes
@Stability(Stable) @NotNull public static IPolicy fromPolicyAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull PolicyAttributes attrs) Creates a Policy reference from an existing policy's attributes.- Parameters:
scope-- The construct scope.
id-- Identifier of the construct.
attrs-- Attributes of the existing policy.
- Returns:
- An IPolicy reference to the existing policy
-
getDefinition
The Cedar policy definition. -
getGrantPrincipal
The principal to grant permissions to.- Specified by:
getGrantPrincipalin interfaceIGrantable- Specified by:
getGrantPrincipalin classPolicyBase
-
getPolicyArn
The ARN of the policy resource.- Specified by:
getPolicyArnin interfaceIPolicy- Specified by:
getPolicyArnin classPolicyBase
-
getPolicyEngine
The policy engine this policy belongs to.[disable-awslint:attribute-tag]
- Specified by:
getPolicyEnginein interfaceIPolicy- Specified by:
getPolicyEnginein classPolicyBase
-
getPolicyId
The ID of the policy.- Specified by:
getPolicyIdin interfaceIPolicy- Specified by:
getPolicyIdin classPolicyBase
-
getPolicyName
The name of the policy.[disable-awslint:attribute-tag]
- Specified by:
getPolicyNamein interfaceIPolicy- Specified by:
getPolicyNamein classPolicyBase
-
getDescription
The description of the policy.- Specified by:
getDescriptionin interfaceIPolicy- Specified by:
getDescriptionin classPolicyBase
-
getValidationMode
The validation mode for the policy.- Specified by:
getValidationModein interfaceIPolicy- Specified by:
getValidationModein classPolicyBase
-