# Compute V1 Client - Class Scheduling (2.10.0)

2.10.0 (latest) 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.0.0 1.36.0 1.35.0 1.34.0 1.33.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 1.24.0 1.23.0 1.22.1 1.21.0 1.20.0 1.19.0 1.18.1 1.17.0 1.16.2 1.14.0 1.13.0 1.12.1 1.11.1 1.10.1 1.9.1 1.8.3 1.7.1 1.6.1 1.5.0 Reference documentation and code samples for the Compute V1 Client class Scheduling.

Sets the scheduling options for an Instance.

Generated from protobuf message `google.cloud.compute.v1.Scheduling`

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ automatic_restart` | `bool` Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). You can only set the automatic restart option for standard instances.Preemptible instances cannot be automatically restarted. By default, this is set to true so an instance is automatically restarted if it is terminated by Compute Engine. |
| `↳ availability_domain` | `int` Specifies the availability domain to place the instance in. The value must be a number between 1 and the number of availability domains specified in the spread placement policy attached to the instance. |
| `↳ host_error_timeout_seconds` | `int` Specify the time in seconds for host error detection, the value must be within the range of \[90, 330\] with the increment of 30, if unset, the default behavior of host error recovery will be used. |
| `↳ instance_termination_action` | `string` Specifies the termination action for the instance. Check the InstanceTerminationAction enum for the list of possible values. |
| `↳ local_ssd_recovery_timeout` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.Duration` Specifies the maximum amount of time a Local Ssd Vm should wait while recovery of the Local Ssd state is attempted. Its value should be in between 0 and 168 hours with hour granularity and the default value being 1 hour. |
| `↳ location_hint` | `string` An opaque location hint used to place the instance close to other resources. This field is for use by internal tools that use the public API. |
| `↳ max_run_duration` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.Duration` Specifies the max run duration for the given instance. If specified, the instance termination action will be performed at the end of the run duration. |
| `↳ min_node_cpus` | `int` The minimum number of virtual CPUs this instance will consume when running on a sole-tenant node. |
| `↳ node_affinities` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.SchedulingNodeAffinity>` A set of node affinity and anti-affinity configurations. Refer toConfiguring node affinity for more information. Overrides reservationAffinity. |
| `↳ on_host_maintenance` | `string` Defines the maintenance behavior for this instance. For standard instances, the default behavior is MIGRATE. Forpreemptible instances, the default and only possible behavior is TERMINATE. For more information, see Set VM host maintenance policy. Check the OnHostMaintenance enum for the list of possible values. |
| `↳ on_instance_stop_action` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.SchedulingOnInstanceStopAction` |
| `↳ preemptible` | `bool` Defines whether the instance is preemptible. This can only be set during instance creation or while the instance isstopped and therefore, in a `TERMINATED` state. SeeInstance Life Cycle for more information on the possible instance states. |
| `↳ provisioning_model` | `string` Specifies the provisioning model of the instance. Check the ProvisioningModel enum for the list of possible values. |
| `↳ skip_guest_os_shutdown` | `bool` Default is false and there will be 120 seconds between GCE ACPI G2 Soft Off and ACPI G3 Mechanical Off for Standard VMs and 30 seconds for Spot VMs. |
| `↳ termination_time` | `string` Specifies the timestamp, when the instance will be terminated, inRFC3339 text format. If specified, the instance termination action will be performed at the termination time. |

### getAutomaticRestart

Specifies whether the instance should be automatically restarted if it is
terminated by Compute Engine (not terminated by a user). You can only set
the automatic restart option for standard instances.Preemptible instances
cannot be automatically restarted.

By default, this is set to true so an instance is
automatically restarted if it is terminated by Compute Engine.

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

### hasAutomaticRestart

### clearAutomaticRestart

### setAutomaticRestart

Specifies whether the instance should be automatically restarted if it is
terminated by Compute Engine (not terminated by a user). You can only set
the automatic restart option for standard instances.Preemptible instances
cannot be automatically restarted.

By default, this is set to true so an instance is
automatically restarted if it is terminated by Compute Engine.

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

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

### getAvailabilityDomain

Specifies the availability domain to place the instance in. The value
must be a number between 1 and the number of availability domains
specified in the spread placement policy attached to the instance.

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

### hasAvailabilityDomain

### clearAvailabilityDomain

### setAvailabilityDomain

Specifies the availability domain to place the instance in. The value
must be a number between 1 and the number of availability domains
specified in the spread placement policy attached to the instance.

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

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

### getHostErrorTimeoutSeconds

Specify the time in seconds for host error detection, the value must be
within the range of \[90, 330\] with the increment of 30, if unset, the
default behavior of host error recovery will be used.

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

### hasHostErrorTimeoutSeconds

### clearHostErrorTimeoutSeconds

### setHostErrorTimeoutSeconds

Specify the time in seconds for host error detection, the value must be
within the range of \[90, 330\] with the increment of 30, if unset, the
default behavior of host error recovery will be used.

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

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

### getInstanceTerminationAction

Specifies the termination action for the instance.

Check the InstanceTerminationAction enum for the list of possible values.

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

### hasInstanceTerminationAction

### clearInstanceTerminationAction

### setInstanceTerminationAction

Specifies the termination action for the instance.

Check the InstanceTerminationAction enum for the list of possible values.

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

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

### getLocalSsdRecoveryTimeout

Specifies the maximum amount of time a Local Ssd Vm should wait while
recovery of the Local Ssd state is attempted. Its value should be in
between 0 and 168 hours with hour granularity and the default value being 1
hour.

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

### hasLocalSsdRecoveryTimeout

### clearLocalSsdRecoveryTimeout

### setLocalSsdRecoveryTimeout

Specifies the maximum amount of time a Local Ssd Vm should wait while
recovery of the Local Ssd state is attempted. Its value should be in
between 0 and 168 hours with hour granularity and the default value being 1
hour.

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

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

### getLocationHint

An opaque location hint used to place the instance close to other
resources.

This field is for use by internal tools that use the public API.

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

### hasLocationHint

### clearLocationHint

### setLocationHint

An opaque location hint used to place the instance close to other
resources.

This field is for use by internal tools that use the public API.

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

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

### getMaxRunDuration

Specifies the max run duration for the given instance. If specified,
the instance termination action will be performed at the end of the run
duration.

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

### hasMaxRunDuration

### clearMaxRunDuration

### setMaxRunDuration

Specifies the max run duration for the given instance. If specified,
the instance termination action will be performed at the end of the run
duration.

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

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

### getMinNodeCpus

The minimum number of virtual CPUs this instance will consume when running
on a sole-tenant node.

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

### hasMinNodeCpus

### clearMinNodeCpus

### setMinNodeCpus

The minimum number of virtual CPUs this instance will consume when running
on a sole-tenant node.

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

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

### getNodeAffinities

A set of node affinity and anti-affinity configurations. Refer toConfiguring node
affinity for more information.

Overrides reservationAffinity.

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

### setNodeAffinities

A set of node affinity and anti-affinity configurations. Refer toConfiguring node
affinity for more information.

Overrides reservationAffinity.

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

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

### getOnHostMaintenance

Defines the maintenance behavior for this instance. For standard instances,
the default behavior is MIGRATE. Forpreemptible instances,
the default and only possible behavior is TERMINATE. For more
information, see
Set
VM host maintenance policy.

Check the OnHostMaintenance enum for the list of possible values.

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

### hasOnHostMaintenance

### clearOnHostMaintenance

### setOnHostMaintenance

Defines the maintenance behavior for this instance. For standard instances,
the default behavior is MIGRATE. Forpreemptible instances,
the default and only possible behavior is TERMINATE. For more
information, see
Set
VM host maintenance policy.

Check the OnHostMaintenance enum for the list of possible values.

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

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

### getOnInstanceStopAction

Generated from protobuf field `optional .google.cloud.compute.v1.SchedulingOnInstanceStopAction on_instance_stop_action = 529876681;`

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

### hasOnInstanceStopAction

### clearOnInstanceStopAction

### setOnInstanceStopAction

Generated from protobuf field `optional .google.cloud.compute.v1.SchedulingOnInstanceStopAction on_instance_stop_action = 529876681;`

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

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

### getPreemptible

Defines whether the instance is preemptible. This can only be set during
instance creation or while the instance isstopped and
therefore, in a `TERMINATED` state. SeeInstance Life
Cycle for more information on the possible instance states.

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

### hasPreemptible

### clearPreemptible

### setPreemptible

Defines whether the instance is preemptible. This can only be set during
instance creation or while the instance isstopped and
therefore, in a `TERMINATED` state. SeeInstance Life
Cycle for more information on the possible instance states.

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

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

### getProvisioningModel

Specifies the provisioning model of the instance.

Check the ProvisioningModel enum for the list of possible values.

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

### hasProvisioningModel

### clearProvisioningModel

### setProvisioningModel

Specifies the provisioning model of the instance.

Check the ProvisioningModel enum for the list of possible values.

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

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

### getSkipGuestOsShutdown

Default is false and there will be 120 seconds between GCE ACPI G2 Soft
Off and ACPI G3 Mechanical
Off for Standard VMs and 30 seconds for Spot VMs.

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

### hasSkipGuestOsShutdown

### clearSkipGuestOsShutdown

### setSkipGuestOsShutdown

Default is false and there will be 120 seconds between GCE ACPI G2 Soft
Off and ACPI G3 Mechanical
Off for Standard VMs and 30 seconds for Spot VMs.

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

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

### getTerminationTime

Specifies the timestamp, when the instance will be terminated, inRFC3339 text format. If specified, the instance
termination action will be performed at the termination time.

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

### hasTerminationTime

### clearTerminationTime

### setTerminationTime

Specifies the timestamp, when the instance will be terminated, inRFC3339 text format. If specified, the instance
termination action will be performed at the termination time.

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

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