# Google Cloud Dataproc V1 Client - Class AutoscalingPolicy (3.14.0)

3.14.0 (latest) 3.13.4 3.12.0 3.11.0 3.10.1 3.9.0 3.8.1 3.7.1 3.6.1 3.5.1 3.4.0 3.3.0 3.2.2 2.12.0 2.11.0 2.10.0 2.9.1 2.8.2 2.7.0 2.6.1 2.5.0 2.3.0 2.2.3 2.1.0 2.0.0 Reference documentation and code samples for the Google Cloud Dataproc V1 Client class AutoscalingPolicy.

Describes an autoscaling policy for Dataproc cluster autoscaler.

Generated from protobuf message `google.cloud.dataproc.v1.AutoscalingPolicy`

## Namespace

Google \\ Cloud \\ Dataproc \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ id` | `string` Required. The policy id. The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between 3 and 50 characters. |
| `↳ name` | `string` Output only. The "resource name" of the autoscaling policy, as described in <https://cloud.google.com/apis/design/resource_names>. \* For `projects.regions.autoscalingPolicies`, the resource name of the policy has the following format: `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}` \* For `projects.locations.autoscalingPolicies`, the resource name of the policy has the following format: `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}` |
| `↳ basic_algorithm` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.BasicAutoscalingAlgorithm` |
| `↳ worker_config` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.InstanceGroupAutoscalingPolicyConfig` Required. Describes how the autoscaler will operate for primary workers. |
| `↳ secondary_worker_config` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.InstanceGroupAutoscalingPolicyConfig` Optional. Describes how the autoscaler will operate for secondary workers. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. The labels to associate with this autoscaling policy. Label **keys** must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). Label **values** may be empty, but, if present, must contain 1 to 63 characters, and must conform to [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with an autoscaling policy. |

### getId

Required. The policy id.

The id must contain only letters (a-z, A-Z), numbers (0-9),
underscores (_), and hyphens (-). Cannot begin or end with underscore
or hyphen. Must consist of between 3 and 50 characters.

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

### setId

Required. The policy id.

The id must contain only letters (a-z, A-Z), numbers (0-9),
underscores (_), and hyphens (-). Cannot begin or end with underscore
or hyphen. Must consist of between 3 and 50 characters.

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

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

### getName

Output only. The "resource name" of the autoscaling policy, as described
in <https://cloud.google.com/apis/design/resource_names>.

- For `projects.regions.autoscalingPolicies`, the resource name of the policy has the following format: `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
- For `projects.locations.autoscalingPolicies`, the resource name of the policy has the following format: `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`

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

### setName

Output only. The "resource name" of the autoscaling policy, as described
in <https://cloud.google.com/apis/design/resource_names>.

- For `projects.regions.autoscalingPolicies`, the resource name of the policy has the following format: `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
- For `projects.locations.autoscalingPolicies`, the resource name of the policy has the following format: `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`

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

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

### getBasicAlgorithm

Generated from protobuf field `.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.BasicAutoscalingAlgorithm|null` |   |

### hasBasicAlgorithm

### setBasicAlgorithm

Generated from protobuf field `.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.BasicAutoscalingAlgorithm` |

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

### getWorkerConfig

Required. Describes how the autoscaler will operate for primary workers.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.InstanceGroupAutoscalingPolicyConfig|null` |   |

### hasWorkerConfig

### clearWorkerConfig

### setWorkerConfig

Required. Describes how the autoscaler will operate for primary workers.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.InstanceGroupAutoscalingPolicyConfig` |

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

### getSecondaryWorkerConfig

Optional. Describes how the autoscaler will operate for secondary workers.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.InstanceGroupAutoscalingPolicyConfig|null` |   |

### hasSecondaryWorkerConfig

### clearSecondaryWorkerConfig

### setSecondaryWorkerConfig

Optional. Describes how the autoscaler will operate for secondary workers.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.InstanceGroupAutoscalingPolicyConfig` |

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

### getLabels

Optional. The labels to associate with this autoscaling policy.

Label **keys** must contain 1 to 63 characters, and must conform to
[RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
Label **values** may be empty, but, if present, must contain 1 to 63
characters, and must conform to [RFC
1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
associated with an autoscaling policy.

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

### setLabels

Optional. The labels to associate with this autoscaling policy.

Label **keys** must contain 1 to 63 characters, and must conform to
[RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
Label **values** may be empty, but, if present, must contain 1 to 63
characters, and must conform to [RFC
1035](https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be
associated with an autoscaling policy.

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

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

### getAlgorithm

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