Operations

Represents information about database instance operations such as create, delete, and restart, or any type of long running backend work, such as backups, creating and updating databases. Operations resources are created in response to operations that were initiated; you never create them directly.

For a list of methods for this resource, see the end of this page.

Resource representations

An Operation resource. Note that for successful operations that return an Operation resource, only the fields that are relevant to the operation will be populated in the resource.

{
  "kind": "sql#operation",
  "selfLink": string,
  "targetProject": string,
  "targetId": string,
  "targetLink": string,
  "name": string,
  "operationType": string,
  "status": string,
  "user": string,
  "insertTime": datetime,
  "startTime": datetime,
  "endTime": datetime,
  "error": {
    "kind": "sql#operationErrors",
    "errors": [
      {
        "kind": "sql#operationError",
        "code": string,
        "message": string
      }
    ]
  },
  "importContext": {
    "kind": "sql#importContext",
    "fileType": string,
    "uri": string,
    "database": string,
    "csvImportOptions": {
      "table": string,
      "columns": [
        string
      ]
    }
  },
  "exportContext": {
    "kind": "sql#exportContext",
    "fileType": string,
    "uri": string,
    "databases": [
      string
    ],
    "sqlExportOptions": {
      "tables": [
        string
      ],
      "schemaOnly": boolean
    },
    "csvExportOptions": {
      "selectQuery": string
    }
  }
}
Property name Value Description Notes
endTime datetime The time this operation finished in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
error nested object If errors occurred during processing of this operation, this field will be populated.
error.errors[] list The list of errors encountered while processing this operation.
error.errors[].code string Identifies the specific error that occurred.
error.errors[].kind string This is always sql#operationError.
error.errors[].message string Additional information about the error encountered.
error.kind string This is always sql#operationErrors.
exportContext nested object The context for export operation, if applicable.
exportContext.csvExportOptions object Options for exporting data as CSV.
exportContext.csvExportOptions.selectQuery string The select query used to extract the data.
exportContext.databases[] list Databases (for example, guestbook) from which the export is made. If fileType is SQL and no database is specified, all databases are exported. If fileType is CSV, you can optionally specify at most one database to export. If csvExportOptions.selectQuery also specifies the database, this field will be ignored.
exportContext.fileType string The file type for the specified uri.
SQL: The file contains SQL statements.
CSV: The file contains CSV data.
exportContext.kind string This is always sql#exportContext.
exportContext.sqlExportOptions object Options for exporting data as SQL statements.
exportContext.sqlExportOptions.schemaOnly boolean Export only schemas.
exportContext.sqlExportOptions.tables[] list Tables to export, or that were exported, from the specified database. If you specify tables, specify one and only one database.
exportContext.uri string The path to the file in Google Cloud Storage where the export will be stored. The URI is in the form gs://bucketName/fileName. If the file already exists, the operation fails. If fileType is SQL and the filename ends with .gz, the contents are compressed.
importContext nested object The context for import operation, if applicable.
importContext.csvImportOptions object Options for importing data as CSV.
importContext.csvImportOptions.columns[] list The columns to which CSV data is imported. If not specified, all columns of the database table are loaded with CSV data.
importContext.csvImportOptions.table string The table to which CSV data is imported.
importContext.database string The database (for example, guestbook) to which the import is made. If fileType is SQL and no database is specified, it is assumed that the database is specified in the file to be imported. If fileType is CSV, it must be specified.
importContext.fileType string The file type for the specified uri.
SQL: The file contains SQL statements.
CSV: The file contains CSV data.
importContext.kind string This is always sql#importContext.
importContext.uri string A path to the file in Google Cloud Storage from which the import is made. The URI is in the form gs://bucketName/fileName. Compressed gzip files (.gz) are supported when fileType is SQL.
insertTime datetime The time this operation was enqueued in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
kind string This is always sql#operation.
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.
operationType string 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 .
startTime datetime The time this operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
status string The status of an operation. Valid values are PENDING, RUNNING, DONE, UNKNOWN.
targetId string Name of the database instance related to this operation.
targetProject string The project ID of the target instance related to this operation.
user string The email address of the user who initiated this operation.

Methods

get
Retrieves an instance operation that has been performed on an instance.
list
Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.

Send feedback about...

Cloud SQL Documentation