# PortProps

Properties to create a port range.

Used as props by: [Port](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Port.html)

- Source: [`aws-ec2/lib/port.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/port.ts#L161)

## 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 portProps: ec2.PortProps = {
  protocol: ec2.Protocol.ALL,
  stringRepresentation: 'stringRepresentation',

  // the properties below are optional
  fromPort: 123,
  toPort: 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

port_props = ec2.PortProps(
    protocol=ec2.Protocol.ALL,
    string_representation="stringRepresentation",

    # the properties below are optional
    from_port=123,
    to_port=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.*;

PortProps portProps = PortProps.builder()
        .protocol(Protocol.ALL)
        .stringRepresentation("stringRepresentation")

        // the properties below are optional
        .fromPort(123)
        .toPort(123)
        .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 portProps = new PortProps {
    Protocol = Protocol.ALL,
    StringRepresentation = "stringRepresentation",

    // the properties below are optional
    FromPort = 123,
    ToPort = 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"

portProps := &PortProps{
	Protocol: awscdk.Aws_ec2.Protocol_ALL,
	StringRepresentation: jsii.String("stringRepresentation"),

	// the properties below are optional
	FromPort: jsii.Number(123),
	ToPort: jsii.Number(123),
}
```

## Properties

- `fromPort`: number — The starting port for the range.

  **Default:** Not included in the rule

- `protocol`: [Protocol](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Protocol.html) (required) — The protocol for the range.

- `stringRepresentation`: string (required) — String representation for this object.

- `toPort`: number — The ending port for the range.

  **Default:** Not included in the rule
