REST Resource: blueGreenDeployments

Resource: BlueGreenDeployment

A BlueGreenDeployment resource represents a Cloud SQL blue-green deployment setup. It orchestrates the lifecycle of creating a synchronized "green" environment from a "blue" production environment, performing updates, and managing the switchover process to minimize downtime.

JSON representation
{
  "name": string,
  "description": string,
  "createTime": string,
  "state": enum (State),
  "sourceInstance": string,
  "targetConfig": {
    object (TargetConfig)
  },
  "switchoverTargetInstance": string,
  "pairedNodes": [
    {
      object (SourceTargetPairedNode)
    }
  ],
  "errorDetail": string,
  "deploymentMappings": [
    {
      object (SourceTargetPairedNode)
    }
  ],
  "deploymentTasks": {
    object (DeploymentTasks)
  },
  "requestedConfig": {
    object (RequestedConfig)
  }
}
Fields
name

string

Output only. Identifier. The full resource name of the deployment. Format: projects/{project}/locations/{location}/blueGreenDeployments/{deploymentId}

description

string

Optional. User-provided description for the deployment.

createTime

string (Timestamp format)

Output only. The time when the deployment was created.

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".

state

enum (State)

Output only. The current state of the blue-green deployment.

sourceInstance

string

Required. Immutable. The instance ID of the source instance (the "blue" instance). The value for this field does not include the project ID, for example, my-instance-id. This field is immutable.

targetConfig
(deprecated)

object (TargetConfig)

Optional. Immutable. Deprecated: Use requestedConfig instead. The configuration intended for the target instance(s) when the deployment was created. This field is immutable.

switchoverTargetInstance

string

Output only. Details about the primary target instance (the "Green" instance) that will be promoted during switchover.

pairedNodes[]
(deprecated)

object (SourceTargetPairedNode)

Output only. Deprecated: Use deploymentMappings instead. Output only. A list representing the pairs of source and target instances in the deployment.

errorDetail

string

Output only. Provides an error message with details on why switchover is not possible.

deploymentMappings[]

object (SourceTargetPairedNode)

Output only. A list representing the pairs of source and target instances in the deployment.

deploymentTasks

object (DeploymentTasks)

Output only. Combined list of tasks for all paired nodes.

requestedConfig

object (RequestedConfig)

Optional. Immutable. Optional on create, and immutable. The configuration intended for the target instance(s) when the deployment was created.

State

The state of the blue-green deployment. This enum is not frozen, and new values may be added in the future.

Enums
STATE_UNSPECIFIED The state of the deployment is unknown.
PROVISIONING The deployment is being provisioned.
SWITCHOVER_READY The deployment is ready for switchover.
SWITCHOVER_NOT_READY The deployment is not ready for switchover.
SWITCHOVER_IN_PROGRESS The deployment is in the process of switching over.
SWITCHOVER_COMPLETED The deployment has completed switchover.
DELETING The deployment is being deleted.

TargetConfig

Deprecated: Use RequestedConfig instead. Configuration specified by the user at creation time for the target (Green) instance.

JSON representation
{
  "databaseVersion": string
}
Fields
databaseVersion

string

Optional. The target database major version for the upgrade.

SourceTargetPairedNode

Represents a pairing of a source instance node and a target instance node.

JSON representation
{
  "source": {
    object (NodeInfo)
  },
  "target": {
    object (NodeInfo)
  },
  "state": enum (State),
  "currentlyServingTraffic": enum (CurrentlyServingTraffic),
  "tasks": [
    {
      object (DeploymentTask)
    }
  ],
  "diffs": [
    {
      object (ConfigDiff)
    }
  ]
}
Fields
source

object (NodeInfo)

Output only. Resource name of the source instance in this pair.

target

object (NodeInfo)

Output only. Details of the corresponding target instance in this pair.

state

enum (State)

Output only. The current state of this specific source-target pair.

currentlyServingTraffic
(deprecated)

enum (CurrentlyServingTraffic)

Output only. Deprecated: Indicates which instance (SOURCE or TARGET) in the pair is currently live. Used for internal implementation and deprecated for external use.

