REST Resource: operations

Resource: Operation

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

JSON representation
{
  "kind": string,
  "targetLink": string,
  "status": enum (SqlOperationStatus),
  "user": string,
  "insertTime": string,
  "startTime": string,
  "endTime": string,
  "error": {
    object (OperationErrors)
  },
  "apiWarning": {
    object (ApiWarning)
  },
  "operationType": enum (SqlOperationType),
  "importContext": {
    object (ImportContext)
  },
  "exportContext": {
    object (ExportContext)
  },
  "backupContext": {
    object (BackupContext)
  },
  "preCheckMajorVersionUpgradeContext": {
    object (PreCheckMajorVersionUpgradeContext)
  },
  "name": string,
  "targetId": string,
  "selfLink": string,
  "targetProject": string,
  "acquireSsrsLeaseContext": {
    object (AcquireSsrsLeaseContext)
  },
  "subOperationType": {
    object (SqlSubOperationType)
  }
}
Fields
kind

string

This is always sql#operation.

status

enum (SqlOperationStatus)

The status of an operation.

user

string

The email address of the user who initiated this operation.

insertTime

string (Timestamp format)

The time this operation was enqueued in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

startTime

string (Timestamp format)

The time this operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

endTime

string (Timestamp format)

The time this operation finished in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

error

object (OperationErrors)

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

apiWarning

object (ApiWarning)

An Admin API warning message.

operationType

enum (SqlOperationType)

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

importContext

object (ImportContext)

The context for import operation, if applicable.

exportContext

object (ExportContext)

The context for export operation, if applicable.

backupContext

object (BackupContext)

The context for backup operation, if applicable.

preCheckMajorVersionUpgradeContext

object (PreCheckMajorVersionUpgradeContext)

The context for pre-check major version upgrade operation, if applicable. This field is only populated when the operationType 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.

targetId

string

Name of the resource on which this operation runs.

targetProject

string

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

acquireSsrsLeaseContext

object (AcquireSsrsLeaseContext)

The context for acquire SSRS lease operation, if applicable.

subOperationType

object (SqlSubOperationType)

Optional. The sub operation based on the operation type.

SqlOperationStatus

The status of an operation.

Enums
SQL_OPERATION_STATUS_UNSPECIFIED The state of the operation is unknown.
PENDING The operation has been queued, but has not started yet.
RUNNING The operation is running.
DONE The operation completed.

OperationErrors

Database instance operation errors list wrapper.

JSON representation
{
  "kind": string,
  "errors": [
    {
      object (OperationError)
    }
  ]
}
Fields
kind

string

This is always sql#operationErrors.

errors[]

object (OperationError)

The list of errors encountered while processing this operation.

ApiWarning

An Admin API warning message.

JSON representation
{
  "code": enum (SqlApiWarningCode),
  "message": string,
  "region": string
}
Fields
code

enum (SqlApiWarningCode)

Code to uniquely identify the warning type.

message

string

The warning message.

region

string

The region name for REGION_UNREACHABLE warning.

SqlApiWarningCode

Enums
SQL_API_WARNING_CODE_UNSPECIFIED An unknown or unset warning type from Cloud SQL API.
REGION_UNREACHABLE Warning when one or more regions are not reachable. The returned result set may be incomplete.
MAX_RESULTS_EXCEEDS_LIMIT Warning when user provided maxResults parameter exceeds the limit. The returned result set may be incomplete.
COMPROMISED_CREDENTIALS Warning when user tries to create/update a user with credentials that have previously been compromised by a public data breach.
INTERNAL_STATE_FAILURE Warning when the operation succeeds but some non-critical workflow state failed.

SqlOperationType

The type of Cloud SQL operation.

