Class v1.SqlInstancesServiceClient (0.11.0)

Service to manage Cloud SQL instances. v1

Package

@google-cloud/sql

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of SqlInstancesServiceClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new SqlInstancesServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

locationsClient

locationsClient: LocationsClient;

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

sqlInstancesServiceStub

sqlInstancesServiceStub?: Promise<{
        [name: string]: Function;
    }>;

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

acquireSsrsLease(request, options)

acquireSsrsLease(request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse,
        (protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest | undefined),
        {} | undefined
    ]>;

Acquire a lease for the setup of SQL Server Reporting Services (SSRS).

Parameters
Name Description
request ISqlInstancesAcquireSsrsLeaseRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, (protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SqlInstancesAcquireSsrsLeaseResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Cloud SQL instance ID. This doesn't include the project ID. It's
   *  composed of lowercase letters, numbers, and hyphens, and it must start with
   *  a letter. The total length must be 98 characters or less (Example:
   *  instance-id).
   */
  // const instance = 'abc123'
  /**
   *  Required. Project ID of the project that contains the instance (Example:
   *  project-id).
   */
  // const project = 'my-project'
  /**
   *  Required. The request body.
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callAcquireSsrsLease() {
    // Construct request
    const request = {
      instance,
      project,
      body,
    };

    // Run request
    const response = await sqlClient.acquireSsrsLease(request);
    console.log(response);
  }

  callAcquireSsrsLease();

acquireSsrsLease(request, options, callback)

acquireSsrsLease(request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesAcquireSsrsLeaseRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

acquireSsrsLease(request, callback)

acquireSsrsLease(request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesAcquireSsrsLeaseRequest
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

addServerCa(request, options)

addServerCa(request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | undefined,
        {} | undefined
    ]>;

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.

Parameters
Name Description
request ISqlInstancesAddServerCaRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callAddServerCa() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.addServerCa(request);
    console.log(response);
  }

  callAddServerCa();

addServerCa(request, options, callback)

addServerCa(request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesAddServerCaRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

addServerCa(request, callback)

addServerCa(request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesAddServerCaRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

clone(request, options)

clone(request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined,
        {} | undefined
    ]>;

Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.

Parameters
Name Description
request ISqlInstancesCloneRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The ID of the Cloud SQL instance to be cloned (source). This does not
   *  include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the source as well as the clone Cloud SQL instance.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callClone() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.clone(request);
    console.log(response);
  }

  callClone();

clone(request, options, callback)

clone(request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesCloneRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

clone(request, callback)

clone(request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesCloneRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

createEphemeral(request, options)

createEphemeral(request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.ISslCert,
        (protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest | undefined),
        {} | undefined
    ]>;

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.

Parameters
Name Description
request ISqlInstancesCreateEphemeralCertRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.ISslCert, (protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SslCert. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the Cloud SQL project.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callCreateEphemeral() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.createEphemeral(request);
    console.log(response);
  }

  callCreateEphemeral();

createEphemeral(request, options, callback)

createEphemeral(request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.ISslCert, protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesCreateEphemeralCertRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.ISslCert, protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createEphemeral(request, callback)

createEphemeral(request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, callback: Callback<protos.google.cloud.sql.v1.ISslCert, protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesCreateEphemeralCertRequest
callback Callback<protos.google.cloud.sql.v1.ISslCert, protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

delete(request, options)

delete(request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined,
        {} | undefined
    ]>;

Deletes a Cloud SQL instance.

Parameters
Name Description
request ISqlInstancesDeleteRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance to be deleted.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callDelete() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.delete(request);
    console.log(response);
  }

  callDelete();

delete(request, options, callback)

delete(request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesDeleteRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

delete(request, callback)

delete(request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesDeleteRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

demote(request, options)

demote(request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined,
        {} | undefined
    ]>;

Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.

Parameters
Name Description
request ISqlInstancesDemoteRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Cloud SQL instance name.
   */
  // const instance = 'abc123'
  /**
   *  Required. ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   *  Required. The request body.
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callDemote() {
    // Construct request
    const request = {
      instance,
      project,
      body,
    };

    // Run request
    const response = await sqlClient.demote(request);
    console.log(response);
  }

  callDemote();

demote(request, options, callback)

demote(request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesDemoteRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

demote(request, callback)

demote(request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesDemoteRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

demoteMaster(request, options)

demoteMaster(request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | undefined,
        {} | undefined
    ]>;

Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.

Parameters
Name Description
request ISqlInstancesDemoteMasterRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance name.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callDemoteMaster() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.demoteMaster(request);
    console.log(response);
  }

  callDemoteMaster();

demoteMaster(request, options, callback)

demoteMaster(request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesDemoteMasterRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

demoteMaster(request, callback)

demoteMaster(request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesDemoteMasterRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

export(request, options)

export(request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined,
        {} | undefined
    ]>;

Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.

Parameters
Name Description
request ISqlInstancesExportRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance to be exported.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callExport() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.export(request);
    console.log(response);
  }

  callExport();

export(request, options, callback)

export(request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesExportRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

export(request, callback)

export(request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesExportRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

failover(request, options)

failover(request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined,
        {} | undefined
    ]>;

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](https://cloud.google.com/sql/docs/mysql/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.

Parameters
Name Description
request ISqlInstancesFailoverRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the read replica.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callFailover() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.failover(request);
    console.log(response);
  }

  callFailover();

failover(request, options, callback)

failover(request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesFailoverRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

failover(request, callback)

failover(request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesFailoverRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

get(request, options)

get(request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IDatabaseInstance,
        protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined,
        {} | undefined
    ]>;

Retrieves a resource containing information about a Cloud SQL instance.

Parameters
Name Description
request ISqlInstancesGetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IDatabaseInstance, protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Database instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callGet() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.get(request);
    console.log(response);
  }

  callGet();

get(request, options, callback)

get(request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IDatabaseInstance, protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesGetRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IDatabaseInstance, protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

get(request, callback)

get(request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, callback: Callback<protos.google.cloud.sql.v1.IDatabaseInstance, protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesGetRequest
callback Callback<protos.google.cloud.sql.v1.IDatabaseInstance, protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getDiskShrinkConfig(request, options)

getDiskShrinkConfig(request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse,
        (protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest | undefined),
        {} | undefined
    ]>;

Get Disk Shrink Config for a given instance.

Parameters
Name Description
request ISqlInstancesGetDiskShrinkConfigRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, (protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SqlInstancesGetDiskShrinkConfigResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callGetDiskShrinkConfig() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.getDiskShrinkConfig(request);
    console.log(response);
  }

  callGetDiskShrinkConfig();

getDiskShrinkConfig(request, options, callback)

getDiskShrinkConfig(request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesGetDiskShrinkConfigRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getDiskShrinkConfig(request, callback)

getDiskShrinkConfig(request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesGetDiskShrinkConfigRequest
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLatestRecoveryTime(request, options)

getLatestRecoveryTime(request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse,
        (protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest | undefined),
        {} | undefined
    ]>;

Get Latest Recovery Time for a given instance.

Parameters
Name Description
request ISqlInstancesGetLatestRecoveryTimeRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, (protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SqlInstancesGetLatestRecoveryTimeResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callGetLatestRecoveryTime() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.getLatestRecoveryTime(request);
    console.log(response);
  }

  callGetLatestRecoveryTime();

getLatestRecoveryTime(request, options, callback)

getLatestRecoveryTime(request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesGetLatestRecoveryTimeRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLatestRecoveryTime(request, callback)

getLatestRecoveryTime(request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesGetLatestRecoveryTimeRequest
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
Name Description
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
Promise<google.cloud.location.ILocation>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

const [response] = await client.getLocation(request);

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

import(request, options)

import(request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined,
        {} | undefined
    ]>;

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.

Parameters
Name Description
request ISqlInstancesImportRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callImport() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.import(request);
    console.log(response);
  }

  callImport();

import(request, options, callback)

import(request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesImportRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

import(request, callback)

import(request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesImportRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

insert(request, options)

insert(request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined,
        {} | undefined
    ]>;

Creates a new Cloud SQL instance.

Parameters
Name Description
request ISqlInstancesInsertRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Project ID of the project to which the newly created Cloud SQL instances
   *  should belong.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callInsert() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.insert(request);
    console.log(response);
  }

  callInsert();

insert(request, options, callback)

insert(request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesInsertRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

insert(request, callback)

insert(request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesInsertRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

list(request, options)

list(request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IInstancesListResponse,
        protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined,
        {} | undefined
    ]>;

Lists instances under a given project.

Parameters
Name Description
request ISqlInstancesListRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IInstancesListResponse, protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing InstancesListResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A filter expression that filters resources listed in the response.
   *  The expression is in the form of field:value. For example,
   *  'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per
   *  their JSON representation, such as 'settings.userLabels.auto_start:true'.
   *  Multiple filter queries are space-separated. For example.
   *  'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each
   *  expression is an AND expression. However, you can include AND and OR
   *  expressions explicitly.
   */
  // const filter = 'abc123'
  /**
   *  The maximum number of instances to return. The service may return fewer
   *  than this value.
   *  If unspecified, at most 500 instances are returned.
   *  The maximum value is 1000; values above 1000 are coerced to 1000.
   */
  // const maxResults = 1234
  /**
   *  A previously-returned page token representing part of the larger set of
   *  results to view.
   */
  // const pageToken = 'abc123'
  /**
   *  Project ID of the project for which to list Cloud SQL instances.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callList() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.list(request);
    console.log(response);
  }

  callList();

list(request, options, callback)

list(request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IInstancesListResponse, protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesListRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IInstancesListResponse, protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

list(request, callback)

list(request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, callback: Callback<protos.google.cloud.sql.v1.IInstancesListResponse, protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesListRequest
callback Callback<protos.google.cloud.sql.v1.IInstancesListResponse, protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

listServerCas(request, options)

listServerCas(request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IInstancesListServerCasResponse,
        protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | undefined,
        {} | undefined
    ]>;

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.

Parameters
Name Description
request ISqlInstancesListServerCasRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IInstancesListServerCasResponse, protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing InstancesListServerCasResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callListServerCas() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.listServerCas(request);
    console.log(response);
  }

  callListServerCas();

listServerCas(request, options, callback)

listServerCas(request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IInstancesListServerCasResponse, protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesListServerCasRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IInstancesListServerCasResponse, protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

listServerCas(request, callback)

listServerCas(request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, callback: Callback<protos.google.cloud.sql.v1.IInstancesListServerCasResponse, protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesListServerCasRequest
callback Callback<protos.google.cloud.sql.v1.IInstancesListServerCasResponse, protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

patch(request, options)

patch(request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined,
        {} | undefined
    ]>;

Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.

Parameters
Name Description
request ISqlInstancesPatchRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callPatch() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.patch(request);
    console.log(response);
  }

  callPatch();

patch(request, options, callback)

patch(request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesPatchRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

patch(request, callback)

patch(request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesPatchRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

performDiskShrink(request, options)

performDiskShrink(request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        (protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest | undefined),
        {} | undefined
    ]>;

Perform Disk Shrink on primary instance.

Parameters
Name Description
request ISqlInstancesPerformDiskShrinkRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, (protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   *  Perform disk shrink context.
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callPerformDiskShrink() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.performDiskShrink(request);
    console.log(response);
  }

  callPerformDiskShrink();

performDiskShrink(request, options, callback)

performDiskShrink(request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesPerformDiskShrinkRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

performDiskShrink(request, callback)

performDiskShrink(request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesPerformDiskShrinkRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

promoteReplica(request, options)

promoteReplica(request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | undefined,
        {} | undefined
    ]>;

Promotes the read replica instance to be a stand-alone Cloud SQL instance. Using this operation might cause your instance to restart.

Parameters
Name Description
request ISqlInstancesPromoteReplicaRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL read replica instance name.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the read replica.
   */
  // const project = 'my-project'
  /**
   *  Set to true if the promote operation should attempt to re-add the original
   *  primary as a replica when it comes back online. Otherwise, if this value is
   *  false or not set, the original primary will be a standalone instance.
   */
  // const failover = true

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callPromoteReplica() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.promoteReplica(request);
    console.log(response);
  }

  callPromoteReplica();

