Skip to content
Proud to collaborate with Microsoft for Startups

gcp.sql.backup.restore ​

Restore a Cloud SQL backup run into a target instance; overwrites the target in place.

Restore a Cloud SQL backup run into a target instance (destructive).

wait_for_completion is NOT redundant with gcp.sql.operation.wait — do not delete it as a duplicate. In a forward DAG layer you should keep the default (false) and chain gcp.sql.operation.wait on operation_name, because forward layers with a data dependency run sequentially.

Saga COMPENSATION is different: the engine starts every step of a compensation block in PARALLEL, against a single context snapshot taken before any of them run (ltinteg_workflow/core/dag.py: "compensate: Optional list of Step objects to run (in parallel) if this layer or any later layer fails", plus the for step in next_layer.effective_compensate(new_data) loop in core/dag_workflow.py, which builds one comp_ctx up front and starts every step against it). A compensation block of [backup.restore, operation.wait] therefore cannot work: the waiter's operation_name mapping resolves against a snapshot that does not yet contain the restore's output.

Because a restore is destructive, takes the instance offline, and a merely SUBMITTED restore is not a completed recovery, the restore step itself has to be able to block. That is what this flag is for.

Overview ​

PropertyValue
Workflow typeLinear
LibraryBase-gcp
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidYes—GCP CloudConnection UUID.
project_idstringNo—GCP project override.
regionstringNo—Cloud SQL region used for credential scoping.
instance_idstringYes—Target Cloud SQL instance restored into (overwritten).
backup_run_idstringYes—Backup run id to restore.
source_instance_idstringNo—Instance the backup was taken from; defaults to instance_id.
source_project_idstringNo—Project of the source instance; defaults to the target project.
wait_for_completionbooleanNo—Block until the restore operation reaches DONE. Defaults to false (submit only). Required in saga compensation, where a separate waiter step cannot be chained.
poll_interval_secondsintegerNo—Poll interval when wait_for_completion is true.
timeout_secondsintegerNo—Maximum wait time when wait_for_completion is true.

Output Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidNo—Echoed connection UUID.
project_idstringNo—Effective project.
regionstringNo—Cloud SQL region used for credential scoping.
instance_idstringNo—Target Cloud SQL instance restored into.
backup_run_idstringNo—Backup run id restored.
source_instance_idstringNo—Instance the backup was taken from.
source_project_idstringNo—Project of the source instance.
wait_for_completionbooleanNo—Whether the run was asked to block until the restore finished.
poll_interval_secondsintegerNo—Poll interval used while waiting.
timeout_secondsintegerNo—Maximum wait time used while waiting.
operation_namestringNo—Cloud SQL restore operation id; feed to gcp.sql.operation.wait when not waiting inline.
waited_for_completionbooleanNo—True when this run polled the operation to a terminal status.
statusstringNo—Operation status: terminal (DONE) when waited, submit-time status otherwise.
operation_typestringNo—Operation type (RESTORE_VOLUME).
operation_end_timestringNo—Provider operation endTime; present once the restore reached DONE.
operationjsonNo—Sanitized operation response (terminal payload when waited).
failure_reasonstringNo—Human-readable failure reason.
failed_stepstringNo—Failed logical step.
failed_layerjsonNo—Engine failed layer.
failed_at_statestringNo—State where failure occurred.
errorstringNo—Error message.
error_typestringNo—Error class.

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—execute—
restoringNoNo—complete—
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecuterestoring—
restoringcompletecompleted—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "gcp.sql.backup.restore",
  "initial_data": {
    "connection_uuid": "value",
    "instance_id": "value",
    "backup_run_id": "value"
  }
}