Skip to content
v2.278.0

RulesSourceProperty Struct ​

The stateless or stateful rules definitions for use in a single rule group.

Each rule group requires a single RulesSource . You can use an instance of this for either stateless rules or stateful rules.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_networkfirewall as networkfirewall } from 'aws-cdk-lib';
const rulesSourceProperty: networkfirewall.CfnRuleGroup.RulesSourceProperty = {
  rulesSourceList: {
    generatedRulesType: 'generatedRulesType',
    targets: ['targets'],
    targetTypes: ['targetTypes'],
  },
  rulesString: 'rulesString',
  statefulRules: [{
    action: 'action',
    header: {
      destination: 'destination',
      destinationPort: 'destinationPort',
      direction: 'direction',
      protocol: 'protocol',
      source: 'source',
      sourcePort: 'sourcePort',
    },
    ruleOptions: [{
      keyword: 'keyword',

      // the properties below are optional
      settings: ['settings'],
    }],
  }],
  statelessRulesAndCustomActions: {
    statelessRules: [{
      priority: 123,
      ruleDefinition: {
        actions: ['actions'],
        matchAttributes: {
          destinationPorts: [{
            fromPort: 123,
            toPort: 123,
          }],
          destinations: [{
            addressDefinition: 'addressDefinition',
          }],
          protocols: [123],
          sourcePorts: [{
            fromPort: 123,
            toPort: 123,
          }],
          sources: [{
            addressDefinition: 'addressDefinition',
          }],
          tcpFlags: [{
            flags: ['flags'],

            // the properties below are optional
            masks: ['masks'],
          }],
        },
      },
    }],

    // the properties below are optional
    customActions: [{
      actionDefinition: {
        publishMetricAction: {
          dimensions: [{
            value: 'value',
          }],
        },
      },
      actionName: 'actionName',
    }],
  },
};
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_networkfirewall as networkfirewall

rules_source_property = networkfirewall.CfnRuleGroup.RulesSourceProperty(
    rules_source_list=networkfirewall.CfnRuleGroup.RulesSourceListProperty(
        generated_rules_type="generatedRulesType",
        targets=["targets"],
        target_types=["targetTypes"]
    ),
    rules_string="rulesString",
    stateful_rules=[networkfirewall.CfnRuleGroup.StatefulRuleProperty(
        action="action",
        header=networkfirewall.CfnRuleGroup.HeaderProperty(
            destination="destination",
            destination_port="destinationPort",
            direction="direction",
            protocol="protocol",
            source="source",
            source_port="sourcePort"
        ),
        rule_options=[networkfirewall.CfnRuleGroup.RuleOptionProperty(
            keyword="keyword",

            # the properties below are optional
            settings=["settings"]
        )]
    )],
    stateless_rules_and_custom_actions=networkfirewall.CfnRuleGroup.StatelessRulesAndCustomActionsProperty(
        stateless_rules=[networkfirewall.CfnRuleGroup.StatelessRuleProperty(
            priority=123,
            rule_definition=networkfirewall.CfnRuleGroup.RuleDefinitionProperty(
                actions=["actions"],
                match_attributes=networkfirewall.CfnRuleGroup.MatchAttributesProperty(
                    destination_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty(
                        from_port=123,
                        to_port=123
                    )],
                    destinations=[networkfirewall.CfnRuleGroup.AddressProperty(
                        address_definition="addressDefinition"
                    )],
                    protocols=[123],
                    source_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty(
                        from_port=123,
                        to_port=123
                    )],
                    sources=[networkfirewall.CfnRuleGroup.AddressProperty(
                        address_definition="addressDefinition"
                    )],
                    tcp_flags=[networkfirewall.CfnRuleGroup.TCPFlagFieldProperty(
                        flags=["flags"],

                        # the properties below are optional
                        masks=["masks"]
                    )]
                )
            )
        )],

        # the properties below are optional
        custom_actions=[networkfirewall.CfnRuleGroup.CustomActionProperty(
            action_definition=networkfirewall.CfnRuleGroup.ActionDefinitionProperty(
                publish_metric_action=networkfirewall.CfnRuleGroup.PublishMetricActionProperty(
                    dimensions=[networkfirewall.CfnRuleGroup.DimensionProperty(
                        value="value"
                    )]
                )
            ),
            action_name="actionName"
        )]
    )
)
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.networkfirewall.*;

