class Instances extends Resource (View source)

The "instances" collection of methods.

Typical usage is:

 $sqladminService = new Google\Service\SQLAdmin(...);
 $instances = $sqladminService->instances;

Methods

acquireSsrsLease(string $project, string $instance, InstancesAcquireSsrsLeaseRequest $postBody, array $optParams = [])

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

addServerCa(string $project, string $instance, array $optParams = [])

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. For instances that have enabled Certificate Authority Service (CAS) based server CA, please use AddServerCertificate to add a new server certificate. (instances.addServerCa)

cloneInstances(string $project, string $instance, InstancesCloneRequest $postBody, array $optParams = [])

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

delete(string $project, string $instance, array $optParams = [])

Deletes a Cloud SQL instance. (instances.delete)

demote(string $project, string $instance, InstancesDemoteRequest $postBody, array $optParams = [])

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

demoteMaster(string $project, string $instance, InstancesDemoteMasterRequest $postBody, array $optParams = [])

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

export(string $project, string $instance, InstancesExportRequest $postBody, array $optParams = [])

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

failover(string $project, string $instance, InstancesFailoverRequest $postBody, array $optParams = [])

Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.

get(string $project, string $instance, array $optParams = [])

Retrieves a resource containing information about a Cloud SQL instance.

import(string $project, string $instance, InstancesImportRequest $postBody, array $optParams = [])

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage. (instances.import)

insert(string $project, DatabaseInstance $postBody, array $optParams = [])

Creates a new Cloud SQL instance. (instances.insert)

listInstances(string $project, array $optParams = [])

Lists instances under a given project. (instances.listInstances)

listServerCas(string $project, string $instance, array $optParams = [])

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. (instances.listServerCas)

patch(string $project, string $instance, DatabaseInstance $postBody, array $optParams = [])

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

promoteReplica(string $project, string $instance, array $optParams = [])

Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.

reencrypt(string $project, string $instance, InstancesReencryptRequest $postBody, array $optParams = [])

Reencrypt CMEK instance with latest key version. (instances.reencrypt)

releaseSsrsLease(string $project, string $instance, array $optParams = [])

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

resetSslConfig(string $project, string $instance, array $optParams = [])

Deletes all client certificates and generates a new server SSL certificate for the instance. (instances.resetSslConfig)

restart(string $project, string $instance, array $optParams = [])

Restarts a Cloud SQL instance. (instances.restart)

restoreBackup(string $project, string $instance, InstancesRestoreBackupRequest $postBody, array $optParams = [])

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

rotateServerCa(string $project, string $instance, InstancesRotateServerCaRequest $postBody, array $optParams = [])

Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, please use RotateServerCertificate to rotate the server certificate.

startReplica(string $project, string $instance, array $optParams = [])

Starts the replication in the read replica instance. (instances.startReplica)

stopReplica(string $project, string $instance, array $optParams = [])

Stops the replication in the read replica instance. (instances.stopReplica)

switchover(string $project, string $instance, array $optParams = [])

Switches over from the primary instance to the designated DR replica instance. (instances.switchover)

truncateLog(string $project, string $instance, InstancesTruncateLogRequest $postBody, array $optParams = [])

Truncate MySQL general and slow query log tables MySQL only.

update(string $project, string $instance, DatabaseInstance $postBody, array $optParams = [])

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

Details

SqlInstancesAcquireSsrsLeaseResponse acquireSsrsLease(string $project, string $instance, InstancesAcquireSsrsLeaseRequest $postBody, array $optParams = [])

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

(instances.acquireSsrsLease)

Parameters

string $project

Required. Project ID of the project that contains the instance (Example: project-id).

string $instance

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

InstancesAcquireSsrsLeaseRequest $postBody
array $optParams

Optional parameters.

Return Value

SqlInstancesAcquireSsrsLeaseResponse

Exceptions

Exception

Operation addServerCa(string $project, string $instance, array $optParams = [])

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. For instances that have enabled Certificate Authority Service (CAS) based server CA, please use AddServerCertificate to add a new server certificate. (instances.addServerCa)

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation cloneInstances(string $project, string $instance, InstancesCloneRequest $postBody, array $optParams = [])

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

Parameters

string $project

Project ID of the source as well as the clone Cloud SQL instance.

string $instance

The ID of the Cloud SQL instance to be cloned (source). This does not include the project ID.

InstancesCloneRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation delete(string $project, string $instance, array $optParams = [])

Deletes a Cloud SQL instance. (instances.delete)

Parameters

string $project

Project ID of the project that contains the instance to be deleted.

string $instance

Cloud SQL instance ID. This does not include the project ID.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation demote(string $project, string $instance, InstancesDemoteRequest $postBody, array $optParams = [])

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

Parameters

string $project

Required. ID of the project that contains the instance.

string $instance

Required. Cloud SQL instance name.

InstancesDemoteRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation demoteMaster(string $project, string $instance, InstancesDemoteMasterRequest $postBody, array $optParams = [])

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

Parameters

string $project

ID of the project that contains the instance.

string $instance

