Cloud SQL Admin API Connector Overview

The Workflows connector defines the built-in functions that can be used to access other Google Cloud products within a workflow.

This page provides an overview of the individual connector. There is no need to import or load connector libraries in a workflow—connectors work out of the box when used in a call step.

Cloud SQL Admin API

API for Cloud SQL database instance management To learn more, see the Cloud SQL Admin API documentation.

Cloud SQL Admin connector sample

YAML

# This workflow demonstrates how to use the Cloud SQL connector.
# The workflow creates an SQL instance and an SQL database in the SQL instance.
# Then it deletes the database and the instance. Each of these steps waits
# until the long-running operation of creating or deleting the SQL database completes.
# Expected successful output: "SUCCESS"

- init:
    assign:
      - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
      - instance: "[fill in an instance name]"
      - tier: "db-n1-standard-1"
      - database_name: "[fill in an instance name]"
- create_instance:
    call: googleapis.sqladmin.v1beta4.instances.insert
    args:
      project: ${project}
      body:
        kind: "sql#database"
        settings:
          tier: ${tier}
        project: ${project}
        backendType: "SECOND_GEN"
        name: ${instance}
- create_database:
    call: googleapis.sqladmin.v1beta4.databases.insert
    args:
      project: ${project}
      instance: ${instance}
      body:
        kind: "sql#database"
        charset: "utf8"
        collation: "utf8_general_ci"
        name: ${database_name}
        instance: ${instance}
        project: ${project}
        sqlserverDatabaseDetails:
          compatibilityLevel: 5
          recoveryModel: "Simple"
- get_database:
    call: googleapis.sqladmin.v1beta4.databases.get
    args:
      project: ${project}
      instance: ${instance}
      database: ${database_name}
- delete_database:
    call: googleapis.sqladmin.v1beta4.databases.delete
    args:
      project: ${project}
      instance: ${instance}
      database: ${database_name}
- delete_instance:
    call: googleapis.sqladmin.v1beta4.instances.delete
    args:
      project: ${project}
      instance: ${instance}
- the_end:
    return: "SUCCESS"

JSON

[
  {
    "init": {
      "assign": [
        {
          "project": "${sys.get_env(\"GOOGLE_CLOUD_PROJECT_ID\")}"
        },
        {
          "instance": "[fill in an instance name]"
        },
        {
          "tier": "db-n1-standard-1"
        },
        {
          "database_name": "[fill in an instance name]"
        }
      ]
    }
  },
  {
    "create_instance": {
      "call": "googleapis.sqladmin.v1beta4.instances.insert",
      "args": {
        "project": "${project}",
        "body": {
          "kind": "sql#database",
          "settings": {
            "tier": "${tier}"
          },
          "project": "${project}",
          "backendType": "SECOND_GEN",
          "name": "${instance}"
        }
      }
    }
  },
  {
    "create_database": {
      "call": "googleapis.sqladmin.v1beta4.databases.insert",
      "args": {
        "project": "${project}",
        "instance": "${instance}",
        "body": {
          "kind": "sql#database",
          "charset": "utf8",
          "collation": "utf8_general_ci",
          "name": "${database_name}",
          "instance": "${instance}",
          "project": "${project}",
          "sqlserverDatabaseDetails": {
            "compatibilityLevel": 5,
            "recoveryModel": "Simple"
          }
        }
      }
    }
  },
  {
    "get_database": {
      "call": "googleapis.sqladmin.v1beta4.databases.get",
      "args": {
        "project": "${project}",
        "instance": "${instance}",
        "database": "${database_name}"
      }
    }
  },
  {
    "delete_database": {
      "call": "googleapis.sqladmin.v1beta4.databases.delete",
      "args": {
        "project": "${project}",
        "instance": "${instance}",
        "database": "${database_name}"
      }
    }
  },
  {
    "delete_instance": {
      "call": "googleapis.sqladmin.v1beta4.instances.delete",
      "args": {
        "project": "${project}",
        "instance": "${instance}"
      }
    }
  },
  {
    "the_end": {
      "return": "SUCCESS"
    }
  }
]

Module: googleapis.sqladmin.v1.backupRuns

Functions
delete Deletes the backup taken by a backup run.
get Retrieves a resource containing information about a backup run.
insert Creates a new backup run on demand.
list Lists all backup runs associated with the project or a given instance and configuration in the reverse chronological order of the backup initiation time.

Module: googleapis.sqladmin.v1.connect

Functions
get Retrieves connect settings about a Cloud SQL instance.

Module: googleapis.sqladmin.v1.databases

Functions
delete Deletes a database from a Cloud SQL instance.
get Retrieves a resource containing information about a database inside a Cloud SQL instance.
insert Inserts a resource containing information about a database inside a Cloud SQL instance.
list Lists databases in the specified Cloud SQL instance.
patch Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.
update Updates a resource containing information about a database inside a Cloud SQL instance.

