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

Represents an Operation resource.

Google Compute Engine has three Operation resources:

- [Global](https://docs.cloud.google.com/compute/docs/reference/rest/v1/globalOperations)
- [Regional](https://docs.cloud.google.com/compute/docs/reference/rest/v1/regionOperations)
- [Zonal](https://docs.cloud.google.com/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, readHandling API responses. Operations can be global, regional or zonal.
  - For global operations, use the `globalOperations` resource.
  - For regional operations, use the `regionOperations` resource.
  - For zonal operations, use the `zoneOperations` resource. For more information, read Global, Regional, and Zonal Resources. Note that completed Operation resources have a limited retention period.

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

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ client_operation_id` | `string` \[Output Only\] The value of `requestId` if you provided it in the request. Not present otherwise. |
| `↳ creation_timestamp` | `string` \[Deprecated\] This field is deprecated. |
| `↳ description` | `string` \[Output Only\] A textual description of the operation, which is set when the operation is created. |
| `↳ end_time` | `string` \[Output Only\] The time that this operation was completed. This value is inRFC3339 text format. |
| `↳ error` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.Error` \[Output Only\] If errors are generated during processing of the operation, this field will be populated. |
| `↳ get_version_operation_metadata` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.GetVersionOperationMetadata` |
| `↳ http_error_message` | `string` \[Output Only\] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. |
| `↳ http_error_status_code` | `int` \[Output Only\] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. |
| `↳ id` | `int|string` \[Output Only\] The unique identifier for the operation. This identifier is defined by the server. |
| `↳ insert_time` | `string` \[Output Only\] The time that this operation was requested. This value is inRFC3339 text format. |
| `↳ instances_bulk_insert_operation_metadata` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.InstancesBulkInsertOperationMetadata` |
| `↳ kind` | `string` Output only. \[Output Only\] Type of the resource. Always `compute#operation` for Operation resources. |
| `↳ name` | `string` \[Output Only\] Name of the operation. |
| `↳ operation_group_id` | `string` Output only. \[Output Only\] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. |
| `↳ operation_type` | `string` \[Output Only\] The type of operation, such as `insert`, `update`, or `delete`, and so on. |
| `↳ progress` | `int` \[Output Only\] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. |
| `↳ region` | `string` \[Output Only\] The URL of the region where the operation resides. Only applicable when performing regional operations. |
| `↳ self_link` | `string` \[Output Only\] Server-defined URL for the resource. |
| `↳ set_common_instance_metadata_operation_metadata` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.SetCommonInstanceMetadataOperationMetadata` Output only. \[Output Only\] If the operation is for projects.setCommonInstanceMetadata, this field will contain information on all underlying zonal actions and their state. |
| `↳ start_time` | `string` \[Output Only\] The time that this operation was started by the server. This value is inRFC3339 text format. |
| `↳ status` | `int` \[Output Only\] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. |
| `↳ status_message` | `string` \[Output Only\] An optional textual description of the current status of the operation. |
| `↳ target_id` | `int|string` \[Output Only\] The unique target ID, which identifies a specific incarnation of the target resource. |
| `↳ target_link` | `string` \[Output Only\] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the disk that the snapshot was created from. |
| `↳ user` | `string` \[Output Only\] User who requested the operation, for example: `user\@example.com` or `alice_smith_identifier (global/workforcePools/example-com-us-employees)`. |
| `↳ warnings` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.Warnings>` \[Output Only\] If warning messages are generated during processing of the operation, this field will be populated. |
| `↳ zone` | `string` \[Output Only\] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. |

### getClientOperationId

\[Output Only\] The value of `requestId` if you provided it in the request.

Not present otherwise.

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

### hasClientOperationId

### clearClientOperationId

### setClientOperationId

\[Output Only\] The value of `requestId` if you provided it in the request.

Not present otherwise.

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

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

### getCreationTimestamp

\[Deprecated\] This field is deprecated.

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

### hasCreationTimestamp

### clearCreationTimestamp

### setCreationTimestamp

\[Deprecated\] This field is deprecated.

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

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

### getDescription

\[Output Only\] A textual description of the operation, which is
set when the operation is created.

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

### hasDescription

### clearDescription

### setDescription

\[Output Only\] A textual description of the operation, which is
set when the operation is created.

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

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

### getEndTime

\[Output Only\] The time that this operation was completed. This value is inRFC3339
text format.

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

### hasEndTime

### clearEndTime

### setEndTime

\[Output Only\] The time that this operation was completed. This value is inRFC3339
text format.

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

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

### getError

\[Output Only\] If errors are generated during processing of the operation,
this field will be populated.

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

### hasError

### clearError

### setError

\[Output Only\] If errors are generated during processing of the operation,
this field will be populated.

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

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

### getGetVersionOperationMetadata

Generated from protobuf field `optional .google.cloud.compute.v1.GetVersionOperationMetadata get_version_operation_metadata = 173230167;`

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

### hasGetVersionOperationMetadata

### clearGetVersionOperationMetadata

### setGetVersionOperationMetadata

Generated from protobuf field `optional .google.cloud.compute.v1.GetVersionOperationMetadata get_version_operation_metadata = 173230167;`

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

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

### getHttpErrorMessage

\[Output Only\] If the operation fails, this field contains the HTTP error
message that was returned, such as `NOT FOUND`.

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

### hasHttpErrorMessage

### clearHttpErrorMessage

### setHttpErrorMessage

\[Output Only\] If the operation fails, this field contains the HTTP error
message that was returned, such as `NOT FOUND`.

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

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

### getHttpErrorStatusCode

\[Output Only\] If the operation fails, this field contains the HTTP error
status code that was returned. For example, a `404` means the
resource was not found.

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

### hasHttpErrorStatusCode

### clearHttpErrorStatusCode

### setHttpErrorStatusCode

\[Output Only\] If the operation fails, this field contains the HTTP error
status code that was returned. For example, a `404` means the
resource was not found.

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

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

### getId

\[Output Only\] The unique identifier for the operation. This identifier is
defined by the server.

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

### hasId

### clearId

### setId

\[Output Only\] The unique identifier for the operation. This identifier is
defined by the server.

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

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

### getInsertTime

\[Output Only\] The time that this operation was requested.

This value is inRFC3339
text format.

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

### hasInsertTime

### clearInsertTime

### setInsertTime

\[Output Only\] The time that this operation was requested.

This value is inRFC3339
text format.

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

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

### getInstancesBulkInsertOperationMetadata

Generated from protobuf field `optional .google.cloud.compute.v1.InstancesBulkInsertOperationMetadata instances_bulk_insert_operation_metadata = 89146177;`

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

### hasInstancesBulkInsertOperationMetadata

### clearInstancesBulkInsertOperationMetadata

### setInstancesBulkInsertOperationMetadata

Generated from protobuf field `optional .google.cloud.compute.v1.InstancesBulkInsertOperationMetadata instances_bulk_insert_operation_metadata = 89146177;`

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

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

### getKind

Output only. \[Output Only\] Type of the resource. Always `compute#operation` for
Operation resources.

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

### hasKind

### clearKind

### setKind

Output only. \[Output Only\] Type of the resource. Always `compute#operation` for
Operation resources.

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

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

### getName

\[Output Only\] Name of the operation.

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

### hasName

### clearName

### setName

\[Output Only\] Name of the operation.

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

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

### getOperationGroupId

Output only. \[Output Only\] An ID that represents a group of operations, such as when a
group of operations results from a `bulkInsert` API request.

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

### hasOperationGroupId

### clearOperationGroupId

### setOperationGroupId

Output only. \[Output Only\] An ID that represents a group of operations, such as when a
group of operations results from a `bulkInsert` API request.

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

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

### getOperationType

\[Output Only\] The type of operation, such as `insert`,
`update`, or `delete`, and so on.

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

### hasOperationType

### clearOperationType

### setOperationType

\[Output Only\] The type of operation, such as `insert`,
`update`, or `delete`, and so on.

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

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

### getProgress

\[Output Only\] An optional progress indicator that ranges from 0 to 100.

There is no requirement that this be linear or support any granularity of
operations. This should not be used to guess when the operation will be
complete. This number should monotonically increase as the operation
progresses.

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

### hasProgress

### clearProgress

### setProgress

\[Output Only\] An optional progress indicator that ranges from 0 to 100.

There is no requirement that this be linear or support any granularity of
operations. This should not be used to guess when the operation will be
complete. This number should monotonically increase as the operation
progresses.

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

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

### getRegion

\[Output Only\] The URL of the region where the operation resides. Only
applicable when performing regional operations.

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

### hasRegion

### clearRegion

### setRegion

\[Output Only\] The URL of the region where the operation resides. Only
applicable when performing regional operations.

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

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

### getSelfLink

\[Output Only\] Server-defined URL for the resource.

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

### hasSelfLink

### clearSelfLink

### setSelfLink

\[Output Only\] Server-defined URL for the resource.

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

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

### getSetCommonInstanceMetadataOperationMetadata

Output only. \[Output Only\] If the operation is for projects.setCommonInstanceMetadata,
this field will contain information on all underlying zonal actions and
their state.

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

### hasSetCommonInstanceMetadataOperationMetadata

### clearSetCommonInstanceMetadataOperationMetadata

### setSetCommonInstanceMetadataOperationMetadata

Output only. \[Output Only\] If the operation is for projects.setCommonInstanceMetadata,
this field will contain information on all underlying zonal actions and
their state.

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

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

### getStartTime

\[Output Only\] The time that this operation was started by the server.

This value is inRFC3339
text format.

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

### hasStartTime

### clearStartTime

### setStartTime

\[Output Only\] The time that this operation was started by the server.

This value is inRFC3339
text format.

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

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

### getStatus

\[Output Only\] The status of the operation, which can be one of the
following:
`PENDING`, `RUNNING`, or `DONE`.

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

### hasStatus

### clearStatus

### setStatus

\[Output Only\] The status of the operation, which can be one of the
following:
`PENDING`, `RUNNING`, or `DONE`.

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

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

### getStatusMessage

\[Output Only\] An optional textual description of the current status of the
operation.

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

### hasStatusMessage

### clearStatusMessage

### setStatusMessage

\[Output Only\] An optional textual description of the current status of the
operation.

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

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

### getTargetId

\[Output Only\] The unique target ID, which identifies a specific incarnation
of the target resource.

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

### hasTargetId

### clearTargetId

### setTargetId

\[Output Only\] The unique target ID, which identifies a specific incarnation
of the target resource.

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

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

### getTargetLink

\[Output Only\] The URL of the resource that the operation modifies. For
operations related to creating a snapshot, this points to the disk
that the snapshot was created from.

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

### hasTargetLink

### clearTargetLink

### setTargetLink

\[Output Only\] The URL of the resource that the operation modifies. For
operations related to creating a snapshot, this points to the disk
that the snapshot was created from.

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

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

### getUser

\[Output Only\] User who requested the operation, for example:
`user\@example.com` or
`alice_smith_identifier (global/workforcePools/example-com-us-employees)`.

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

### hasUser

### clearUser

### setUser

\[Output Only\] User who requested the operation, for example:
`user\@example.com` or
`alice_smith_identifier (global/workforcePools/example-com-us-employees)`.

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

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

### getWarnings

\[Output Only\] If warning messages are generated during processing of the
operation, this field will be populated.

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

### setWarnings

\[Output Only\] If warning messages are generated during processing of the
operation, this field will be populated.

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

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

### getZone

\[Output Only\] The URL of the zone where the operation resides. Only
applicable when performing per-zone operations.

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

### hasZone

### clearZone

### setZone

\[Output Only\] The URL of the zone where the operation resides. Only
applicable when performing per-zone operations.

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

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