java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:35.992Z") @Stability(Stable) public class CfnRule extends CfnResource implements IInspectable
A CloudFormation AWS::VpcLattice::Rule.

Creates a listener rule. Each listener has a default rule for checking connection requests, but you can define additional rules. Each rule consists of a priority, one or more actions, and one or more conditions. For more information, see Listener rules in the Amazon VPC Lattice User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.vpclattice.*;
 CfnRule cfnRule = CfnRule.Builder.create(this, "MyCfnRule")
         .action(ActionProperty.builder()
                 .fixedResponse(FixedResponseProperty.builder()
                         .statusCode(123)
                         .build())
                 .forward(ForwardProperty.builder()
                         .targetGroups(List.of(WeightedTargetGroupProperty.builder()
                                 .targetGroupIdentifier("targetGroupIdentifier")
                                 // the properties below are optional
                                 .weight(123)
                                 .build()))
                         .build())
                 .build())
         .match(MatchProperty.builder()
                 .httpMatch(HttpMatchProperty.builder()
                         .headerMatches(List.of(HeaderMatchProperty.builder()
                                 .match(HeaderMatchTypeProperty.builder()
                                         .contains("contains")
                                         .exact("exact")
                                         .prefix("prefix")
                                         .build())
                                 .name("name")
                                 // the properties below are optional
                                 .caseSensitive(false)
                                 .build()))
                         .method("method")
                         .pathMatch(PathMatchProperty.builder()
                                 .match(PathMatchTypeProperty.builder()
                                         .exact("exact")
                                         .prefix("prefix")
                                         .build())
                                 // the properties below are optional
                                 .caseSensitive(false)
                                 .build())
                         .build())
                 .build())
         .priority(123)
         // the properties below are optional
         .listenerIdentifier("listenerIdentifier")
         .name("name")
         .serviceIdentifier("serviceIdentifier")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnRule

      protected CfnRule(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnRule

      protected CfnRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnRule

      @Stability(Stable) public CfnRule(@NotNull Construct scope, @NotNull String id, @NotNull CfnRuleProps props)
      Create a new AWS::VpcLattice::Rule.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector -
      • tree inspector to collect and process attributes.
      This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The Amazon Resource Name (ARN) of the rule.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      The ID of the listener.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      The tags for the rule.
    • getAction

      @Stability(Stable) @NotNull public Object getAction()
      Describes the action for a rule.

      Each rule must include exactly one of the following types of actions: forward or fixed-response , and it must be the last action to be performed.

    • setAction

      @Stability(Stable) public void setAction(@NotNull IResolvable value)
      Describes the action for a rule.

      Each rule must include exactly one of the following types of actions: forward or fixed-response , and it must be the last action to be performed.

    • setAction

      @Stability(Stable) public void setAction(@NotNull CfnRule.ActionProperty value)
      Describes the action for a rule.

      Each rule must include exactly one of the following types of actions: forward or fixed-response , and it must be the last action to be performed.

    • getMatch

      @Stability(Stable) @NotNull public Object getMatch()
      The rule match.
    • setMatch

      @Stability(Stable) public void setMatch(@NotNull IResolvable value)
      The rule match.
    • setMatch

      @Stability(Stable) public void setMatch(@NotNull CfnRule.MatchProperty value)
      The rule match.
    • getPriority

      @Stability(Stable) @NotNull public Number getPriority()
      The priority assigned to the rule.

      Each rule for a specific listener must have a unique priority. The lower the priority number the higher the priority.

    • setPriority

      @Stability(Stable) public void setPriority(@NotNull Number value)
      The priority assigned to the rule.

      Each rule for a specific listener must have a unique priority. The lower the priority number the higher the priority.

    • getListenerIdentifier

      @Stability(Stable) @Nullable public String getListenerIdentifier()
      The ID or Amazon Resource Name (ARN) of the listener.
    • setListenerIdentifier

      @Stability(Stable) public void setListenerIdentifier(@Nullable String value)
      The ID or Amazon Resource Name (ARN) of the listener.
    • getName

      @Stability(Stable) @Nullable public String getName()
      The name of the rule.

      The name must be unique within the listener. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.

      If you don't specify a name, CloudFormation generates one. However, if you specify a name, and later want to replace the resource, you must specify a new name.

    • setName

      @Stability(Stable) public void setName(@Nullable String value)
      The name of the rule.

      The name must be unique within the listener. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.

      If you don't specify a name, CloudFormation generates one. However, if you specify a name, and later want to replace the resource, you must specify a new name.

    • getServiceIdentifier

      @Stability(Stable) @Nullable public String getServiceIdentifier()
      The ID or Amazon Resource Name (ARN) of the service.
    • setServiceIdentifier

      @Stability(Stable) public void setServiceIdentifier(@Nullable String value)
      The ID or Amazon Resource Name (ARN) of the service.