RulesSourceProperty rulesSourceProperty = RulesSourceProperty.builder()
        .rulesSourceList(RulesSourceListProperty.builder()
                .generatedRulesType("generatedRulesType")
                .targets(List.of("targets"))
                .targetTypes(List.of("targetTypes"))
                .build())
        .rulesString("rulesString")
        .statefulRules(List.of(StatefulRuleProperty.builder()
                .action("action")
                .header(HeaderProperty.builder()
                        .destination("destination")
                        .destinationPort("destinationPort")
                        .direction("direction")
                        .protocol("protocol")
                        .source("source")
                        .sourcePort("sourcePort")
                        .build())
                .ruleOptions(List.of(RuleOptionProperty.builder()
                        .keyword("keyword")

                        // the properties below are optional
                        .settings(List.of("settings"))
                        .build()))
                .build()))
        .statelessRulesAndCustomActions(StatelessRulesAndCustomActionsProperty.builder()
                .statelessRules(List.of(StatelessRuleProperty.builder()
                        .priority(123)
                        .ruleDefinition(RuleDefinitionProperty.builder()
                                .actions(List.of("actions"))
                                .matchAttributes(MatchAttributesProperty.builder()
                                        .destinationPorts(List.of(PortRangeProperty.builder()
                                                .fromPort(123)
                                                .toPort(123)
                                                .build()))
                                        .destinations(List.of(AddressProperty.builder()
                                                .addressDefinition("addressDefinition")
                                                .build()))
                                        .protocols(List.of(123))
                                        .sourcePorts(List.of(PortRangeProperty.builder()
                                                .fromPort(123)
                                                .toPort(123)
                                                .build()))
                                        .sources(List.of(AddressProperty.builder()
                                                .addressDefinition("addressDefinition")
                                                .build()))
                                        .tcpFlags(List.of(TCPFlagFieldProperty.builder()
                                                .flags(List.of("flags"))

                                                // the properties below are optional
                                                .masks(List.of("masks"))
                                                .build()))
                                        .build())
                                .build())
                        .build()))

                // the properties below are optional
                .customActions(List.of(CustomActionProperty.builder()
                        .actionDefinition(ActionDefinitionProperty.builder()
                                .publishMetricAction(PublishMetricActionProperty.builder()
                                        .dimensions(List.of(DimensionProperty.builder()
                                                .value("value")
                                                .build()))
                                        .build())
                                .build())
                        .actionName("actionName")
                        .build()))
                .build())
        .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.NetworkFirewall;

var rulesSourceProperty = new RulesSourceProperty {
    RulesSourceList = new RulesSourceListProperty {
        GeneratedRulesType = "generatedRulesType",
        Targets = new [] { "targets" },
        TargetTypes = new [] { "targetTypes" }
    },
    RulesString = "rulesString",
    StatefulRules = new [] { new StatefulRuleProperty {
        Action = "action",
        Header = new HeaderProperty {
            Destination = "destination",
            DestinationPort = "destinationPort",
            Direction = "direction",
            Protocol = "protocol",
            Source = "source",
            SourcePort = "sourcePort"
        },
        RuleOptions = new [] { new RuleOptionProperty {
            Keyword = "keyword",

            // the properties below are optional
            Settings = new [] { "settings" }
        } }
    } },
    StatelessRulesAndCustomActions = new StatelessRulesAndCustomActionsProperty {
        StatelessRules = new [] { new StatelessRuleProperty {
            Priority = 123,
            RuleDefinition = new RuleDefinitionProperty {
                Actions = new [] { "actions" },
                MatchAttributes = new MatchAttributesProperty {
                    DestinationPorts = new [] { new PortRangeProperty {
                        FromPort = 123,
                        ToPort = 123
                    } },
                    Destinations = new [] { new AddressProperty {
                        AddressDefinition = "addressDefinition"
                    } },
                    Protocols = new [] { 123 },
                    SourcePorts = new [] { new PortRangeProperty {
                        FromPort = 123,
                        ToPort = 123
                    } },
                    Sources = new [] { new AddressProperty {
                        AddressDefinition = "addressDefinition"
                    } },
                    TcpFlags = new [] { new TCPFlagFieldProperty {
                        Flags = new [] { "flags" },

                        // the properties below are optional
                        Masks = new [] { "masks" }
                    } }
                }
            }
        } },

        // the properties below are optional
        CustomActions = new [] { new CustomActionProperty {
            ActionDefinition = new ActionDefinitionProperty {
                PublishMetricAction = new PublishMetricActionProperty {
                    Dimensions = new [] { new DimensionProperty {
                        Value = "value"
                    } }
                }
            },
            ActionName = "actionName"
        } }
    }
};
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"

