Reference documentation and code samples for the Google Cloud Sql Admin V1 Client class SqlInstancesServiceClient.
Service Description:
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Namespace
Google \ Cloud \ Sql \ V1 \ ClientMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
options |
array|Google\ApiCore\Options\ClientOptions
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
FetchAuthTokenInterface|CredentialsWrapper
This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
↳ logger |
false|LoggerInterface
A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag |
↳ universeDomain |
string
The service domain for the client. Defaults to 'googleapis.com'. |
acquireSsrsLease
Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
The async variant is SqlInstancesServiceClient::acquireSsrsLeaseAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesAcquireSsrsLeaseRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\SqlInstancesAcquireSsrsLeaseResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\InstancesAcquireSsrsLeaseRequest;
use Google\Cloud\Sql\V1\SqlInstancesAcquireSsrsLeaseRequest;
use Google\Cloud\Sql\V1\SqlInstancesAcquireSsrsLeaseResponse;
/**
* @param string $instance 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).
* @param string $project Project ID of the project that contains the instance (Example:
* project-id).
*/
function acquire_ssrs_lease_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$body = new InstancesAcquireSsrsLeaseRequest();
$request = (new SqlInstancesAcquireSsrsLeaseRequest())
->setInstance($instance)
->setProject($project)
->setBody($body);
// Call the API and handle any network failures.
try {
/** @var SqlInstancesAcquireSsrsLeaseResponse $response */
$response = $sqlInstancesServiceClient->acquireSsrsLease($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
acquire_ssrs_lease_sample($instance, $project);
}
addEntraIdCertificate
Adds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.
The async variant is SqlInstancesServiceClient::addEntraIdCertificateAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesAddEntraIdCertificateRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesAddEntraIdCertificateRequest;
/**
* @param string $instance Cloud SQL instance ID. This does not include the project ID.
* @param string $project Project ID of the project that contains the instance.
*/
function add_entra_id_certificate_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = (new SqlInstancesAddEntraIdCertificateRequest())
->setInstance($instance)
->setProject($project);
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->addEntraIdCertificate($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
add_entra_id_certificate_sample($instance, $project);
}
addServerCa
Adds a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.
The async variant is SqlInstancesServiceClient::addServerCaAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesAddServerCaRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesAddServerCaRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function add_server_ca_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesAddServerCaRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->addServerCa($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
addServerCertificate
Add a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.
The async variant is SqlInstancesServiceClient::addServerCertificateAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesAddServerCertificateRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesAddServerCertificateRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function add_server_certificate_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesAddServerCertificateRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->addServerCertificate($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
clone
Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.
The async variant is SqlInstancesServiceClient::cloneAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesCloneRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\CloneContext;
use Google\Cloud\Sql\V1\InstancesCloneRequest;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesCloneRequest;
/**
* @param string $instance The ID of the Cloud SQL instance to be cloned (source). This does
* not include the project ID.
* @param string $project Project ID of the source as well as the clone Cloud SQL instance.
* @param string $bodyCloneContextDestinationInstanceName Name of the Cloud SQL instance to be created as a clone.
*/
function clone_sample(
string $instance,
string $project,
string $bodyCloneContextDestinationInstanceName
): void {
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$bodyCloneContext = (new CloneContext())
->setDestinationInstanceName($bodyCloneContextDestinationInstanceName);
$body = (new InstancesCloneRequest())
->setCloneContext($bodyCloneContext);
$request = (new SqlInstancesCloneRequest())
->setInstance($instance)
->setProject($project)
->setBody($body);
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->clone($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
$bodyCloneContextDestinationInstanceName = '[DESTINATION_INSTANCE_NAME]';
clone_sample($instance, $project, $bodyCloneContextDestinationInstanceName);
}
createEphemeral
Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
The async variant is SqlInstancesServiceClient::createEphemeralAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesCreateEphemeralCertRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\SslCert |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\SqlInstancesCreateEphemeralCertRequest;
use Google\Cloud\Sql\V1\SslCert;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function create_ephemeral_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesCreateEphemeralCertRequest();
// Call the API and handle any network failures.
try {
/** @var SslCert $response */
$response = $sqlInstancesServiceClient->createEphemeral($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
delete
Deletes a Cloud SQL instance.
The async variant is SqlInstancesServiceClient::deleteAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesDeleteRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesDeleteRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function delete_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesDeleteRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->delete($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
demote
Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.
The async variant is SqlInstancesServiceClient::demoteAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesDemoteRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\DemoteContext;
use Google\Cloud\Sql\V1\InstancesDemoteRequest;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesDemoteRequest;
/**
* @param string $instance Cloud SQL instance name.
* @param string $project ID of the project that contains the instance.
* @param string $bodyDemoteContextSourceRepresentativeInstanceName The name of the instance which acts as the on-premises primary
* instance in the replication setup.
*/
function demote_sample(
string $instance,
string $project,
string $bodyDemoteContextSourceRepresentativeInstanceName
): void {
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$bodyDemoteContext = (new DemoteContext())
->setSourceRepresentativeInstanceName($bodyDemoteContextSourceRepresentativeInstanceName);
$body = (new InstancesDemoteRequest())
->setDemoteContext($bodyDemoteContext);
$request = (new SqlInstancesDemoteRequest())
->setInstance($instance)
->setProject($project)
->setBody($body);
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->demote($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
$bodyDemoteContextSourceRepresentativeInstanceName = '[SOURCE_REPRESENTATIVE_INSTANCE_NAME]';
demote_sample($instance, $project, $bodyDemoteContextSourceRepresentativeInstanceName);
}
demoteMaster
Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
The async variant is SqlInstancesServiceClient::demoteMasterAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesDemoteMasterRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesDemoteMasterRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function demote_master_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesDemoteMasterRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->demoteMaster($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
executeSql
Execute SQL statements.
The async variant is SqlInstancesServiceClient::executeSqlAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesExecuteSqlRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\SqlInstancesExecuteSqlResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\SqlInstancesExecuteSqlRequest;
use Google\Cloud\Sql\V1\SqlInstancesExecuteSqlResponse;
/**
* @param string $instance Database instance ID. This does not include the project ID.
* @param string $project Project ID of the project that contains the instance.
*/
function execute_sql_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = (new SqlInstancesExecuteSqlRequest())
->setInstance($instance)
->setProject($project);
// Call the API and handle any network failures.
try {
/** @var SqlInstancesExecuteSqlResponse $response */
$response = $sqlInstancesServiceClient->executeSql($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
execute_sql_sample($instance, $project);
}
export
Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
The async variant is SqlInstancesServiceClient::exportAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesExportRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesExportRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function export_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesExportRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->export($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
failover
Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation.
If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.
The async variant is SqlInstancesServiceClient::failoverAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesFailoverRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesFailoverRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function failover_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesFailoverRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->failover($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
get
Retrieves a resource containing information about a Cloud SQL instance.
The async variant is SqlInstancesServiceClient::getAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesGetRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\DatabaseInstance |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\DatabaseInstance;
use Google\Cloud\Sql\V1\SqlInstancesGetRequest;
/**
* @param string $instance Database instance ID. This does not include the project ID.
* @param string $project Project ID of the project that contains the instance.
*/
function get_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = (new SqlInstancesGetRequest())
->setInstance($instance)
->setProject($project);
// Call the API and handle any network failures.
try {
/** @var DatabaseInstance $response */
$response = $sqlInstancesServiceClient->get($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
get_sample($instance, $project);
}
getDiskShrinkConfig
Get Disk Shrink Config for a given instance.
The async variant is SqlInstancesServiceClient::getDiskShrinkConfigAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesGetDiskShrinkConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\SqlInstancesGetDiskShrinkConfigResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\SqlInstancesGetDiskShrinkConfigRequest;
use Google\Cloud\Sql\V1\SqlInstancesGetDiskShrinkConfigResponse;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function get_disk_shrink_config_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesGetDiskShrinkConfigRequest();
// Call the API and handle any network failures.
try {
/** @var SqlInstancesGetDiskShrinkConfigResponse $response */
$response = $sqlInstancesServiceClient->getDiskShrinkConfig($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getLatestRecoveryTime
Get Latest Recovery Time for a given instance.
The async variant is SqlInstancesServiceClient::getLatestRecoveryTimeAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesGetLatestRecoveryTimeRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\SqlInstancesGetLatestRecoveryTimeResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\SqlInstancesGetLatestRecoveryTimeRequest;
use Google\Cloud\Sql\V1\SqlInstancesGetLatestRecoveryTimeResponse;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function get_latest_recovery_time_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesGetLatestRecoveryTimeRequest();
// Call the API and handle any network failures.
try {
/** @var SqlInstancesGetLatestRecoveryTimeResponse $response */
$response = $sqlInstancesServiceClient->getLatestRecoveryTime($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
import
Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.
The async variant is SqlInstancesServiceClient::importAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesImportRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesImportRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function import_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesImportRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->import($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
insert
Creates a new Cloud SQL instance.
The async variant is SqlInstancesServiceClient::insertAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesInsertRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesInsertRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function insert_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesInsertRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->insert($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
list
Lists instances under a given project.
The async variant is SqlInstancesServiceClient::listAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesListRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\InstancesListResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\InstancesListResponse;
use Google\Cloud\Sql\V1\SqlInstancesListRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function list_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesListRequest();
// Call the API and handle any network failures.
try {
/** @var InstancesListResponse $response */
$response = $sqlInstancesServiceClient->list($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listEntraIdCertificates
Lists all versions of EntraID certificates for the specified instance.
There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.
The async variant is SqlInstancesServiceClient::listEntraIdCertificatesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesListEntraIdCertificatesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\InstancesListEntraIdCertificatesResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\InstancesListEntraIdCertificatesResponse;
use Google\Cloud\Sql\V1\SqlInstancesListEntraIdCertificatesRequest;
/**
* @param string $instance Cloud SQL instance ID. This does not include the project ID.
* @param string $project Project ID of the project that contains the instance.
*/
function list_entra_id_certificates_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = (new SqlInstancesListEntraIdCertificatesRequest())
->setInstance($instance)
->setProject($project);
// Call the API and handle any network failures.
try {
/** @var InstancesListEntraIdCertificatesResponse $response */
$response = $sqlInstancesServiceClient->listEntraIdCertificates($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
list_entra_id_certificates_sample($instance, $project);
}
listServerCas
Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.
The async variant is SqlInstancesServiceClient::listServerCasAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesListServerCasRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\InstancesListServerCasResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\InstancesListServerCasResponse;
use Google\Cloud\Sql\V1\SqlInstancesListServerCasRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function list_server_cas_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesListServerCasRequest();
// Call the API and handle any network failures.
try {
/** @var InstancesListServerCasResponse $response */
$response = $sqlInstancesServiceClient->listServerCas($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listServerCertificates
Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.
The async variant is SqlInstancesServiceClient::listServerCertificatesAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesListServerCertificatesRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\InstancesListServerCertificatesResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\InstancesListServerCertificatesResponse;
use Google\Cloud\Sql\V1\SqlInstancesListServerCertificatesRequest;
/**
* @param string $instance Cloud SQL instance ID. This does not include the project ID.
* @param string $project Project ID of the project that contains the instance.
*/
function list_server_certificates_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = (new SqlInstancesListServerCertificatesRequest())
->setInstance($instance)
->setProject($project);
// Call the API and handle any network failures.
try {
/** @var InstancesListServerCertificatesResponse $response */
$response = $sqlInstancesServiceClient->listServerCertificates($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
list_server_certificates_sample($instance, $project);
}
patch
Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.
The async variant is SqlInstancesServiceClient::patchAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPatchRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesPatchRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function patch_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesPatchRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->patch($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
performDiskShrink
Perform Disk Shrink on primary instance.
The async variant is SqlInstancesServiceClient::performDiskShrinkAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPerformDiskShrinkRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesPerformDiskShrinkRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function perform_disk_shrink_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesPerformDiskShrinkRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->performDiskShrink($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
pointInTimeRestore
Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.
The async variant is SqlInstancesServiceClient::pointInTimeRestoreAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPointInTimeRestoreRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\PointInTimeRestoreContext;
use Google\Cloud\Sql\V1\SqlInstancesPointInTimeRestoreRequest;
use Google\Protobuf\Timestamp;
/**
* @param string $parent The parent resource where you created this instance.
* Format: projects/{project}
*/
function point_in_time_restore_sample(string $parent): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$contextPointInTime = new Timestamp();
$context = (new PointInTimeRestoreContext())
->setPointInTime($contextPointInTime);
$request = (new SqlInstancesPointInTimeRestoreRequest())
->setParent($parent)
->setContext($context);
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->pointInTimeRestore($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$parent = '[PARENT]';
point_in_time_restore_sample($parent);
}
preCheckMajorVersionUpgrade
Execute MVU Pre-checks
The async variant is SqlInstancesServiceClient::preCheckMajorVersionUpgradeAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPreCheckMajorVersionUpgradeRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\InstancesPreCheckMajorVersionUpgradeRequest;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\PreCheckMajorVersionUpgradeContext;
use Google\Cloud\Sql\V1\SqlDatabaseVersion;
use Google\Cloud\Sql\V1\SqlInstancesPreCheckMajorVersionUpgradeRequest;
/**
* @param string $instance Cloud SQL instance ID. This does not include the project ID.
* @param string $project Project ID of the project that contains the instance.
* @param int $bodyPreCheckMajorVersionUpgradeContextTargetDatabaseVersion The target database version to upgrade to.
*/
function pre_check_major_version_upgrade_sample(
string $instance,
string $project,
int $bodyPreCheckMajorVersionUpgradeContextTargetDatabaseVersion
): void {
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$bodyPreCheckMajorVersionUpgradeContext = (new PreCheckMajorVersionUpgradeContext())
->setTargetDatabaseVersion($bodyPreCheckMajorVersionUpgradeContextTargetDatabaseVersion);
$body = (new InstancesPreCheckMajorVersionUpgradeRequest())
->setPreCheckMajorVersionUpgradeContext($bodyPreCheckMajorVersionUpgradeContext);
$request = (new SqlInstancesPreCheckMajorVersionUpgradeRequest())
->setInstance($instance)
->setProject($project)
->setBody($body);
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->preCheckMajorVersionUpgrade($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
$bodyPreCheckMajorVersionUpgradeContextTargetDatabaseVersion = SqlDatabaseVersion::SQL_DATABASE_VERSION_UNSPECIFIED;
pre_check_major_version_upgrade_sample(
$instance,
$project,
$bodyPreCheckMajorVersionUpgradeContextTargetDatabaseVersion
);
}
promoteReplica
Promotes the read replica instance to be an independent Cloud SQL primary instance.
Using this operation might cause your instance to restart.
The async variant is SqlInstancesServiceClient::promoteReplicaAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPromoteReplicaRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesPromoteReplicaRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function promote_replica_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesPromoteReplicaRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->promoteReplica($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
reencrypt
Reencrypt CMEK instance with latest key version.
The async variant is SqlInstancesServiceClient::reencryptAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesReencryptRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesReencryptRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function reencrypt_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesReencryptRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->reencrypt($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
releaseSsrsLease
Release a lease for the setup of SQL Server Reporting Services (SSRS).
The async variant is SqlInstancesServiceClient::releaseSsrsLeaseAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesReleaseSsrsLeaseRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\SqlInstancesReleaseSsrsLeaseResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\SqlInstancesReleaseSsrsLeaseRequest;
use Google\Cloud\Sql\V1\SqlInstancesReleaseSsrsLeaseResponse;
/**
* @param string $instance 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.
* @param string $project The project ID that contains the instance.
*/
function release_ssrs_lease_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = (new SqlInstancesReleaseSsrsLeaseRequest())
->setInstance($instance)
->setProject($project);
// Call the API and handle any network failures.
try {
/** @var SqlInstancesReleaseSsrsLeaseResponse $response */
$response = $sqlInstancesServiceClient->releaseSsrsLease($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
release_ssrs_lease_sample($instance, $project);
}
rescheduleMaintenance
Reschedules the maintenance on the given instance.
The async variant is SqlInstancesServiceClient::rescheduleMaintenanceAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRescheduleMaintenanceRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesRescheduleMaintenanceRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function reschedule_maintenance_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesRescheduleMaintenanceRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->rescheduleMaintenance($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
resetReplicaSize
Reset Replica Size to primary instance disk size.
The async variant is SqlInstancesServiceClient::resetReplicaSizeAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesResetReplicaSizeRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesResetReplicaSizeRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function reset_replica_size_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesResetReplicaSizeRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->resetReplicaSize($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
resetSslConfig
Deletes all client certificates and generates a new server SSL certificate for the instance.
The async variant is SqlInstancesServiceClient::resetSslConfigAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesResetSslConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesResetSslConfigRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function reset_ssl_config_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesResetSslConfigRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->resetSslConfig($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
restart
Restarts a Cloud SQL instance.
The async variant is SqlInstancesServiceClient::restartAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRestartRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesRestartRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function restart_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesRestartRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->restart($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
restoreBackup
Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.
The async variant is SqlInstancesServiceClient::restoreBackupAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRestoreBackupRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesRestoreBackupRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function restore_backup_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesRestoreBackupRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->restoreBackup($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
rotateEntraIdCertificate
Rotates the server certificate version to one previously added with the addEntraIdCertificate method.
The async variant is SqlInstancesServiceClient::rotateEntraIdCertificateAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRotateEntraIdCertificateRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesRotateEntraIdCertificateRequest;
/**
* @param string $instance Cloud SQL instance ID. This does not include the project ID.
* @param string $project Project ID of the project that contains the instance.
*/
function rotate_entra_id_certificate_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = (new SqlInstancesRotateEntraIdCertificateRequest())
->setInstance($instance)
->setProject($project);
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->rotateEntraIdCertificate($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
rotate_entra_id_certificate_sample($instance, $project);
}
rotateServerCa
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, use RotateServerCertificate to rotate the server certificate.
The async variant is SqlInstancesServiceClient::rotateServerCaAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRotateServerCaRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesRotateServerCaRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function rotate_server_ca_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesRotateServerCaRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->rotateServerCa($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
rotateServerCertificate
Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.
The async variant is SqlInstancesServiceClient::rotateServerCertificateAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRotateServerCertificateRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesRotateServerCertificateRequest;
/**
* @param string $instance Cloud SQL instance ID. This does not include the project ID.
* @param string $project Project ID of the project that contains the instance.
*/
function rotate_server_certificate_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = (new SqlInstancesRotateServerCertificateRequest())
->setInstance($instance)
->setProject($project);
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->rotateServerCertificate($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$instance = '[INSTANCE]';
$project = '[PROJECT]';
rotate_server_certificate_sample($instance, $project);
}
startExternalSync
Start External primary instance migration.
The async variant is SqlInstancesServiceClient::startExternalSyncAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesStartExternalSyncRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesStartExternalSyncRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function start_external_sync_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesStartExternalSyncRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->startExternalSync($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
startReplica
Starts the replication in the read replica instance.
The async variant is SqlInstancesServiceClient::startReplicaAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesStartReplicaRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesStartReplicaRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function start_replica_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesStartReplicaRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->startReplica($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
stopReplica
Stops the replication in the read replica instance.
The async variant is SqlInstancesServiceClient::stopReplicaAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesStopReplicaRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesStopReplicaRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function stop_replica_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesStopReplicaRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->stopReplica($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
switchover
Switches over from the primary instance to the DR replica instance.
The async variant is SqlInstancesServiceClient::switchoverAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesSwitchoverRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesSwitchoverRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function switchover_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesSwitchoverRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->switchover($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
truncateLog
Truncate MySQL general and slow query log tables MySQL only.
The async variant is SqlInstancesServiceClient::truncateLogAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesTruncateLogRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesTruncateLogRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function truncate_log_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesTruncateLogRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->truncateLog($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
update
Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.
The async variant is SqlInstancesServiceClient::updateAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesUpdateRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\Operation |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\Operation;
use Google\Cloud\Sql\V1\SqlInstancesUpdateRequest;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function update_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesUpdateRequest();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->update($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
verifyExternalSyncSettings
Verify External primary instance external sync settings.
The async variant is SqlInstancesServiceClient::verifyExternalSyncSettingsAsync() .
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesVerifyExternalSyncSettingsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Returns | |
|---|---|
| Type | Description |
Google\Cloud\Sql\V1\SqlInstancesVerifyExternalSyncSettingsResponse |
|
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1\Client\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1\SqlInstancesVerifyExternalSyncSettingsRequest;
use Google\Cloud\Sql\V1\SqlInstancesVerifyExternalSyncSettingsResponse;
/**
* This sample 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.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function verify_external_sync_settings_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Prepare the request message.
$request = new SqlInstancesVerifyExternalSyncSettingsRequest();
// Call the API and handle any network failures.
try {
/** @var SqlInstancesVerifyExternalSyncSettingsResponse $response */
$response = $sqlInstancesServiceClient->verifyExternalSyncSettings($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
acquireSsrsLeaseAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesAcquireSsrsLeaseRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\SqlInstancesAcquireSsrsLeaseResponse> |
|
addEntraIdCertificateAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesAddEntraIdCertificateRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
addServerCaAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesAddServerCaRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
addServerCertificateAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesAddServerCertificateRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
cloneAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesCloneRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
createEphemeralAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesCreateEphemeralCertRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\SslCert> |
|
deleteAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesDeleteRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
demoteAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesDemoteRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
demoteMasterAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesDemoteMasterRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
executeSqlAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesExecuteSqlRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\SqlInstancesExecuteSqlResponse> |
|
exportAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesExportRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
failoverAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesFailoverRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
getAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesGetRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\DatabaseInstance> |
|
getDiskShrinkConfigAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesGetDiskShrinkConfigRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\SqlInstancesGetDiskShrinkConfigResponse> |
|
getLatestRecoveryTimeAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesGetLatestRecoveryTimeRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\SqlInstancesGetLatestRecoveryTimeResponse> |
|
importAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesImportRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
insertAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesInsertRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
listAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesListRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\InstancesListResponse> |
|
listEntraIdCertificatesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesListEntraIdCertificatesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\InstancesListEntraIdCertificatesResponse> |
|
listServerCasAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesListServerCasRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\InstancesListServerCasResponse> |
|
listServerCertificatesAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesListServerCertificatesRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\InstancesListServerCertificatesResponse> |
|
patchAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPatchRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
performDiskShrinkAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPerformDiskShrinkRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
pointInTimeRestoreAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPointInTimeRestoreRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
preCheckMajorVersionUpgradeAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPreCheckMajorVersionUpgradeRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
promoteReplicaAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesPromoteReplicaRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
reencryptAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesReencryptRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
releaseSsrsLeaseAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesReleaseSsrsLeaseRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\SqlInstancesReleaseSsrsLeaseResponse> |
|
rescheduleMaintenanceAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRescheduleMaintenanceRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
resetReplicaSizeAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesResetReplicaSizeRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
resetSslConfigAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesResetSslConfigRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
restartAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRestartRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
restoreBackupAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRestoreBackupRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
rotateEntraIdCertificateAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRotateEntraIdCertificateRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
rotateServerCaAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRotateServerCaRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
rotateServerCertificateAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesRotateServerCertificateRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
startExternalSyncAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesStartExternalSyncRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
startReplicaAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesStartReplicaRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
stopReplicaAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesStopReplicaRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
switchoverAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesSwitchoverRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
truncateLogAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesTruncateLogRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
updateAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesUpdateRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\Operation> |
|
verifyExternalSyncSettingsAsync
| Parameters | |
|---|---|
| Name | Description |
request |
Google\Cloud\Sql\V1\SqlInstancesVerifyExternalSyncSettingsRequest
|
optionalArgs |
array
|
| Returns | |
|---|---|
| Type | Description |
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Sql\V1\SqlInstancesVerifyExternalSyncSettingsResponse> |
|
static::backupName
Formats a string containing the fully-qualified path to represent a backup resource.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
backup |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
The formatted backup resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- backup: projects/{project}/backups/{backup}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
| Parameters | |
|---|---|
| Name | Description |
formattedName |
string
The formatted name string |
template |
?string
Optional name of template to match |
| Returns | |
|---|---|
| Type | Description |
array |
An associative array from name component IDs to component values. |