Enums
SQL_OPERATION_TYPE_UNSPECIFIED Unknown operation type.
IMPORT Imports data into a Cloud SQL instance.
EXPORT Exports data from a Cloud SQL instance to a Cloud Storage bucket.
CREATE Creates a new Cloud SQL instance.
UPDATE Updates the settings of a Cloud SQL instance.
DELETE Deletes a Cloud SQL instance.
RESTART Restarts the Cloud SQL instance.
BACKUP
SNAPSHOT
BACKUP_VOLUME Performs instance backup.
DELETE_VOLUME Deletes an instance backup.
RESTORE_VOLUME Restores an instance backup.
INJECT_USER Injects a privileged user in mysql for MOB instances.
CLONE Clones a Cloud SQL instance.
STOP_REPLICA Stops replication on a Cloud SQL read replica instance.
START_REPLICA Starts replication on a Cloud SQL read replica instance.
PROMOTE_REPLICA Promotes a Cloud SQL replica instance.
CREATE_REPLICA Creates a Cloud SQL replica instance.
CREATE_USER Creates a new user in a Cloud SQL instance.
DELETE_USER Deletes a user from a Cloud SQL instance.
UPDATE_USER Updates an existing user in a Cloud SQL instance. If a user with the specified username doesn't exist, a new user is created.
CREATE_DATABASE Creates a database in the Cloud SQL instance.
DELETE_DATABASE Deletes a database in the Cloud SQL instance.
UPDATE_DATABASE Updates a database in the Cloud SQL instance.
FAILOVER Performs failover of an HA-enabled Cloud SQL failover replica.
DELETE_BACKUP Deletes the backup taken by a backup run.
RECREATE_REPLICA
TRUNCATE_LOG Truncates a general or slow log table in MySQL.
DEMOTE_MASTER Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
MAINTENANCE Indicates that the instance is currently in maintenance. Maintenance typically causes the instance to be unavailable for 1-3 minutes.
ENABLE_PRIVATE_IP

This field is deprecated, and will be removed in future version of API.

DEFER_MAINTENANCE
CREATE_CLONE

Creates clone instance.

RESCHEDULE_MAINTENANCE Reschedule maintenance to another time.
START_EXTERNAL_SYNC Starts external sync of a Cloud SQL EM replica to an external primary instance.
LOG_CLEANUP Recovers logs from an instance's old data disk.
AUTO_RESTART Performs auto-restart of an HA-enabled Cloud SQL database for auto recovery.
REENCRYPT Re-encrypts CMEK instances with latest key version.
SWITCHOVER Switches the roles of the primary and replica pair. The target instance should be the replica.
UPDATE_BACKUP Update a backup.
ACQUIRE_SSRS_LEASE Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
RELEASE_SSRS_LEASE Release a lease for the setup of SQL Server Reporting Services (SSRS).
RECONFIGURE_OLD_PRIMARY Reconfigures old primary after a promote replica operation. Effect of a promote operation to the old primary is executed in this operation, asynchronously from the promote replica operation executed to the replica.
CLUSTER_MAINTENANCE

Indicates that the instance, its read replicas, and its cascading replicas are in maintenance. Maintenance typically gets initiated on groups of replicas first, followed by the primary instance. For each instance, maintenance typically causes the instance to be unavailable for 1-3 minutes.

SELF_SERVICE_MAINTENANCE

Indicates that the instance (and any of its replicas) are currently in maintenance. This is initiated as a self-service request by using SSM. Maintenance typically causes the instance to be unavailable for 1-3 minutes.

SWITCHOVER_TO_REPLICA Switches a primary instance to a replica. This operation runs as part of a switchover operation to the original primary instance.
MAJOR_VERSION_UPGRADE Updates the major version of a Cloud SQL instance.
ADVANCED_BACKUP

Deprecated: ADVANCED_BACKUP is deprecated. Use ENHANCED_BACKUP instead.

MANAGE_BACKUP Changes the BackupTier of a Cloud SQL instance.
ENHANCED_BACKUP Creates a backup for an Enhanced BackupTier Cloud SQL instance.
REPAIR_READ_POOL Repairs entire read pool or specified read pool nodes in the read pool.
CREATE_READ_POOL Creates a Cloud SQL read pool instance.
PRE_CHECK_MAJOR_VERSION_UPGRADE Pre-checks for major version upgrade.
SETUP_MIGRATION This operation type represents individual steps in a multi-step setup migration workflow: including configuration, replication, switchover/back, and data reseeding, as defined by operation's intent.
AGENT_SEND_MESSAGE Sends a message to a Cloud SQL agent.