rulesSourceProperty := &RulesSourceProperty{
	RulesSourceList: &RulesSourceListProperty{
		GeneratedRulesType: jsii.String("generatedRulesType"),
		Targets: []*string{
			jsii.String("targets"),
		},
		TargetTypes: []*string{
			jsii.String("targetTypes"),
		},
	},
	RulesString: jsii.String("rulesString"),
	StatefulRules: []interface{}{
		&StatefulRuleProperty{
			Action: jsii.String("action"),
			Header: &HeaderProperty{
				Destination: jsii.String("destination"),
				DestinationPort: jsii.String("destinationPort"),
				Direction: jsii.String("direction"),
				Protocol: jsii.String("protocol"),
				Source: jsii.String("source"),
				SourcePort: jsii.String("sourcePort"),
			},
			RuleOptions: []interface{}{
				&RuleOptionProperty{
					Keyword: jsii.String("keyword"),

					// the properties below are optional
					Settings: []*string{
						jsii.String("settings"),
					},
				},
			},
		},
	},
	StatelessRulesAndCustomActions: &StatelessRulesAndCustomActionsProperty{
		StatelessRules: []interface{}{
			&StatelessRuleProperty{
				Priority: jsii.Number(123),
				RuleDefinition: &RuleDefinitionProperty{
					Actions: []*string{
						jsii.String("actions"),
					},
					MatchAttributes: &MatchAttributesProperty{
						DestinationPorts: []interface{}{
							&PortRangeProperty{
								FromPort: jsii.Number(123),
								ToPort: jsii.Number(123),
							},
						},
						Destinations: []interface{}{
							&AddressProperty{
								AddressDefinition: jsii.String("addressDefinition"),
							},
						},
						Protocols: []interface{}{
							jsii.Number(123),
						},
						SourcePorts: []interface{}{
							&PortRangeProperty{
								FromPort: jsii.Number(123),
								ToPort: jsii.Number(123),
							},
						},
						Sources: []interface{}{
							&AddressProperty{
								AddressDefinition: jsii.String("addressDefinition"),
							},
						},
						TcpFlags: []interface{}{
							&TCPFlagFieldProperty{
								Flags: []*string{
									jsii.String("flags"),
								},

								// the properties below are optional
								Masks: []*string{
									jsii.String("masks"),
								},
							},
						},
					},
				},
			},
		},

		// the properties below are optional
		CustomActions: []interface{}{
			&CustomActionProperty{
				ActionDefinition: &ActionDefinitionProperty{
					PublishMetricAction: &PublishMetricActionProperty{
						Dimensions: []interface{}{
							&DimensionProperty{
								Value: jsii.String("value"),
							},
						},
					},
				},
				ActionName: jsii.String("actionName"),
			},
		},
	},
}

Properties ​

rulesSourceListoptionalIResolvable | CfnRuleGroup.RulesSourceListPropertyrules_source_listoptionaltyping.Union[IResolvable, RulesSourceListProperty]rulesSourceListoptionalIResolvableRulesSourceListoptionalIResolvableRulesSourceListoptionalinterface{} #
Stateful inspection criteria for a domain list rule group.
rulesStringoptionalstringrules_stringoptionalstrrulesStringoptionalStringRulesStringoptionalstringRulesStringoptional*string #
Stateful inspection criteria, provided in Suricata compatible rules.
notes

Suricata is an open-source threat detection framework that includes a standard rule-based language for network traffic inspection.

These rules contain the inspection criteria and the action to take for traffic that matches the criteria, so this type of rule group doesn't have a separate action setting.

You can't use the priority keyword if the RuleOrder option in StatefulRuleOptions is set to STRICT_ORDER .

statefulRulesoptionalIResolvable | IResolvable | CfnRuleGroup.StatefulRuleProperty[]stateful_rulesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, StatefulRuleProperty]]]statefulRulesoptionalIResolvableStatefulRulesoptionalIResolvableStatefulRulesoptionalinterface{} #
An array of individual stateful rules inspection criteria to be used together in a stateful rule group.
notes

Use this option to specify simple Suricata rules with protocol, source and destination, ports, direction, and rule options. For information about the Suricata Rules format, see Rules Format .

statelessRulesAndCustomActionsoptionalIResolvable | CfnRuleGroup.StatelessRulesAndCustomActionsPropertystateless_rules_and_custom_actionsoptionaltyping.Union[IResolvable, StatelessRulesAndCustomActionsProperty]statelessRulesAndCustomActionsoptionalIResolvableStatelessRulesAndCustomActionsoptionalIResolvableStatelessRulesAndCustomActionsoptionalinterface{} #
Stateless inspection criteria to be used in a stateless rule group.