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

ResourceRequirements describes the compute resource requirements.

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

## Namespace

Google \\ Cloud \\ Run \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ limits` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported. Notes: \* \* The only supported values for CPU are '1', '2', '4', and '8'. Setting 4 CPU requires at least 2Gi of memory. For more information, go to <https://cloud.google.com/run/docs/configuring/cpu>. \* \* For supported 'memory' values and syntax, go to <https://cloud.google.com/run/docs/configuring/memory-limits> \* \* The only supported 'nvidia.com/gpu' value is '1'. |
| `↳ cpu_idle` | `bool` Determines whether CPU is only allocated during requests (true by default). However, if ResourceRequirements is set, the caller must explicitly set this field to true to preserve the default behavior. |
| `↳ startup_cpu_boost` | `bool` Determines whether CPU should be boosted on startup of a new container instance above the requested CPU threshold, this can help reduce cold-start latency. |

### getLimits

Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.

<br />

Notes:

- The only supported values for CPU are '1', '2', '4', and '8'. Setting 4 CPU requires at least 2Gi of memory. For more information, go to <https://cloud.google.com/run/docs/configuring/cpu>.
  - For supported 'memory' values and syntax, go to <https://cloud.google.com/run/docs/configuring/memory-limits>
- The only supported 'nvidia.com/gpu' value is '1'.

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

### setLimits

Only `memory`, `cpu` and `nvidia.com/gpu` keys in the map are supported.

<br />

Notes:

- The only supported values for CPU are '1', '2', '4', and '8'. Setting 4 CPU requires at least 2Gi of memory. For more information, go to <https://cloud.google.com/run/docs/configuring/cpu>.
  - For supported 'memory' values and syntax, go to <https://cloud.google.com/run/docs/configuring/memory-limits>
- The only supported 'nvidia.com/gpu' value is '1'.

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

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

### getCpuIdle

Determines whether CPU is only allocated during requests (true by default).

However, if ResourceRequirements is set, the caller must explicitly
set this field to true to preserve the default behavior.

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

### setCpuIdle

Determines whether CPU is only allocated during requests (true by default).

However, if ResourceRequirements is set, the caller must explicitly
set this field to true to preserve the default behavior.

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

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

### getStartupCpuBoost

Determines whether CPU should be boosted on startup of a new container
instance above the requested CPU threshold, this can help reduce cold-start
latency.

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

### setStartupCpuBoost

Determines whether CPU should be boosted on startup of a new container
instance above the requested CPU threshold, this can help reduce cold-start
latency.

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

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