promoteReplica(request, options, callback)

promoteReplica(request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesPromoteReplicaRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

promoteReplica(request, callback)

promoteReplica(request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesPromoteReplicaRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

reencrypt(request, options)

reencrypt(request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined,
        {} | undefined
    ]>;

Reencrypt CMEK instance with latest key version.

Parameters
Name Description
request ISqlInstancesReencryptRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   *  Reencrypt body that users request
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callReencrypt() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.reencrypt(request);
    console.log(response);
  }

  callReencrypt();

reencrypt(request, options, callback)

reencrypt(request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesReencryptRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

reencrypt(request, callback)

reencrypt(request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesReencryptRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

releaseSsrsLease(request, options)

releaseSsrsLease(request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse,
        (protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest | undefined),
        {} | undefined
    ]>;

Release a lease for the setup of SQL Server Reporting Services (SSRS).

Parameters
Name Description
request ISqlInstancesReleaseSsrsLeaseRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, (protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SqlInstancesReleaseSsrsLeaseResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The Cloud SQL instance ID. This doesn't include the project ID.
   *  The instance ID contains lowercase letters, numbers, and hyphens, and it
   *  must start with a letter. This ID can have a maximum length of 98
   *  characters.
   */
  // const instance = 'abc123'
  /**
   *  Required. The project ID that contains the instance.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callReleaseSsrsLease() {
    // Construct request
    const request = {
      instance,
      project,
    };

    // Run request
    const response = await sqlClient.releaseSsrsLease(request);
    console.log(response);
  }

  callReleaseSsrsLease();

releaseSsrsLease(request, options, callback)

releaseSsrsLease(request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesReleaseSsrsLeaseRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

releaseSsrsLease(request, callback)

releaseSsrsLease(request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesReleaseSsrsLeaseRequest
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

rescheduleMaintenance(request, options)

rescheduleMaintenance(request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        (protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest | undefined),
        {} | undefined
    ]>;

Reschedules the maintenance on the given instance.

Parameters
Name Description
request ISqlInstancesRescheduleMaintenanceRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, (protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callRescheduleMaintenance() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.rescheduleMaintenance(request);
    console.log(response);
  }

  callRescheduleMaintenance();

rescheduleMaintenance(request, options, callback)

rescheduleMaintenance(request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesRescheduleMaintenanceRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

rescheduleMaintenance(request, callback)

rescheduleMaintenance(request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesRescheduleMaintenanceRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

resetReplicaSize(request, options)

resetReplicaSize(request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        (protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest | undefined),
        {} | undefined
    ]>;

Reset Replica Size to primary instance disk size.

Parameters
Name Description
request ISqlInstancesResetReplicaSizeRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, (protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL read replica instance name.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the read replica.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callResetReplicaSize() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.resetReplicaSize(request);
    console.log(response);
  }

  callResetReplicaSize();

resetReplicaSize(request, options, callback)

resetReplicaSize(request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesResetReplicaSizeRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

resetReplicaSize(request, callback)

resetReplicaSize(request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesResetReplicaSizeRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

resetSslConfig(request, options)

resetSslConfig(request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | undefined,
        {} | undefined
    ]>;

Deletes all client certificates and generates a new server SSL certificate for the instance.

Parameters
Name Description
request ISqlInstancesResetSslConfigRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callResetSslConfig() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.resetSslConfig(request);
    console.log(response);
  }

  callResetSslConfig();

resetSslConfig(request, options, callback)

resetSslConfig(request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesResetSslConfigRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

resetSslConfig(request, callback)

resetSslConfig(request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesResetSslConfigRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

restart(request, options)

restart(request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined,
        {} | undefined
    ]>;

Restarts a Cloud SQL instance.

Parameters
Name Description
request ISqlInstancesRestartRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance to be restarted.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callRestart() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.restart(request);
    console.log(response);
  }

  callRestart();

restart(request, options, callback)

restart(request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesRestartRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

restart(request, callback)

restart(request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesRestartRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

restoreBackup(request, options)

restoreBackup(request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | undefined,
        {} | undefined
    ]>;

Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.

Parameters
Name Description
request ISqlInstancesRestoreBackupRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callRestoreBackup() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.restoreBackup(request);
    console.log(response);
  }

  callRestoreBackup();

restoreBackup(request, options, callback)

restoreBackup(request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesRestoreBackupRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

restoreBackup(request, callback)

restoreBackup(request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesRestoreBackupRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

rotateServerCa(request, options)

rotateServerCa(request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | undefined,
        {} | undefined
    ]>;

Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method.

Parameters
Name Description
request ISqlInstancesRotateServerCaRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callRotateServerCa() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.rotateServerCa(request);
    console.log(response);
  }

  callRotateServerCa();

rotateServerCa(request, options, callback)

rotateServerCa(request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesRotateServerCaRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

rotateServerCa(request, callback)

rotateServerCa(request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesRotateServerCaRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

startExternalSync(request, options)

startExternalSync(request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        (protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest | undefined),
        {} | undefined
    ]>;

Start External primary instance migration.

Parameters
Name Description
request ISqlInstancesStartExternalSyncRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, (protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   *  External sync mode.
   */
  // const syncMode = {}
  /**
   *  Whether to skip the verification step (VESS).
   */
  // const skipVerification = true
  /**
   *  MySQL-specific settings for start external sync.
   */
  // const mysqlSyncConfig = {}
  /**
   *  Optional. Parallel level for initial data sync. Currently only applicable
   *  for MySQL.
   */
  // const syncParallelLevel = {}
  /**
   *  Optional. MigrationType decides if the migration is a physical file based
   *  migration or logical migration.
   */
  // const migrationType = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callStartExternalSync() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.startExternalSync(request);
    console.log(response);
  }

  callStartExternalSync();

startExternalSync(request, options, callback)

startExternalSync(request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesStartExternalSyncRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

startExternalSync(request, callback)

startExternalSync(request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesStartExternalSyncRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

startReplica(request, options)

startReplica(request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | undefined,
        {} | undefined
    ]>;

Starts the replication in the read replica instance.

Parameters
Name Description
request ISqlInstancesStartReplicaRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL read replica instance name.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the read replica.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callStartReplica() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.startReplica(request);
    console.log(response);
  }

  callStartReplica();

startReplica(request, options, callback)

startReplica(request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesStartReplicaRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

startReplica(request, callback)

startReplica(request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesStartReplicaRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

stopReplica(request, options)

stopReplica(request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | undefined,
        {} | undefined
    ]>;

Stops the replication in the read replica instance.

Parameters
Name Description
request ISqlInstancesStopReplicaRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL read replica instance name.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the read replica.
   */
  // const project = 'my-project'

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callStopReplica() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.stopReplica(request);
    console.log(response);
  }

  callStopReplica();

stopReplica(request, options, callback)

stopReplica(request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesStopReplicaRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

stopReplica(request, callback)

stopReplica(request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesStopReplicaRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

switchover(request, options)

switchover(request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined,
        {} | undefined
    ]>;

Switches over from the primary instance to the replica instance.

Parameters
Name Description
request ISqlInstancesSwitchoverRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL read replica instance name.
   */
  // const instance = 'abc123'
  /**
   *  ID of the project that contains the replica.
   */
  // const project = 'my-project'
  /**
   *  Optional. (MySQL only) Cloud SQL instance operations timeout, which is a
   *  sum of all database operations. Default value is 10 minutes and can be
   *  modified to a maximum value of 24 hours.
   */
  // const dbTimeout = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callSwitchover() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.switchover(request);
    console.log(response);
  }

  callSwitchover();

switchover(request, options, callback)

switchover(request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesSwitchoverRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

switchover(request, callback)

switchover(request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesSwitchoverRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

truncateLog(request, options)

truncateLog(request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | undefined,
        {} | undefined
    ]>;

Truncate MySQL general and slow query log tables MySQL only.

Parameters
Name Description
request ISqlInstancesTruncateLogRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the Cloud SQL project.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callTruncateLog() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.truncateLog(request);
    console.log(response);
  }

  callTruncateLog();

truncateLog(request, options, callback)

truncateLog(request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesTruncateLogRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

truncateLog(request, callback)

truncateLog(request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesTruncateLogRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

update(request, options)

update(request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.IOperation,
        protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined,
        {} | undefined
    ]>;

Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.

Parameters
Name Description
request ISqlInstancesUpdateRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   */
  // const body = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callUpdate() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.update(request);
    console.log(response);
  }

  callUpdate();

update(request, options, callback)

update(request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesUpdateRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

update(request, callback)

update(request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, callback: Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesUpdateRequest
callback Callback<protos.google.cloud.sql.v1.IOperation, protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

verifyExternalSyncSettings(request, options)

verifyExternalSyncSettings(request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse,
        (protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest | undefined),
        {} | undefined
    ]>;

Verify External primary instance external sync settings.

Parameters
Name Description
request ISqlInstancesVerifyExternalSyncSettingsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, (protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SqlInstancesVerifyExternalSyncSettingsResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Cloud SQL instance ID. This does not include the project ID.
   */
  // const instance = 'abc123'
  /**
   *  Project ID of the project that contains the instance.
   */
  // const project = 'my-project'
  /**
   *  Flag to enable verifying connection only
   */
  // const verifyConnectionOnly = true
  /**
   *  External sync mode
   */
  // const syncMode = {}
  /**
   *  Optional. Flag to verify settings required by replication setup only
   */
  // const verifyReplicationOnly = true
  /**
   *  Optional. MySQL-specific settings for start external sync.
   */
  // const mysqlSyncConfig = {}
  /**
   *  Optional. MigrationType decides if the migration is a physical file based
   *  migration or logical migration
   */
  // const migrationType = {}
  /**
   *  Optional. Parallel level for initial data sync. Currently only applicable
   *  for PostgreSQL.
   */
  // const syncParallelLevel = {}

  // Imports the Sql library
  const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1;

  // Instantiates a client
  const sqlClient = new SqlInstancesServiceClient();

  async function callVerifyExternalSyncSettings() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await sqlClient.verifyExternalSyncSettings(request);
    console.log(response);
  }

  callVerifyExternalSyncSettings();

verifyExternalSyncSettings(request, options, callback)

verifyExternalSyncSettings(request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, options: CallOptions, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesVerifyExternalSyncSettingsRequest
options CallOptions
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

verifyExternalSyncSettings(request, callback)

verifyExternalSyncSettings(request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, callback: Callback<protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISqlInstancesVerifyExternalSyncSettingsRequest
callback Callback<protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void