Interface AddPolicyOptions
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
AddPolicyOptions.Jsii$Proxy
@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)",
date="2026-09-10T17:51:39.886Z")
@Stability(Stable)
public interface AddPolicyOptions
extends software.amazon.jsii.JsiiSerializable
Options for adding a policy via PolicyEngine.addPolicy().
Example:
PolicyEngine policyEngine;
Gateway gateway;
// Allow specific tool actions on specific gateway
// Action names follow pattern: "ToolName__operation"
policyEngine.addPolicy("SpecificToolPolicy", AddPolicyOptions.builder()
.statement(PolicyStatement.Builder.create()
.effect(PolicyEffect.PERMIT)
.principal(PolicyPrincipal.entityType("AgentCore::OAuthUser"))
.action(PolicyAction.anyOf(List.of("AgentCore::Action::WeatherTool__get_forecast", "AgentCore::Action::WeatherTool__get_current")))
.resource(PolicyResource.instance("AgentCore::Gateway", gateway.getGatewayArn()))
.build())
.description("Allow specific weather tool operations")
.validationMode(PolicyValidationMode.FAIL_ON_ANY_FINDINGS)
.build());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forAddPolicyOptionsstatic final classAn implementation forAddPolicyOptions -
Method Summary
Modifier and TypeMethodDescriptionstatic AddPolicyOptions.Builderbuilder()default StringOptional description for the policy (max 4,096 characters).default StringThe name of the policy.The Cedar policy statement for this policy.default PolicyValidationModeValidation mode for the policy.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getStatement
The Cedar policy statement for this policy.Build a type-safe statement with the
PolicyStatementfactories, or usePolicyStatement.fromCedar('...')for raw Cedar. Raw Cedar is treated as trusted input: the module does not escape, quote, or validate it. -
getDescription
Optional description for the policy (max 4,096 characters).Default: - No description
-
getPolicyName
The name of the policy.Valid characters: a-z, A-Z, 0-9, _ (underscore) Must start with a letter, 1-48 characters
Default: - Auto-generated unique name
-
getValidationMode
Validation mode for the policy.Default: PolicyValidationMode.FAIL_ON_ANY_FINDINGS
-
builder
- Returns:
- a
AddPolicyOptions.BuilderofAddPolicyOptions
-