# Compute V1 Client - Class ManagedInstance (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 ManagedInstance.

A Managed Instance resource.

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

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ current_action` | `string` Output only. \[Output Only\] The current action that the managed instance group has scheduled for the instance. Possible values: - NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance. - CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful. - CREATING_WITHOUT_RETRIES The managed instance group is attempting to create this instance only once. If the group fails to create this instance, it does not try again and the group'stargetSize value is decreased instead. - RECREATING The managed instance group is recreating this instance. - DELETING The managed instance group is permanently deleting this instance. - ABANDONING The managed instance group is abandoning this instance. The instance will be removed from the instance group and from any target pools that are associated with this group. - RESTARTING The managed instance group is restarting the instance. - REFRESHING The managed instance group is applying configuration changes to the instance without stopping it. For example, the group can update the target pool list for an instance without stopping that instance. - VERIFYING The managed instance group has created the instance and it is in the process of being verified. Check the CurrentAction enum for the list of possible values. |
| `↳ id` | `int|string` Output only. \[Output only\] The unique identifier for this resource. This field is empty when instance does not exist. |
| `↳ instance` | `string` Output only. \[Output Only\] The URL of the instance. The URL can exist even if the instance has not yet been created. |
| `↳ instance_health` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.ManagedInstanceInstanceHealth>` Output only. \[Output Only\] Health state of the instance per health-check. |
| `↳ instance_status` | `string` Output only. \[Output Only\] The status of the instance. This field is empty when the instance does not exist. Check the InstanceStatus enum for the list of possible values. |
| `↳ last_attempt` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.ManagedInstanceLastAttempt` Output only. \[Output Only\] Information about the last attempt to create or delete the instance. |
| `↳ name` | `string` Output only. \[Output Only\] The name of the instance. The name always exists even if the instance has not yet been created. |
| `↳ preserved_state_from_config` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.PreservedState` Output only. \[Output Only\] Preserved state applied from per-instance config for this instance. |
| `↳ preserved_state_from_policy` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.PreservedState` Output only. \[Output Only\] Preserved state generated based on stateful policy for this instance. |
| `↳ properties_from_flexibility_policy` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.ManagedInstancePropertiesFromFlexibilityPolicy` Output only. \[Output Only\] Instance properties selected for this instance resulting from InstanceFlexibilityPolicy. |
| `↳ version` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.ManagedInstanceVersion` Output only. \[Output Only\] Intended version of this instance. |

### getCurrentAction

Output only. \[Output Only\] The current action that the managed instance group has
scheduled for the instance. Possible values:

- NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance.

<!-- -->

- CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful.
  - CREATING_WITHOUT_RETRIES The managed instance group is attempting to create this instance only once. If the group fails to create this instance, it does not try again and the group'stargetSize value is decreased instead.
  - RECREATING The managed instance group is recreating this instance.
  - DELETING The managed instance group is permanently deleting this instance.
  - ABANDONING The managed instance group is abandoning this instance. The instance will be removed from the instance group and from any target pools that are associated with this group.
  - RESTARTING The managed instance group is restarting the instance.
  - REFRESHING The managed instance group is applying configuration changes to the instance without stopping it. For example, the group can update the target pool list for an instance without stopping that instance.
  - VERIFYING The managed instance group has created the instance and it is in the process of being verified. Check the CurrentAction enum for the list of possible values.

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

### hasCurrentAction

### clearCurrentAction

### setCurrentAction

Output only. \[Output Only\] The current action that the managed instance group has
scheduled for the instance. Possible values:

- NONE The instance is running, and the managed instance group does not have any scheduled actions for this instance.

<!-- -->

- CREATING The managed instance group is creating this instance. If the group fails to create this instance, it will try again until it is successful.
  - CREATING_WITHOUT_RETRIES The managed instance group is attempting to create this instance only once. If the group fails to create this instance, it does not try again and the group'stargetSize value is decreased instead.
  - RECREATING The managed instance group is recreating this instance.
  - DELETING The managed instance group is permanently deleting this instance.
  - ABANDONING The managed instance group is abandoning this instance. The instance will be removed from the instance group and from any target pools that are associated with this group.
  - RESTARTING The managed instance group is restarting the instance.
  - REFRESHING The managed instance group is applying configuration changes to the instance without stopping it. For example, the group can update the target pool list for an instance without stopping that instance.
  - VERIFYING The managed instance group has created the instance and it is in the process of being verified. Check the CurrentAction enum for the list of possible values.

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

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

### getId

Output only. \[Output only\] The unique identifier for this resource. This field is empty
when instance does not exist.

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

### hasId

### clearId

### setId

Output only. \[Output only\] The unique identifier for this resource. This field is empty
when instance does not exist.

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

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

### getInstance

Output only. \[Output Only\] The URL of the instance. The URL can exist even if the
instance has not yet been created.

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

### hasInstance

### clearInstance

### setInstance

Output only. \[Output Only\] The URL of the instance. The URL can exist even if the
instance has not yet been created.

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

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

### getInstanceHealth

Output only. \[Output Only\] Health state of the instance per health-check.

| **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.ManagedInstanceInstanceHealth>` |   |

### setInstanceHealth

Output only. \[Output Only\] Health state of the instance per health-check.

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

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

### getInstanceStatus

Output only. \[Output Only\] The status of the instance. This field is empty when
the instance does not exist.

Check the InstanceStatus enum for the list of possible values.

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

### hasInstanceStatus

### clearInstanceStatus

### setInstanceStatus

Output only. \[Output Only\] The status of the instance. This field is empty when
the instance does not exist.

Check the InstanceStatus enum for the list of possible values.

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

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

### getLastAttempt

Output only. \[Output Only\] Information about the last attempt to create or delete
the instance.

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

### hasLastAttempt

### clearLastAttempt

### setLastAttempt

Output only. \[Output Only\] Information about the last attempt to create or delete
the instance.

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

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

### getName

Output only. \[Output Only\] The name of the instance. The name always exists even if the
instance has not yet been created.

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

### hasName

### clearName

### setName

Output only. \[Output Only\] The name of the instance. The name always exists even if the
instance has not yet been created.

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

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

### getPreservedStateFromConfig

Output only. \[Output Only\] Preserved state applied from per-instance config
for this instance.

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

### hasPreservedStateFromConfig

### clearPreservedStateFromConfig

### setPreservedStateFromConfig

Output only. \[Output Only\] Preserved state applied from per-instance config
for this instance.

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

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

### getPreservedStateFromPolicy

Output only. \[Output Only\] Preserved state generated based on stateful policy
for this instance.

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

### hasPreservedStateFromPolicy

### clearPreservedStateFromPolicy

### setPreservedStateFromPolicy

Output only. \[Output Only\] Preserved state generated based on stateful policy
for this instance.

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

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

### getPropertiesFromFlexibilityPolicy

Output only. \[Output Only\] Instance properties selected for this instance resulting from
InstanceFlexibilityPolicy.

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

### hasPropertiesFromFlexibilityPolicy

### clearPropertiesFromFlexibilityPolicy

### setPropertiesFromFlexibilityPolicy

Output only. \[Output Only\] Instance properties selected for this instance resulting from
InstanceFlexibilityPolicy.

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

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

### getVersion

Output only. \[Output Only\] Intended version of this instance.

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

### hasVersion

### clearVersion

### setVersion

Output only. \[Output Only\] Intended version of this instance.

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

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