Skip to content
v2.278.0

RuleConditionProperty Struct ​

Specifies a condition for a listener rule.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';
const ruleConditionProperty: elbv2.CfnListenerRule.RuleConditionProperty = {
  field: 'field',
  hostHeaderConfig: {
    regexValues: ['regexValues'],
    values: ['values'],
  },
  httpHeaderConfig: {
    httpHeaderName: 'httpHeaderName',
    regexValues: ['regexValues'],
    values: ['values'],
  },
  httpRequestMethodConfig: {
    values: ['values'],
  },
  pathPatternConfig: {
    regexValues: ['regexValues'],
    values: ['values'],
  },
  queryStringConfig: {
    values: [{
      key: 'key',
      value: 'value',
    }],
  },
  regexValues: ['regexValues'],
  sourceIpConfig: {
    ipAddressType: 'ipAddressType',
    values: ['values'],
  },
  values: ['values'],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_elasticloadbalancingv2 as elbv2

rule_condition_property = elbv2.CfnListenerRule.RuleConditionProperty(
    field="field",
    host_header_config=elbv2.CfnListenerRule.HostHeaderConfigProperty(
        regex_values=["regexValues"],
        values=["values"]
    ),
    http_header_config=elbv2.CfnListenerRule.HttpHeaderConfigProperty(
        http_header_name="httpHeaderName",
        regex_values=["regexValues"],
        values=["values"]
    ),
    http_request_method_config=elbv2.CfnListenerRule.HttpRequestMethodConfigProperty(
        values=["values"]
    ),
    path_pattern_config=elbv2.CfnListenerRule.PathPatternConfigProperty(
        regex_values=["regexValues"],
        values=["values"]
    ),
    query_string_config=elbv2.CfnListenerRule.QueryStringConfigProperty(
        values=[elbv2.CfnListenerRule.QueryStringKeyValueProperty(
            key="key",
            value="value"
        )]
    ),
    regex_values=["regexValues"],
    source_ip_config=elbv2.CfnListenerRule.SourceIpConfigProperty(
        ip_address_type="ipAddressType",
        values=["values"]
    ),
    values=["values"]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.elasticloadbalancingv2.*;

RuleConditionProperty ruleConditionProperty = RuleConditionProperty.builder()
        .field("field")
        .hostHeaderConfig(HostHeaderConfigProperty.builder()
                .regexValues(List.of("regexValues"))
                .values(List.of("values"))
                .build())
        .httpHeaderConfig(HttpHeaderConfigProperty.builder()
                .httpHeaderName("httpHeaderName")
                .regexValues(List.of("regexValues"))
                .values(List.of("values"))
                .build())
        .httpRequestMethodConfig(HttpRequestMethodConfigProperty.builder()
                .values(List.of("values"))
                .build())
        .pathPatternConfig(PathPatternConfigProperty.builder()
                .regexValues(List.of("regexValues"))
                .values(List.of("values"))
                .build())
        .queryStringConfig(QueryStringConfigProperty.builder()
                .values(List.of(QueryStringKeyValueProperty.builder()
                        .key("key")
                        .value("value")
                        .build()))
                .build())
        .regexValues(List.of("regexValues"))
        .sourceIpConfig(SourceIpConfigProperty.builder()
                .ipAddressType("ipAddressType")
                .values(List.of("values"))
                .build())
        .values(List.of("values"))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ElasticLoadBalancingV2;

var ruleConditionProperty = new RuleConditionProperty {
    Field = "field",
    HostHeaderConfig = new HostHeaderConfigProperty {
        RegexValues = new [] { "regexValues" },
        Values = new [] { "values" }
    },
    HttpHeaderConfig = new HttpHeaderConfigProperty {
        HttpHeaderName = "httpHeaderName",
        RegexValues = new [] { "regexValues" },
        Values = new [] { "values" }
    },
    HttpRequestMethodConfig = new HttpRequestMethodConfigProperty {
        Values = new [] { "values" }
    },
    PathPatternConfig = new PathPatternConfigProperty {
        RegexValues = new [] { "regexValues" },
        Values = new [] { "values" }
    },
    QueryStringConfig = new QueryStringConfigProperty {
        Values = new [] { new QueryStringKeyValueProperty {
            Key = "key",
            Value = "value"
        } }
    },
    RegexValues = new [] { "regexValues" },
    SourceIpConfig = new SourceIpConfigProperty {
        IpAddressType = "ipAddressType",
        Values = new [] { "values" }
    },
    Values = new [] { "values" }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

ruleConditionProperty := &RuleConditionProperty{
	Field: jsii.String("field"),
	HostHeaderConfig: &HostHeaderConfigProperty{
		RegexValues: []*string{
			jsii.String("regexValues"),
		},
		Values: []*string{
			jsii.String("values"),
		},
	},
	HttpHeaderConfig: &HttpHeaderConfigProperty{
		HttpHeaderName: jsii.String("httpHeaderName"),
		RegexValues: []*string{
			jsii.String("regexValues"),
		},
		Values: []*string{
			jsii.String("values"),
		},
	},
	HttpRequestMethodConfig: &HttpRequestMethodConfigProperty{
		Values: []*string{
			jsii.String("values"),
		},
	},
	PathPatternConfig: &PathPatternConfigProperty{
		RegexValues: []*string{
			jsii.String("regexValues"),
		},
		Values: []*string{
			jsii.String("values"),
		},
	},
	QueryStringConfig: &QueryStringConfigProperty{
		Values: []interface{}{
			&QueryStringKeyValueProperty{
				Key: jsii.String("key"),
				Value: jsii.String("value"),
			},
		},
	},
	RegexValues: []*string{
		jsii.String("regexValues"),
	},
	SourceIpConfig: &SourceIpConfigProperty{
		IpAddressType: jsii.String("ipAddressType"),
		Values: []*string{
			jsii.String("values"),
		},
	},
	Values: []*string{
		jsii.String("values"),
	},
}

Properties ​

fieldoptionalstringfieldoptionalstrfieldoptionalStringFieldoptionalstringFieldoptional*string #
The field in the HTTP request. The following are the possible values:.
  • http-header
  • http-request-method
  • host-header
  • path-pattern
  • query-string
  • source-ip
hostHeaderConfigoptionalIResolvable | CfnListenerRule.HostHeaderConfigPropertyhost_header_configoptionaltyping.Union[IResolvable, HostHeaderConfigProperty]hostHeaderConfigoptionalIResolvableHostHeaderConfigoptionalIResolvableHostHeaderConfigoptionalinterface{} #
Information for a host header condition.

Specify only when Field is host-header .

httpHeaderConfigoptionalIResolvable | CfnListenerRule.HttpHeaderConfigPropertyhttp_header_configoptionaltyping.Union[IResolvable, HttpHeaderConfigProperty]httpHeaderConfigoptionalIResolvableHttpHeaderConfigoptionalIResolvableHttpHeaderConfigoptionalinterface{} #
Information for an HTTP header condition.

Specify only when Field is http-header .

httpRequestMethodConfigoptionalIResolvable | CfnListenerRule.HttpRequestMethodConfigPropertyhttp_request_method_configoptionaltyping.Union[IResolvable, HttpRequestMethodConfigProperty]httpRequestMethodConfigoptionalIResolvableHttpRequestMethodConfigoptionalIResolvableHttpRequestMethodConfigoptionalinterface{} #
Information for an HTTP method condition.

Specify only when Field is http-request-method .

pathPatternConfigoptionalIResolvable | CfnListenerRule.PathPatternConfigPropertypath_pattern_configoptionaltyping.Union[IResolvable, PathPatternConfigProperty]pathPatternConfigoptionalIResolvablePathPatternConfigoptionalIResolvablePathPatternConfigoptionalinterface{} #
Information for a path pattern condition.

Specify only when Field is path-pattern .

queryStringConfigoptionalIResolvable | CfnListenerRule.QueryStringConfigPropertyquery_string_configoptionaltyping.Union[IResolvable, QueryStringConfigProperty]queryStringConfigoptionalIResolvableQueryStringConfigoptionalIResolvableQueryStringConfigoptionalinterface{} #
Information for a query string condition.

Specify only when Field is query-string .

regexValuesoptionalstring[]regex_valuesoptionaltyping.List[str]regexValuesoptionalList<String>RegexValuesoptionalstring[]RegexValuesoptional*[]*string #
The regular expressions to match against the condition field.

The maximum length of each string is 128 characters. Specify only when Field is http-header , host-header , or path-pattern .

sourceIpConfigoptionalIResolvable | CfnListenerRule.SourceIpConfigPropertysource_ip_configoptionaltyping.Union[IResolvable, SourceIpConfigProperty]sourceIpConfigoptionalIResolvableSourceIpConfigoptionalIResolvableSourceIpConfigoptionalinterface{} #
Information for a source IP condition.

Specify only when Field is source-ip .

valuesoptionalstring[]valuesoptionaltyping.List[str]valuesoptionalList<String>Valuesoptionalstring[]Valuesoptional*[]*string #
The condition value.
notes

Specify only when Field is host-header or path-pattern . Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig .

If Field is host-header and you're not using HostHeaderConfig , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.

  • A-Z, a-z, 0-9
    • .
    • (matches 0 or more characters)
  • ? (matches exactly 1 character)

If Field is path-pattern and you're not using PathPatternConfig , you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.

  • A-Z, a-z, 0-9
  • _ - . $ / ~ " ' @ : +
  • & (using &)
    • (matches 0 or more characters)
  • ? (matches exactly 1 character)