# Google Cloud Sql Admin V1 Client - Class Operation (1.9.0)

1.9.0 (latest) 1.8.0 1.7.0 1.6.0 1.5.0 1.4.0 1.3.1 1.2.6 1.1.0 1.0.0 0.19.0 0.18.0 0.17.1 0.16.1 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.0 0.4.1 0.3.1 0.2.12 Reference documentation and code samples for the Google Cloud Sql Admin V1 Client class Operation.

An Operation resource. For successful operations that return an
Operation resource, only the fields relevant to the operation are populated
in the resource.

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

## Namespace

Google \\ Cloud \\ Sql \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ kind` | `string` This is always `sql#operation`. |
| `↳ target_link` | `string` |
| `↳ status` | `int` The status of an operation. |
| `↳ user` | `string` The email address of the user who initiated this operation. |
| `↳ insert_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The time this operation was enqueued in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`. |
| `↳ start_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The time this operation actually started in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`. |
| `↳ end_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` The time this operation finished in UTC timezone in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example `2012-11-15T16:19:00.094Z`. |
| `↳ error` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.OperationErrors` If errors occurred during processing of this operation, this field will be populated. |
| `↳ api_warning` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.ApiWarning` An Admin API warning message. |
| `↳ operation_type` | `int` The type of the operation. Valid values are: \* \* `CREATE` \* \* `DELETE` \* \* `UPDATE` \* \* `RESTART` \* \* `IMPORT` \* \* `EXPORT` \* \* `BACKUP_VOLUME` \* \* `RESTORE_VOLUME` \* \* `CREATE_USER` \* \* `DELETE_USER` \* \* `CREATE_DATABASE` \* \* `DELETE_DATABASE` |
| `↳ import_context` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.ImportContext` The context for import operation, if applicable. |
| `↳ export_context` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.ExportContext` The context for export operation, if applicable. |
| `↳ backup_context` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.BackupContext` The context for backup operation, if applicable. |
| `↳ pre_check_major_version_upgrade_context` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.PreCheckMajorVersionUpgradeContext` This field is only populated when the operation_type is PRE_CHECK_MAJOR_VERSION_UPGRADE. The PreCheckMajorVersionUpgradeContext message itself contains the details for that pre-check, such as the target database version for the upgrade and the results of the check (including any warnings or errors found). |
| `↳ name` | `string` An identifier that uniquely identifies the operation. You can use this identifier to retrieve the Operations resource that has information about the operation. |
| `↳ target_id` | `string` Name of the resource on which this operation runs. |
| `↳ self_link` | `string` The URI of this resource. |
| `↳ target_project` | `string` The project ID of the target instance related to this operation. |
| `↳ acquire_ssrs_lease_context` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.AcquireSsrsLeaseContext` The context for acquire SSRS lease operation, if applicable. |
| `↳ sub_operation_type` | `https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.SqlSubOperationType` Optional. The sub operation based on the operation type. |

### getKind

This is always `sql#operation`.

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

### setKind

This is always `sql#operation`.

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

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

### getTargetLink

Generated from protobuf field `string target_link = 2;`

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

### setTargetLink

Generated from protobuf field `string target_link = 2;`

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

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

### getStatus

The status of an operation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [SqlOperationStatus](https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.Operation.SqlOperationStatus). |

### setStatus

The status of an operation.

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

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

### getUser

The email address of the user who initiated this operation.

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

### setUser

The email address of the user who initiated this operation.

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

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

### getInsertTime

