# AclTrafficConfig

Acl Configuration for traffic.

Returned by: [AclTraffic.toTrafficConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.AclTraffic.html#totrafficconfig)

- Source: [`aws-ec2/lib/network-acl-types.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/network-acl-types.ts#L176)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const aclTrafficConfig: ec2.AclTrafficConfig = {
  protocol: 123,

  // the properties below are optional
  icmp: {
    code: 123,
    type: 123,
  },
  portRange: {
    from: 123,
    to: 123,
  },
};
```

Python:

```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_ec2 as ec2

acl_traffic_config = ec2.AclTrafficConfig(
    protocol=123,

    # the properties below are optional
    icmp=ec2.AclIcmp(
        code=123,
        type=123
    ),
    port_range=ec2.AclPortRange(
        from=123,
        to=123
    )
)
```

Java:

```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.ec2.*;

AclTrafficConfig aclTrafficConfig = AclTrafficConfig.builder()
        .protocol(123)

        // the properties below are optional
        .icmp(AclIcmp.builder()
                .code(123)
                .type(123)
                .build())
        .portRange(AclPortRange.builder()
                .from(123)
                .to(123)
                .build())
        .build();
```

C# / .NET:

```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.EC2;

var aclTrafficConfig = new AclTrafficConfig {
    Protocol = 123,

    // the properties below are optional
    Icmp = new AclIcmp {
        Code = 123,
        Type = 123
    },
    PortRange = new AclPortRange {
        From = 123,
        To = 123
    }
};
```

Golang:

```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"

aclTrafficConfig := &AclTrafficConfig{
	Protocol: jsii.Number(123),

	// the properties below are optional
	Icmp: &AclIcmp{
		Code: jsii.Number(123),
		Type: jsii.Number(123),
	},
	PortRange: &AclPortRange{
		From: jsii.Number(123),
		To: jsii.Number(123),
	},
}
```

## Properties

- `icmp`: [AclIcmp](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.AclIcmp.html) — The Internet Control Message Protocol (ICMP) code and type.

  **Default:** Required if specifying 1 (ICMP) for the protocol parameter.

- `portRange`: [AclPortRange](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.AclPortRange.html) — The range of port numbers for the UDP/TCP protocol.

  **Default:** Required if specifying 6 (TCP) or 17 (UDP) for the protocol parameter

- `protocol`: number (required) = 17 — The protocol number.

  A value of "-1" means all protocols.

  If you specify "-1" or a protocol number other than "6" (TCP), "17" (UDP),
  or "1" (ICMP), traffic on all ports is allowed, regardless of any ports or
  ICMP types or codes that you specify.

  If you specify protocol "58" (ICMPv6) and specify an IPv4 CIDR
  block, traffic for all ICMP types and codes allowed, regardless of any that
  you specify. If you specify protocol "58" (ICMPv6) and specify an IPv6 CIDR
  block, you must specify an ICMP type and code.
