# Google Cloud Run V2 Client - Class Volume (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 Volume.

Volume represents a named volume in a container.

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

## Namespace

Google \\ Cloud \\ Run \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Required. Volume's name. |
| `↳ secret` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.SecretVolumeSource` Secret represents a secret that should populate this volume. |
| `↳ cloud_sql_instance` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.CloudSqlInstance` For Cloud SQL volumes, contains the specific instances that should be mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for more information on how to connect Cloud SQL and Cloud Run. |
| `↳ empty_dir` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.EmptyDirVolumeSource` Ephemeral storage used as a shared volume. |
| `↳ nfs` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.NFSVolumeSource` For NFS Voumes, contains the path to the nfs Volume |
| `↳ gcs` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.GCSVolumeSource` Persistent storage backed by a Google Cloud Storage bucket. |

### getName

Required. Volume's name.

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

### setName

Required. Volume's name.

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

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

### getSecret

Secret represents a secret that should populate this volume.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.SecretVolumeSource|null` |   |

### hasSecret

### setSecret

Secret represents a secret that should populate this volume.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.SecretVolumeSource` |

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

### getCloudSqlInstance

For Cloud SQL volumes, contains the specific instances that should be
mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
more information on how to connect Cloud SQL and Cloud Run.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.CloudSqlInstance|null` |   |

### hasCloudSqlInstance

### setCloudSqlInstance

For Cloud SQL volumes, contains the specific instances that should be
mounted. Visit <https://cloud.google.com/sql/docs/mysql/connect-run> for
more information on how to connect Cloud SQL and Cloud Run.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.CloudSqlInstance` |

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

### getEmptyDir

Ephemeral storage used as a shared volume.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.EmptyDirVolumeSource|null` |   |

### hasEmptyDir

### setEmptyDir

Ephemeral storage used as a shared volume.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.EmptyDirVolumeSource` |

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

### getNfs

For NFS Voumes, contains the path to the nfs Volume

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.NFSVolumeSource|null` |   |

### hasNfs

### setNfs

For NFS Voumes, contains the path to the nfs Volume

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.NFSVolumeSource` |

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

### getGcs

Persistent storage backed by a Google Cloud Storage bucket.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.GCSVolumeSource|null` |   |

### hasGcs

### setGcs

Persistent storage backed by a Google Cloud Storage bucket.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.GCSVolumeSource` |

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

### getVolumeType

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