The time this operation was enqueued in UTC timezone in [RFC
3339](https://tools.ietf.org/html/rfc3339) format, for example
`2012-11-15T16:19:00.094Z`.

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

### hasInsertTime

### clearInsertTime

### setInsertTime

The time this operation was enqueued in UTC timezone in [RFC
3339](https://tools.ietf.org/html/rfc3339) format, for example
`2012-11-15T16:19:00.094Z`.

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

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

### getStartTime

The time this operation actually started in UTC timezone in [RFC
3339](https://tools.ietf.org/html/rfc3339) format, for example
`2012-11-15T16:19:00.094Z`.

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

### hasStartTime

### clearStartTime

### setStartTime

The time this operation actually started in UTC timezone in [RFC
3339](https://tools.ietf.org/html/rfc3339) format, for example
`2012-11-15T16:19:00.094Z`.

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

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

### getEndTime

The time this operation finished in UTC timezone in [RFC
3339](https://tools.ietf.org/html/rfc3339) format, for example
`2012-11-15T16:19:00.094Z`.

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

### hasEndTime

### clearEndTime

### setEndTime

The time this operation finished in UTC timezone in [RFC
3339](https://tools.ietf.org/html/rfc3339) format, for example
`2012-11-15T16:19:00.094Z`.

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

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

### getError

If errors occurred during processing of this operation, this field will be
populated.

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

### hasError

### clearError

### setError

If errors occurred during processing of this operation, this field will be
populated.

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

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

### getApiWarning

An Admin API warning message.

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

### hasApiWarning

### clearApiWarning

### setApiWarning

An Admin API warning message.

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

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

### getOperationType

The type of the operation. Valid values are:

- `CREATE`
- `DELETE`
- `UPDATE`
- `RESTART`
- `IMPORT`
- `EXPORT`
- `BACKUP_VOLUME`
- `RESTORE_VOLUME`
- `CREATE_USER`
- `DELETE_USER`
- `CREATE_DATABASE`
- `DELETE_DATABASE`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [SqlOperationType](https://docs.cloud.google.com/php/docs/reference/cloud-sql-admin/latest/V1.Operation.SqlOperationType). |

### setOperationType

The type of the operation. Valid values are:

- `CREATE`
- `DELETE`
- `UPDATE`
- `RESTART`
- `IMPORT`
- `EXPORT`
- `BACKUP_VOLUME`
- `RESTORE_VOLUME`
- `CREATE_USER`
- `DELETE_USER`
- `CREATE_DATABASE`
- `DELETE_DATABASE`

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

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

### getImportContext

The context for import operation, if applicable.

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

### hasImportContext

### clearImportContext

### setImportContext

The context for import operation, if applicable.

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

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

### getExportContext

The context for export operation, if applicable.

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

### hasExportContext

### clearExportContext

### setExportContext

The context for export operation, if applicable.

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

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

### getBackupContext

The context for backup operation, if applicable.

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

### hasBackupContext

### clearBackupContext

### setBackupContext

The context for backup operation, if applicable.

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

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

### getPreCheckMajorVersionUpgradeContext

This field is only populated when the operation_type is
PRE_CHECK_MAJOR_VERSION_UPGRADE.

The PreCheckMajorVersionUpgradeContext message itself contains the details
for that pre-check, such as the target database version for the upgrade
and the results of the check (including any warnings or errors found).

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

### hasPreCheckMajorVersionUpgradeContext

### clearPreCheckMajorVersionUpgradeContext

### setPreCheckMajorVersionUpgradeContext

This field is only populated when the operation_type is
PRE_CHECK_MAJOR_VERSION_UPGRADE.

The PreCheckMajorVersionUpgradeContext message itself contains the details
for that pre-check, such as the target database version for the upgrade
and the results of the check (including any warnings or errors found).

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

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

### getName

An identifier that uniquely identifies the operation. You can use this
identifier to retrieve the Operations resource that has information about
the operation.

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

### setName

An identifier that uniquely identifies the operation. You can use this
identifier to retrieve the Operations resource that has information about
the operation.

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

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

### getTargetId

Name of the resource on which this operation runs.

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

### setTargetId

Name of the resource on which this operation runs.

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

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

### getSelfLink

The URI of this resource.

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

### setSelfLink

The URI of this resource.

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

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

### getTargetProject

The project ID of the target instance related to this operation.

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

### setTargetProject

The project ID of the target instance related to this operation.

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

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

### getAcquireSsrsLeaseContext

The context for acquire SSRS lease operation, if applicable.

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

### hasAcquireSsrsLeaseContext

### clearAcquireSsrsLeaseContext

### setAcquireSsrsLeaseContext

The context for acquire SSRS lease operation, if applicable.

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

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

### getSubOperationType

Optional. The sub operation based on the operation type.

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

### hasSubOperationType

### clearSubOperationType

### setSubOperationType

Optional. The sub operation based on the operation type.

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

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