ImportContext

Database instance import context.

JSON representation
{
  "uri": string,
  "database": string,
  "kind": string,
  "fileType": enum (SqlFileType),
  "csvImportOptions": {
    "table": string,
    "columns": [
      string
    ],
    "escapeCharacter": string,
    "quoteCharacter": string,
    "fieldsTerminatedBy": string,
    "linesTerminatedBy": string
  },
  "importUser": string,
  "bakImportOptions": {
    "encryptionOptions": {
      "certPath": string,
      "pvkPath": string,
      "pvkPassword": string,
      "keepEncrypted": boolean
    },
    "striped": boolean,
    "noRecovery": boolean,
    "recoveryOnly": boolean,
    "bakType": enum (BakType),
    "stopAt": string,
    "stopAtMark": string
  },
  "sqlImportOptions": {
    "threads": integer,
    "parallel": boolean,
    "postgresImportOptions": {
      "clean": boolean,
      "ifExists": boolean
    }
  },
  "tdeImportOptions": {
    "certificatePath": string,
    "privateKeyPath": string,
    "privateKeyPassword": string,
    "name": string
  }
}
Fields
uri

string

Path to the import file in Cloud Storage, in the form gs://bucketName/fileName. Compressed gzip files (.gz) are supported when fileType is SQL. The instance must have write permissions to the bucket and read access to the file.

database

string

The target database for the import. If fileType is SQL, this field is required only if the import file does not specify a database, and is overridden by any database specification in the import file. For entire instance parallel import operations, the database is overridden by the database name stored in subdirectory name. If fileType is CSV, one database must be specified.

kind

string

This is always sql#importContext.

fileType

enum (SqlFileType)

The file type for the specified uri. * SQL: The file contains SQL statements. * CSV: The file contains CSV data. * BAK: The file contains backup data for a SQL Server instance.

csvImportOptions

object

Options for importing data as CSV.

csvImportOptions.table

string

The table to which CSV data is imported.

csvImportOptions.columns[]

string

The columns to which CSV data is imported. If not specified, all columns of the database table are loaded with CSV data.

csvImportOptions.escapeCharacter

string

Specifies the character that should appear before a data character that needs to be escaped.

csvImportOptions.quoteCharacter

string

Specifies the quoting character to be used when a data value is quoted.

csvImportOptions.fieldsTerminatedBy

string

Specifies the character that separates columns within each row (line) of the file.

csvImportOptions.linesTerminatedBy

string

This is used to separate lines. If a line does not contain all fields, the rest of the columns are set to their default values.

importUser

string

The PostgreSQL user for this import operation. PostgreSQL instances only.

bakImportOptions

object

Import parameters specific to SQL Server .BAK files

bakImportOptions.encryptionOptions

object

bakImportOptions.encryptionOptions.certPath

string

Path to the Certificate (.cer) in Cloud Storage, in the form gs://bucketName/fileName. The instance must have write permissions to the bucket and read access to the file.

bakImportOptions.encryptionOptions.pvkPath

string

Path to the Certificate Private Key (.pvk) in Cloud Storage, in the form gs://bucketName/fileName. The instance must have write permissions to the bucket and read access to the file.

bakImportOptions.encryptionOptions.pvkPassword

string

Password that encrypts the private key

bakImportOptions.encryptionOptions.keepEncrypted

boolean

Optional. Whether the imported file remains encrypted.

bakImportOptions.striped

boolean

Whether or not the backup set being restored is striped. Applies only to Cloud SQL for SQL Server.

bakImportOptions.noRecovery

boolean

Whether or not the backup importing will restore database with NORECOVERY option. Applies only to Cloud SQL for SQL Server.

bakImportOptions.recoveryOnly

boolean

Whether or not the backup importing request will just bring database online without downloading Bak content only one of "noRecovery" and "recoveryOnly" can be true otherwise error will return. Applies only to Cloud SQL for SQL Server.

bakImportOptions.bakType