tasks[]

object (DeploymentTask)

Output only. Tasks performed or being performed on the target instance of this pair.

diffs[]

object (ConfigDiff)

Output only. Describes the list of differences for this pair.

NodeInfo

Details about an instance within the deployment.

JSON representation
{
  "instance": string,
  "connection": string,
  "dns": string,
  "ipMappings": [
    {
      object (IpMapping)
    }
  ]
}
Fields
instance

string

Output only. The full resource name of the instance. Format: projects/{project}/instances/{instance}

connection

string

Output only. The instance connection name.

dns

string

Output only. The unique DNS name for this instance.

ipMappings[]

object (IpMapping)

Output only. The list of IP addresses for this instance.

State

The state of a pair of source and target instances in deployment (paired node).

Enums
STATE_UNSPECIFIED The state of the paired node is unknown.
PROVISIONING The paired node is being provisioned.
PROVISIONED The paired node is provisioned.
UPGRADING The paired node is upgrading.
UPGRADED The paired node is upgraded.
UPGRADE_FAILED Upgrade failed on the paired node.
SWITCHOVER_IN_PROGRESS Switchover is in progress.
SWITCHOVER_FAILED Switchover failed on the paired node.
SWITCHOVER_SUCCEEDED Switchover completed successfully.
DELETING The paired node is being deleted.

CurrentlyServingTraffic

The instance currently serving traffic.

Enums
CURRENTLY_SERVING_TRAFFIC_UNSPECIFIED The instance serving traffic is unknown.
SOURCE The source instance is serving traffic.
TARGET The target instance is serving traffic.

DeploymentTask

Represents a task executed as part of the deployment on a target instance.

JSON representation
{
  "type": enum (Type),
  "state": enum (State),
  "startTime": string,
  "endTime": string,
  "errorMessage": string
}
Fields
type

enum (Type)

Output only. The type of the task.

state

enum (State)

Output only. The current state of the task.

startTime

string (Timestamp format)

Output only. Task start time.

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)

Output only. Task end time (if completed).

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".

errorMessage

string

Output only. Optional Error details if the task state is FAILED.

Type

The type of the task. This enum is not frozen, and new values may be added in the future.

Enums
TYPE_UNSPECIFIED The default value. This value is used if the type is omitted.
PROVISION Creating target instance.
UPGRADE e.g., Major Version Upgrade on Target.
SWITCHOVER Promoting Target, Demoting Source for this pair.
DELETE The task is to delete deployment.
POST_SWITCHOVER_OPERATIONS Post-switchover operations, including cleaning up resources of the old instance, taking final backups, and updating metadata.

State

The state of the task. This enum is not frozen, and new values may be added in the future.

Enums
STATE_UNSPECIFIED The state of the task is unknown.
PENDING The task is pending.
RUNNING The task is running.
SUCCEEDED The task has succeeded.
FAILED The task has failed.

ConfigDiff

Represents a specific configuration difference between Blue and Green instances.

JSON representation
{
  "field": string,
  "sourceValue": string,
  "targetValue": string
}
Fields
field

string

Output only. The name of the field that differs, fully-qualified. Example: settings.tier

sourceValue

string

Output only. The value on the source instance.

targetValue

string

Output only. The value on the target instance.

DeploymentTasks

Combined list of tasks for all paired nodes in the deployment.

JSON representation
{
  "task": [
    {
      object (DeploymentTask)
    }
  ]
}
Fields
task[]

object (DeploymentTask)

Output only. Tasks performed or being performed on the paired nodes of the deployment at a consolidated level.

RequestedConfig

Configuration specified by the user at creation time for the target (Green) instance.

JSON representation
{
  "databaseVersion": string
}
Fields
databaseVersion

string

Optional. The target database major version for the upgrade.

Methods

create

Creates a blue-green deployment under a given project and location.

delete

Deletes a blue-green deployment, including metadata and underlying resources based on the deployment state.

get

Retrieves a blue-green deployment resource under a given project and location.

list

Lists blue-green deployments under a given project.

switchover

Switches over to green instance for a blue-green deployment.