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

TaskTemplate describes the data a task should have when created
from a template.

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

## Namespace

Google \\ Cloud \\ Run \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ containers` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Container>` Holds the single container that defines the unit of execution for this task. |
| `↳ volumes` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Volume>` Optional. A list of Volumes to make available to containers. |
| `↳ max_retries` | `int` Number of retries allowed per Task, before marking this Task failed. Defaults to 3. |
| `↳ timeout` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` Optional. Max allowed time duration the Task may be active before the system will actively try to mark it failed and kill associated containers. This applies per attempt of a task, meaning each retry can run for the full timeout. Defaults to 600 seconds. |
| `↳ service_account` | `string` Optional. Email address of the IAM service account associated with the Task of a Job. The service account represents the identity of the running task, and determines what permissions the task has. If not provided, the task will use the project's default service account. |
| `↳ execution_environment` | `int` Optional. The execution environment being used to host this Task. |
| `↳ encryption_key` | `string` A reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to <https://cloud.google.com/run/docs/securing/using-cmek> |
| `↳ vpc_access` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.VpcAccess` Optional. VPC Access configuration to use for this Task. For more information, visit <https://cloud.google.com/run/docs/configuring/connecting-vpc>. |
| `↳ node_selector` | `https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.NodeSelector` Optional. The node selector for the task template. |
| `↳ gpu_zonal_redundancy_disabled` | `bool` Optional. True if GPU zonal redundancy is disabled on this task template. |

### getContainers

Holds the single container that defines the unit of execution for this
task.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Container>` |   |

### setContainers

Holds the single container that defines the unit of execution for this
task.

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

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

### getVolumes

Optional. A list of Volumes to make available to containers.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.Volume>` |   |

### setVolumes

Optional. A list of Volumes to make available to containers.

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

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

### getMaxRetries

Number of retries allowed per Task, before marking this Task failed.

Defaults to 3.

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

### hasMaxRetries

### setMaxRetries

Number of retries allowed per Task, before marking this Task failed.

Defaults to 3.

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

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

### getTimeout

Optional. Max allowed time duration the Task may be active before the
system will actively try to mark it failed and kill associated containers.

This applies per attempt of a task, meaning each retry can run for the full
timeout. Defaults to 600 seconds.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasTimeout

### clearTimeout

### setTimeout

Optional. Max allowed time duration the Task may be active before the
system will actively try to mark it failed and kill associated containers.

This applies per attempt of a task, meaning each retry can run for the full
timeout. Defaults to 600 seconds.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

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

### getServiceAccount

Optional. Email address of the IAM service account associated with the Task
of a Job. The service account represents the identity of the running task,
and determines what permissions the task has. If not provided, the task
will use the project's default service account.

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

### setServiceAccount

Optional. Email address of the IAM service account associated with the Task
of a Job. The service account represents the identity of the running task,
and determines what permissions the task has. If not provided, the task
will use the project's default service account.

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

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

### getExecutionEnvironment

Optional. The execution environment being used to host this Task.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ExecutionEnvironment](https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.ExecutionEnvironment). |

### setExecutionEnvironment

Optional. The execution environment being used to host this Task.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ExecutionEnvironment](https://docs.cloud.google.com/php/docs/reference/cloud-run/latest/V2.ExecutionEnvironment). |

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

### getEncryptionKey

A reference to a customer managed encryption key (CMEK) to use to encrypt
this container image. For more information, go to
<https://cloud.google.com/run/docs/securing/using-cmek>

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

### setEncryptionKey

A reference to a customer managed encryption key (CMEK) to use to encrypt
this container image. For more information, go to
<https://cloud.google.com/run/docs/securing/using-cmek>

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

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

### getVpcAccess

Optional. VPC Access configuration to use for this Task. For more
information, visit
<https://cloud.google.com/run/docs/configuring/connecting-vpc>.

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

### hasVpcAccess

### clearVpcAccess

### setVpcAccess

Optional. VPC Access configuration to use for this Task. For more
information, visit
<https://cloud.google.com/run/docs/configuring/connecting-vpc>.

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

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

### getNodeSelector

Optional. The node selector for the task template.

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

### hasNodeSelector

### clearNodeSelector

### setNodeSelector

Optional. The node selector for the task template.

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

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

### getGpuZonalRedundancyDisabled

Optional. True if GPU zonal redundancy is disabled on this task template.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasGpuZonalRedundancyDisabled

### clearGpuZonalRedundancyDisabled

### setGpuZonalRedundancyDisabled

Optional. True if GPU zonal redundancy is disabled on this task template.

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

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

### getRetries

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