# Google Cloud Run V2 Client - Class ContainerPort (1.12.2)

1.12.2 (latest) 1.12.1 1.11.0 1.10.1 1.9.0 1.8.0 1.7.0 1.6.0 1.5.2 1.4.0 1.3.0 1.2.0 1.1.0 1.0.0 0.9.3 0.8.0 0.7.2 0.6.0 0.5.2 0.4.0 0.3.4 Reference documentation and code samples for the Google Cloud Run V2 Client class ContainerPort.

ContainerPort represents a network port in a single container.

Generated from protobuf message `google.cloud.run.v2.ContainerPort`

## Namespace

Google \\ Cloud \\ Run \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` If specified, used to specify which protocol to use. Allowed values are "http1" and "h2c". |
| `↳ container_port` | `int` Port number the container listens on. This must be a valid TCP port number, 0 \< container_port \< 65536. |

### getName

If specified, used to specify which protocol to use.

Allowed values are "http1" and "h2c".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

If specified, used to specify which protocol to use.

Allowed values are "http1" and "h2c".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getContainerPort

Port number the container listens on.

This must be a valid TCP port number, 0 \< container_port \< 65536.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setContainerPort

Port number the container listens on.

This must be a valid TCP port number, 0 \< container_port \< 65536.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |