Class AgentcorePolicy


  • public class AgentcorePolicy
    extends com.pulumi.resources.CustomResource
    Manages an AWS Bedrock AgentCore Policy. A Policy attaches Cedar authorization rules to a Policy Engine, which evaluates them at runtime to control agent access to resources. ## Example Usage ### Cedar Policy
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.bedrock.AgentcorePolicy;
     import com.pulumi.aws.bedrock.AgentcorePolicyArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcorePolicyDefinitionArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcorePolicyDefinitionCedarArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new AgentcorePolicy("example", AgentcorePolicyArgs.builder()
                 .definition(AgentcorePolicyDefinitionArgs.builder()
                     .cedar(AgentcorePolicyDefinitionCedarArgs.builder()
                         .statement("""
     permit(principal, action == Action::\"Read\", resource);
                         """)
                         .build())
                     .build())
                 .name("example_policy")
                 .policyEngineId(exampleAwsBedrockagentcorePolicyEngine.policyEngineId())
                 .description("Allow read access to example resources")
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required - `policyEngineId` (String) ID of the policy engine. - `policyId` (String) ID of the policy. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import Bedrock AgentCore Policies using the `policyEngineId` and `policyId` separated by a comma. For example: ```sh $ pulumi import aws:bedrock/agentcorePolicy:AgentcorePolicy example PolicyEngine_i2fo6-dyqwrzl954,policy_ar2c3-o_rospxr2j ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<AgentcorePolicyDefinition> definition()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()  
      static AgentcorePolicy get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, AgentcorePolicyState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> policyArn()  
      com.pulumi.core.Output<java.lang.String> policyEngineId()  
      com.pulumi.core.Output<java.lang.String> policyId()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.util.Optional<AgentcorePolicyTimeouts>> timeouts()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> validationMode()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AgentcorePolicy

        public AgentcorePolicy​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • AgentcorePolicy

        public AgentcorePolicy​(java.lang.String name,
                               AgentcorePolicyArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • AgentcorePolicy

        public AgentcorePolicy​(java.lang.String name,
                               AgentcorePolicyArgs args,
                               @Nullable
                               com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • definition

        public com.pulumi.core.Output<AgentcorePolicyDefinition> definition()
        Returns:
        Policy definition. See `definition` Block for details.
      • description

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
        Returns:
        Description of the policy.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Name of the policy. Must be 1-48 characters and match the pattern `^[A-Za-z][A-Za-z0-9_]*$`. Changing this forces a new resource to be created.
      • policyArn

        public com.pulumi.core.Output<java.lang.String> policyArn()
        Returns:
        ARN of the Policy.
      • policyEngineId

        public com.pulumi.core.Output<java.lang.String> policyEngineId()
        Returns:
        Identifier of the Policy Engine that owns this policy. Changing this forces a new resource to be created. The following arguments are optional:
      • policyId

        public com.pulumi.core.Output<java.lang.String> policyId()
        Returns:
        Identifier of the Policy.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • validationMode

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> validationMode()
        Returns:
        Controls whether validation findings cause policy creation or update to fail. Valid values: `FAIL_ON_ANY_FINDINGS`, `IGNORE_ALL_FINDINGS`. Defaults to `FAIL_ON_ANY_FINDINGS`.
      • get

        public static AgentcorePolicy get​(java.lang.String name,
                                          com.pulumi.core.Output<java.lang.String> id,
                                          @Nullable
                                          AgentcorePolicyState state,
                                          @Nullable
                                          com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.