Module: googleapis.sqladmin.v1.flags

Functions
list Lists all available database flags for Cloud SQL instances.

Module: googleapis.sqladmin.v1.instances

Functions
addServerCa Adds a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in.
clone Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.
delete Deletes a Cloud SQL instance.
demoteMaster Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
export Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
failover Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.
get Retrieves a resource containing information about a Cloud SQL instance.
insert Creates a new Cloud SQL instance.
list Lists instances under a given project.
listServerCas Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.
patch Updates settings of a Cloud SQL instance. This method supports patch semantics.
promoteReplica Promotes the read replica instance to be a stand-alone Cloud SQL instance. Using this operation might cause your instance to restart.
resetSslConfig Deletes all client certificates and generates a new server SSL certificate for the instance.
restart Restarts a Cloud SQL instance.
restoreBackup Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.
rotateServerCa Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method.
startReplica Starts the replication in the read replica instance.
stopReplica Stops the replication in the read replica instance.
truncateLog Truncate MySQL general and slow query log tables MySQL only.
update Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.

Module: googleapis.sqladmin.v1.operations

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

Module: googleapis.sqladmin.v1.projects.instances

Functions
rescheduleMaintenance Reschedules the maintenance on the given instance.
startExternalSync Start External primary instance migration.
verifyExternalSyncSettings Verify External primary instance external sync settings.

Module: googleapis.sqladmin.v1.sslCerts

Functions
createEphemeral Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
delete Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.
get Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.
insert Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.
list Lists all of the current SSL certificates for the instance.

Module: googleapis.sqladmin.v1.tiers

Functions
list Lists all available machine types (tiers) for Cloud SQL, for example, db-custom-1-3840. For more information, see https://cloud.google.com/sql/pricing.

Module: googleapis.sqladmin.v1.users

Functions
delete Deletes a user from a Cloud SQL instance.
insert Creates a new user in a Cloud SQL instance.
list Lists users in the specified Cloud SQL instance.
update Updates an existing user in a Cloud SQL instance.

Module: googleapis.sqladmin.v1beta4.backupRuns

Functions
delete Deletes the backup taken by a backup run.
get Retrieves a resource containing information about a backup run.
insert Creates a new backup run on demand.
list Lists all backup runs associated with the project or a given instance and configuration in the reverse chronological order of the backup initiation time.

Module: googleapis.sqladmin.v1beta4.connect

Functions
get Retrieves connect settings about a Cloud SQL instance.

Module: googleapis.sqladmin.v1beta4.databases

Functions
delete Deletes a database from a Cloud SQL instance.
get Retrieves a resource containing information about a database inside a Cloud SQL instance.
insert Inserts a resource containing information about a database inside a Cloud SQL instance.
list Lists databases in the specified Cloud SQL instance.
patch Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.
update Updates a resource containing information about a database inside a Cloud SQL instance.

Module: googleapis.sqladmin.v1beta4.flags

Functions
list Lists all available database flags for Cloud SQL instances.

Module: googleapis.sqladmin.v1beta4.instances

Functions
addServerCa Add a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in.
clone Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.
delete Deletes a Cloud SQL instance.
demoteMaster Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
export Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
failover Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.
get Retrieves a resource containing information about a Cloud SQL instance.
insert Creates a new Cloud SQL instance.
list Lists instances under a given project.
listServerCas Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.
patch Updates settings of a Cloud SQL instance. This method supports patch semantics.
promoteReplica Promotes the read replica instance to be a stand-alone Cloud SQL instance. Using this operation might cause your instance to restart.
resetSslConfig Deletes all client certificates and generates a new server SSL certificate for the instance.
restart Restarts a Cloud SQL instance.
restoreBackup Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.
rotateServerCa Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method.
startReplica Starts the replication in the read replica instance.
stopReplica Stops the replication in the read replica instance.
truncateLog Truncate MySQL general and slow query log tables MySQL only.
update Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.

Module: googleapis.sqladmin.v1beta4.operations

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

Module: googleapis.sqladmin.v1beta4.projects.instances

Functions
rescheduleMaintenance Reschedules the maintenance on the given instance.
startExternalSync Start External primary instance migration.
verifyExternalSyncSettings Verify External primary instance external sync settings.

Module: googleapis.sqladmin.v1beta4.sslCerts

Functions
createEphemeral Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
delete Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.
get Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.
insert Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.
list Lists all of the current SSL certificates for the instance.

Module: googleapis.sqladmin.v1beta4.tiers

Functions
list Lists all available machine types (tiers) for Cloud SQL, for example, db-custom-1-3840. For related information, see Pricing.

Module: googleapis.sqladmin.v1beta4.users

Functions
delete Deletes a user from a Cloud SQL instance.
insert Creates a new user in a Cloud SQL instance.
list Lists users in the specified Cloud SQL instance.
update Updates an existing user in a Cloud SQL instance.