Class AgentcoreGatewayRule


  • public class AgentcoreGatewayRule
    extends com.pulumi.resources.CustomResource
    Manages an AWS Bedrock AgentCore Gateway Rule. Rules define conditions and actions that control how requests are routed and processed through a gateway, including principal-based access control, path-based routing, weighted target routing, and configuration bundle overrides. Rules are evaluated in order of `priority` (lower numbers first). ## Example Usage ### Route to a Static Target
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.bedrock.AgentcoreGatewayRule;
     import com.pulumi.aws.bedrock.AgentcoreGatewayRuleArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionRouteToTargetArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionRouteToTargetStaticRouteArgs;
     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 AgentcoreGatewayRule("example", AgentcoreGatewayRuleArgs.builder()
                 .actions(AgentcoreGatewayRuleActionArgs.builder()
                     .routeToTarget(AgentcoreGatewayRuleActionRouteToTargetArgs.builder()
                         .staticRoute(AgentcoreGatewayRuleActionRouteToTargetStaticRouteArgs.builder()
                             .targetName(exampleAwsBedrockagentcoreGatewayTarget.name())
                             .build())
                         .build())
                     .build())
                 .gatewayIdentifier(exampleAwsBedrockagentcoreGateway.gatewayId())
                 .priority(100)
                 .description("Route all requests to the primary target")
                 .build());
     
         }
     }
     
     
    ### Weighted Route (Canary Traffic Split)
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.bedrock.AgentcoreGatewayRule;
     import com.pulumi.aws.bedrock.AgentcoreGatewayRuleArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionRouteToTargetArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionRouteToTargetWeightedRouteArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionRouteToTargetWeightedRouteTrafficSplitArgs;
     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 canary = new AgentcoreGatewayRule("canary", AgentcoreGatewayRuleArgs.builder()
                 .actions(AgentcoreGatewayRuleActionArgs.builder()
                     .routeToTarget(AgentcoreGatewayRuleActionRouteToTargetArgs.builder()
                         .weightedRoute(AgentcoreGatewayRuleActionRouteToTargetWeightedRouteArgs.builder()
                             .trafficSplits(                        
                                 AgentcoreGatewayRuleActionRouteToTargetWeightedRouteTrafficSplitArgs.builder()
                                     .name("primary")
                                     .targetName(primary.name())
                                     .weight(90)
                                     .build(),
                                 AgentcoreGatewayRuleActionRouteToTargetWeightedRouteTrafficSplitArgs.builder()
                                     .name("canary")
                                     .targetName(canaryAwsBedrockagentcoreGatewayTarget.name())
                                     .weight(10)
                                     .build())
                             .build())
                         .build())
                     .build())
                 .gatewayIdentifier(example.gatewayId())
                 .priority(100)
                 .build());
     
         }
     }
     
     
    ### Match on IAM Principals and Paths
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.AwsFunctions;
     import com.pulumi.aws.inputs.GetCallerIdentityArgs;
     import com.pulumi.aws.inputs.GetPartitionArgs;
     import com.pulumi.aws.bedrock.AgentcoreGatewayRule;
     import com.pulumi.aws.bedrock.AgentcoreGatewayRuleArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionRouteToTargetArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleActionRouteToTargetStaticRouteArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleConditionArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleConditionMatchPrincipalsArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleConditionMatchPrincipalsAnyOfArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleConditionMatchPrincipalsAnyOfIamPrincipalArgs;
     import com.pulumi.aws.bedrock.inputs.AgentcoreGatewayRuleConditionMatchPathsArgs;
     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) {
             final var current = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
                 .build());
     
             final var currentGetPartition = AwsFunctions.getPartition(GetPartitionArgs.builder()
                 .build());
     
             var restricted = new AgentcoreGatewayRule("restricted", AgentcoreGatewayRuleArgs.builder()
                 .actions(AgentcoreGatewayRuleActionArgs.builder()
                     .routeToTarget(AgentcoreGatewayRuleActionRouteToTargetArgs.builder()
                         .staticRoute(AgentcoreGatewayRuleActionRouteToTargetStaticRouteArgs.builder()
                             .targetName(example.name())
                             .build())
                         .build())
                     .build())
                 .conditions(            
                     AgentcoreGatewayRuleConditionArgs.builder()
                         .matchPrincipals(AgentcoreGatewayRuleConditionMatchPrincipalsArgs.builder()
                             .anyOfs(AgentcoreGatewayRuleConditionMatchPrincipalsAnyOfArgs.builder()
                                 .iamPrincipal(AgentcoreGatewayRuleConditionMatchPrincipalsAnyOfIamPrincipalArgs.builder()
                                     .arn(String.format("arn:%s:iam::%s:role/agentcore-caller-*", currentGetPartition.partition(),current.accountId()))
                                     .operator("StringLike")
                                     .build())
                                 .build())
                             .build())
                         .build(),
                     AgentcoreGatewayRuleConditionArgs.builder()
                         .matchPaths(AgentcoreGatewayRuleConditionMatchPathsArgs.builder()
                             .anyOfs("/api/*")
                             .build())
                         .build())
                 .gatewayIdentifier(exampleAwsBedrockagentcoreGateway.gatewayId())
                 .priority(50)
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `gatewayIdentifier` (String) Identifier of the gateway. * `ruleId` (String) Identifier of the rule. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import gateway rules using `gatewayIdentifier` and `ruleId` separated by a comma (`,`). For example: ```sh $ pulumi import aws:bedrock/agentcoreGatewayRule:AgentcoreGatewayRule example example-gateway-abcdef1234,11111111-2222-3333-4444-555555555555 ```
    • 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<java.util.Optional<java.util.List<AgentcoreGatewayRuleAction>>> actions()  
      com.pulumi.core.Output<java.util.Optional<java.util.List<AgentcoreGatewayRuleCondition>>> conditions()  
      com.pulumi.core.Output<java.lang.String> description()  
      com.pulumi.core.Output<java.lang.String> gatewayArn()  
      com.pulumi.core.Output<java.lang.String> gatewayIdentifier()  
      static AgentcoreGatewayRule get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, AgentcoreGatewayRuleState 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.Integer> priority()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> ruleId()  
      com.pulumi.core.Output<java.util.List<AgentcoreGatewayRuleSystem>> systems()  
      com.pulumi.core.Output<java.util.Optional<AgentcoreGatewayRuleTimeouts>> timeouts()  
      • 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

      • AgentcoreGatewayRule

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

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

        public AgentcoreGatewayRule​(java.lang.String name,
                                    AgentcoreGatewayRuleArgs 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

      • actions

        public com.pulumi.core.Output<java.util.Optional<java.util.List<AgentcoreGatewayRuleAction>>> actions()
        Returns:
        One or two `action` blocks defining what happens when the rule's conditions match. See Action below.
      • conditions

        public com.pulumi.core.Output<java.util.Optional<java.util.List<AgentcoreGatewayRuleCondition>>> conditions()
        Returns:
        Up to two `condition` blocks that must all be satisfied for the rule's actions to apply. See Condition below.
      • description

        public com.pulumi.core.Output<java.lang.String> description()
        Returns:
        Description of the rule. Between 1 and 256 characters.
      • gatewayArn

        public com.pulumi.core.Output<java.lang.String> gatewayArn()
        Returns:
        ARN of the gateway that owns the rule.
      • gatewayIdentifier

        public com.pulumi.core.Output<java.lang.String> gatewayIdentifier()
        Returns:
        Identifier of the gateway to attach the rule to.
      • priority

        public com.pulumi.core.Output<java.lang.Integer> priority()
        Returns:
        Priority of the rule, between 1 and 1000000. Rules are evaluated in ascending order of priority. The following arguments are optional:
      • 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.
      • ruleId

        public com.pulumi.core.Output<java.lang.String> ruleId()
        Returns:
        Identifier of the rule.
      • systems

        public com.pulumi.core.Output<java.util.List<AgentcoreGatewayRuleSystem>> systems()
        Returns:
        Present when the rule is system-managed. See `system` Block below.
      • get

        public static AgentcoreGatewayRule get​(java.lang.String name,
                                               com.pulumi.core.Output<java.lang.String> id,
                                               @Nullable
                                               AgentcoreGatewayRuleState 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.