# Google Cloud Batch V1 Client - Class InstancePolicy (1.4.1)

1.4.1 (latest) 1.4.0 1.3.1 1.2.2 1.1.7 1.0.3 0.17.0 0.16.10 0.15.0 0.14.0 0.13.1 0.12.1 0.11.3 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.2 0.4.0 0.3.0 0.2.2 Reference documentation and code samples for the Google Cloud Batch V1 Client class InstancePolicy.

InstancePolicy describes an instance type and resources attached to each VM
created by this InstancePolicy.

Generated from protobuf message `google.cloud.batch.v1.AllocationPolicy.InstancePolicy`

## Namespace

Google \\ Cloud \\ Batch \\ V1 \\ AllocationPolicy

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ machine_type` | `string` The Compute Engine machine type. |
| `↳ min_cpu_platform` | `string` The minimum CPU platform. See <https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform>. |
| `↳ provisioning_model` | `int` The provisioning model. |
| `↳ accelerators` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.Accelerator>` The accelerators attached to each VM instance. |
| `↳ boot_disk` | `https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.Disk` Boot disk to be created and attached to each VM by this InstancePolicy. Boot disk will be deleted when the VM is deleted. Batch API now only supports booting from image. |
| `↳ disks` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.AttachedDisk>` Non-boot disks to be attached for each VM created by this InstancePolicy. New disks will be deleted when the VM is deleted. A non-boot disk is a disk that can be of a device with a file system or a raw storage drive that is not ready for data storage and accessing. |
| `↳ reservation` | `string` Optional. If not specified (default), VMs will consume any applicable reservation. If "NO_RESERVATION" is specified, VMs will not consume any reservation. Otherwise, if specified, VMs will consume only the specified reservation. |

### getMachineType

The Compute Engine machine type.

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

### setMachineType

The Compute Engine machine type.

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

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

### getMinCpuPlatform

The minimum CPU platform.

See
<https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform>.

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

### setMinCpuPlatform

The minimum CPU platform.

See
<https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform>.

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

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

### getProvisioningModel

The provisioning model.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ProvisioningModel](https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.ProvisioningModel). |

### setProvisioningModel

The provisioning model.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ProvisioningModel](https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.ProvisioningModel). |

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

### getAccelerators

The accelerators attached to each VM instance.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.Accelerator>` |   |

### setAccelerators

The accelerators attached to each VM instance.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.Accelerator>` |

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

### getBootDisk

Boot disk to be created and attached to each VM by this InstancePolicy.

Boot disk will be deleted when the VM is deleted.
Batch API now only supports booting from image.

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

### hasBootDisk

### clearBootDisk

### setBootDisk

Boot disk to be created and attached to each VM by this InstancePolicy.

Boot disk will be deleted when the VM is deleted.
Batch API now only supports booting from image.

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

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

### getDisks

Non-boot disks to be attached for each VM created by this InstancePolicy.

New disks will be deleted when the VM is deleted.
A non-boot disk is a disk that can be of a device with a
file system or a raw storage drive that is not ready for data
storage and accessing.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.AttachedDisk>` |   |

### setDisks

Non-boot disks to be attached for each VM created by this InstancePolicy.

New disks will be deleted when the VM is deleted.
A non-boot disk is a disk that can be of a device with a
file system or a raw storage drive that is not ready for data
storage and accessing.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-batch/latest/V1.AllocationPolicy.AttachedDisk>` |

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

### getReservation

Optional. If not specified (default), VMs will consume any applicable
reservation. If "NO_RESERVATION" is specified, VMs will not consume any
reservation. Otherwise, if specified, VMs will consume only the specified
reservation.

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

### setReservation

Optional. If not specified (default), VMs will consume any applicable
reservation. If "NO_RESERVATION" is specified, VMs will not consume any
reservation. Otherwise, if specified, VMs will consume only the specified
reservation.

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

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