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

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:14.807Z") @Stability(Stable) public class CfnRule extends CfnResource implements IInspectable, ITaggable
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();
 

See Also:
  • 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 software.constructs.Construct scope, @NotNull String id, @NotNull CfnRuleProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). 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()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getAction

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

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

      @Stability(Stable) public void setAction(@NotNull CfnRule.ActionProperty value)
      Describes the action for a rule.
    • 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.
    • setPriority

      @Stability(Stable) public void setPriority(@NotNull Number value)
      The priority assigned to the rule.
    • 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.
    • setName

      @Stability(Stable) public void setName(@Nullable String value)
      The name of the rule.
    • 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.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      The tags for the rule.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      The tags for the rule.