Cloud SQL instance name.

InstancesDemoteMasterRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation export(string $project, string $instance, InstancesExportRequest $postBody, array $optParams = [])

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

Parameters

string $project

Project ID of the project that contains the instance to be exported.

string $instance

Cloud SQL instance ID. This does not include the project ID.

InstancesExportRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation failover(string $project, string $instance, InstancesFailoverRequest $postBody, array $optParams = [])

Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.

(instances.failover)

Parameters

string $project

ID of the project that contains the read replica.

string $instance

Cloud SQL instance ID. This does not include the project ID.

InstancesFailoverRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

DatabaseInstance get(string $project, string $instance, array $optParams = [])

Retrieves a resource containing information about a Cloud SQL instance.

(instances.get)

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Database instance ID. This does not include the project ID.

array $optParams

Optional parameters.

Return Value

DatabaseInstance

Exceptions

Exception

Operation import(string $project, string $instance, InstancesImportRequest $postBody, array $optParams = [])

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage. (instances.import)

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

InstancesImportRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation insert(string $project, DatabaseInstance $postBody, array $optParams = [])

Creates a new Cloud SQL instance. (instances.insert)

Parameters

string $project

Project ID of the project to which the newly created Cloud SQL instances should belong.

DatabaseInstance $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

InstancesListResponse listInstances(string $project, array $optParams = [])

Lists instances under a given project. (instances.listInstances)

Parameters

string $project

Project ID of the project for which to list Cloud SQL instances.

array $optParams

Optional parameters.

Return Value

InstancesListResponse

Exceptions

Exception

InstancesListServerCasResponse listServerCas(string $project, string $instance, array $optParams = [])

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. (instances.listServerCas)

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

array $optParams

Optional parameters.

Return Value

InstancesListServerCasResponse

Exceptions

Exception

Operation patch(string $project, string $instance, DatabaseInstance $postBody, array $optParams = [])

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

(instances.patch)

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

DatabaseInstance $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation promoteReplica(string $project, string $instance, array $optParams = [])

Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.

(instances.promoteReplica)

Parameters

string $project

ID of the project that contains the read replica.

string $instance

Cloud SQL read replica instance name.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation reencrypt(string $project, string $instance, InstancesReencryptRequest $postBody, array $optParams = [])

Reencrypt CMEK instance with latest key version. (instances.reencrypt)

Parameters

string $project

ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

InstancesReencryptRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

SqlInstancesReleaseSsrsLeaseResponse releaseSsrsLease(string $project, string $instance, array $optParams = [])

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

(instances.releaseSsrsLease)

Parameters

string $project

Required. The project ID that contains the instance.

string $instance

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.

array $optParams

Optional parameters.

Return Value

SqlInstancesReleaseSsrsLeaseResponse

Exceptions

Exception

Operation resetSslConfig(string $project, string $instance, array $optParams = [])

Deletes all client certificates and generates a new server SSL certificate for the instance. (instances.resetSslConfig)

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation restart(string $project, string $instance, array $optParams = [])

Restarts a Cloud SQL instance. (instances.restart)

Parameters

string $project

Project ID of the project that contains the instance to be restarted.

string $instance

Cloud SQL instance ID. This does not include the project ID.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation restoreBackup(string $project, string $instance, InstancesRestoreBackupRequest $postBody, array $optParams = [])

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

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

InstancesRestoreBackupRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation rotateServerCa(string $project, string $instance, InstancesRotateServerCaRequest $postBody, array $optParams = [])

Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, please use RotateServerCertificate to rotate the server certificate.

(instances.rotateServerCa)

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

InstancesRotateServerCaRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation startReplica(string $project, string $instance, array $optParams = [])

Starts the replication in the read replica instance. (instances.startReplica)

Parameters

string $project

ID of the project that contains the read replica.

string $instance

Cloud SQL read replica instance name.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation stopReplica(string $project, string $instance, array $optParams = [])

Stops the replication in the read replica instance. (instances.stopReplica)

Parameters

string $project

ID of the project that contains the read replica.

string $instance

Cloud SQL read replica instance name.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation switchover(string $project, string $instance, array $optParams = [])

Switches over from the primary instance to the designated DR replica instance. (instances.switchover)

Parameters

string $project

ID of the project that contains the replica.

string $instance

Cloud SQL read replica instance name.

array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation truncateLog(string $project, string $instance, InstancesTruncateLogRequest $postBody, array $optParams = [])

Truncate MySQL general and slow query log tables MySQL only.

(instances.truncateLog)

Parameters

string $project

Project ID of the Cloud SQL project.

string $instance

Cloud SQL instance ID. This does not include the project ID.

InstancesTruncateLogRequest $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception

Operation update(string $project, string $instance, DatabaseInstance $postBody, array $optParams = [])

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

Parameters

string $project

Project ID of the project that contains the instance.

string $instance

Cloud SQL instance ID. This does not include the project ID.

DatabaseInstance $postBody
array $optParams

Optional parameters.

Return Value

Operation

Exceptions

Exception