Reference documentation and code samples for the Google Cloud Sql Admin V1beta4 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. Sample code to get started:
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
try {
$instance = 'instance';
$project = 'project';
$response = $sqlInstancesServiceClient->acquireSsrsLease($instance, $project);
} finally {
$sqlInstancesServiceClient->close();
}
Namespace
Google \ Cloud \ Sql \ V1beta4Methods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
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 |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ 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. |
acquireSsrsLease
Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
Parameters | |
---|---|
Name | Description |
instance |
string
Required. Cloud SQL instance ID. This doesn't include the project ID. It's composed of lowercase letters, numbers, and hyphens, and it must start with a letter. The total length must be 98 characters or less (Example: instance-id). |
project |
string
Required. ID of the project that contains the instance (Example: project-id). |
optionalArgs |
array
Optional. |
↳ body |
InstancesAcquireSsrsLeaseRequest
The body for request to acquire an SSRS lease. |
↳ 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\V1beta4\SqlInstancesAcquireSsrsLeaseResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\SqlInstancesAcquireSsrsLeaseResponse;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* @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 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();
// Call the API and handle any network failures.
try {
/** @var SqlInstancesAcquireSsrsLeaseResponse $response */
$response = $sqlInstancesServiceClient->acquireSsrsLease($instance, $project);
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);
}
addServerCa
Add a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->addServerCa();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
The ID of the Cloud SQL instance to be cloned (source). This does not include the project ID. |
↳ project |
string
Project ID of the source as well as the clone Cloud SQL instance. |
↳ body |
InstancesCloneRequest
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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 clone_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->clone();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the Cloud SQL project. |
↳ body |
SslCertsCreateEphemeralRequest
|
↳ 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\V1beta4\SslCert |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1beta4\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();
// Call the API and handle any network failures.
try {
/** @var SslCert $response */
$response = $sqlInstancesServiceClient->createEphemeral();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance to be deleted. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->delete();
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.
Parameters | |
---|---|
Name | Description |
instance |
string
Required. The name of the Cloud SQL instance. |
project |
string
Required. The project ID of the project that contains the instance. |
optionalArgs |
array
Optional. |
↳ body |
InstancesDemoteRequest
The request body. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* @param string $instance The name of the Cloud SQL instance.
* @param string $project The project ID of the project that contains the instance.
*/
function demote_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->demote($instance, $project);
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]';
demote_sample($instance, $project);
}
demoteMaster
Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance name. |
↳ project |
string
ID of the project that contains the instance. |
↳ body |
InstancesDemoteMasterRequest
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->demoteMaster();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
export
Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
The Cloud SQL instance ID. This doesn't include the project ID. |
↳ project |
string
Project ID of the project that contains the instance to be exported. |
↳ body |
InstancesExportRequest
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->export();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
ID of the project that contains the read replica. |
↳ body |
InstancesFailoverRequest
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->failover();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Database instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ 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\V1beta4\DatabaseInstance |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\DatabaseInstance;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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_sample(): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Call the API and handle any network failures.
try {
/** @var DatabaseInstance $response */
$response = $sqlInstancesServiceClient->get();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getDiskShrinkConfig
Get Disk Shrink Config for a given instance.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ 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\V1beta4\SqlInstancesGetDiskShrinkConfigResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\SqlInstancesGetDiskShrinkConfigResponse;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var SqlInstancesGetDiskShrinkConfigResponse $response */
$response = $sqlInstancesServiceClient->getDiskShrinkConfig();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ 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\V1beta4\SqlInstancesGetLatestRecoveryTimeResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\SqlInstancesGetLatestRecoveryTimeResponse;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var SqlInstancesGetLatestRecoveryTimeResponse $response */
$response = $sqlInstancesServiceClient->getLatestRecoveryTime();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ body |
InstancesImportRequest
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->import();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ project |
string
Project ID of the project to which the newly created Cloud SQL instances should belong. |
↳ body |
DatabaseInstance
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->insert();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ filter |
string
A filter expression that filters resources listed in the response. The expression is in the form of field:value. For example, 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per their JSON representation, such as 'settings.userLabels.auto_start:true'. Multiple filter queries are space-separated. For example. 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. |
↳ maxResults |
int
The maximum number of instances to return. The service may return fewer than this value. If unspecified, at most 500 instances are returned. The maximum value is 1000; values above 1000 are coerced to 1000. |
↳ pageToken |
string
A previously-returned page token representing part of the larger set of results to view. |
↳ project |
string
Project ID of the project for which to list Cloud SQL instances. |
↳ 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\V1beta4\InstancesListResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\InstancesListResponse;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var InstancesListResponse $response */
$response = $sqlInstancesServiceClient->list();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ 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\V1beta4\InstancesListServerCasResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\InstancesListServerCasResponse;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var InstancesListServerCasResponse $response */
$response = $sqlInstancesServiceClient->listServerCas();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
patch
Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ body |
DatabaseInstance
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->patch();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ body |
PerformDiskShrinkContext
Perform disk shrink context. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->performDiskShrink();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
promoteReplica
Promotes the read replica instance to be an independent Cloud SQL primary instance.
Using this operation might cause your instance to restart.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL read replica instance name. |
↳ project |
string
ID of the project that contains the read replica. |
↳ failover |
bool
Set to true to invoke a replica failover to the designated DR replica. As part of replica failover, the promote operation attempts to add the original primary instance as a replica of the promoted DR replica when the original primary instance comes back online. If set to false or not specified, then the original primary instance becomes an independent Cloud SQL primary instance. Only applicable to MySQL. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->promoteReplica();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
ID of the project that contains the instance. |
↳ body |
InstancesReencryptRequest
Reencrypt body that users request |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->reencrypt();
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).
Parameters | |
---|---|
Name | Description |
instance |
string
Required. The 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). |
project |
string
Required. The ID of the project that contains the instance (Example: project-id). |
optionalArgs |
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\V1beta4\SqlInstancesReleaseSsrsLeaseResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\SqlInstancesReleaseSsrsLeaseResponse;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* @param string $instance The 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 The ID of the project that contains the instance (Example:
* project-id).
*/
function release_ssrs_lease_sample(string $instance, string $project): void
{
// Create a client.
$sqlInstancesServiceClient = new SqlInstancesServiceClient();
// Call the API and handle any network failures.
try {
/** @var SqlInstancesReleaseSsrsLeaseResponse $response */
$response = $sqlInstancesServiceClient->releaseSsrsLease($instance, $project);
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
ID of the project that contains the instance. |
↳ body |
SqlInstancesRescheduleMaintenanceRequestBody
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->rescheduleMaintenance();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL read replica instance name. |
↳ project |
string
ID of the project that contains the read replica. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->resetReplicaSize();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->resetSslConfig();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance to be restarted. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->restart();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ body |
InstancesRestoreBackupRequest
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->restoreBackup();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
rotateServerCa
Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ body |
InstancesRotateServerCaRequest
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->rotateServerCa();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
startExternalSync
Start External primary instance migration.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
ID of the project that contains the instance. |
↳ syncMode |
int
External sync mode. For allowed values, use constants defined on Google\Cloud\Sql\V1beta4\SqlInstancesVerifyExternalSyncSettingsRequest\ExternalSyncMode |
↳ skipVerification |
bool
Whether to skip the verification step (VESS). |
↳ mysqlSyncConfig |
MySqlSyncConfig
MySQL-specific settings for start external sync. |
↳ syncParallelLevel |
int
Optional. Parallel level for initial data sync. Currently only applicable for MySQL. For allowed values, use constants defined on Google\Cloud\Sql\V1beta4\ExternalSyncParallelLevel |
↳ migrationType |
int
Optional. MigrationType configures the migration to use physical files or logical dump files. If not set, then the logical dump file configuration is used. Valid values are |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->startExternalSync();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL read replica instance name. |
↳ project |
string
ID of the project that contains the read replica. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->startReplica();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL read replica instance name. |
↳ project |
string
ID of the project that contains the read replica. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->stopReplica();
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 designated DR replica instance.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL read replica instance name. |
↳ project |
string
ID of the project that contains the replica. |
↳ dbTimeout |
Duration
Optional. (MySQL only) Cloud SQL instance operations timeout, which is a sum of all database operations. Default value is 10 minutes and can be modified to a maximum value of 24 hours. |
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->switchover();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the Cloud SQL project. |
↳ body |
InstancesTruncateLogRequest
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->truncateLog();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ body |
DatabaseInstance
|
↳ 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\V1beta4\Operation |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\Operation;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
/**
* 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();
// Call the API and handle any network failures.
try {
/** @var Operation $response */
$response = $sqlInstancesServiceClient->update();
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.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ instance |
string
Cloud SQL instance ID. This does not include the project ID. |
↳ project |
string
Project ID of the project that contains the instance. |
↳ verifyConnectionOnly |
bool
Flag to enable verifying connection only |
↳ syncMode |
int
External sync mode For allowed values, use constants defined on Google\Cloud\Sql\V1beta4\SqlInstancesVerifyExternalSyncSettingsRequest\ExternalSyncMode |
↳ verifyReplicationOnly |
bool
Optional. Flag to verify settings required by replication setup only |
↳ mysqlSyncConfig |
MySqlSyncConfig
Optional. MySQL-specific settings for start external sync. |
↳ migrationType |
int
Optional. MigrationType configures the migration to use physical files or logical dump files. If not set, then the logical dump file configuration is used. Valid values are |
↳ syncParallelLevel |
int
Optional. Parallel level for initial data sync. Only applicable for PostgreSQL. For allowed values, use constants defined on Google\Cloud\Sql\V1beta4\ExternalSyncParallelLevel |
↳ 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\V1beta4\SqlInstancesVerifyExternalSyncSettingsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Sql\V1beta4\SqlInstancesServiceClient;
use Google\Cloud\Sql\V1beta4\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();
// Call the API and handle any network failures.
try {
/** @var SqlInstancesVerifyExternalSyncSettingsResponse $response */
$response = $sqlInstancesServiceClient->verifyExternalSyncSettings();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
Constants
SERVICE_NAME
Value: 'google.cloud.sql.v1beta4.SqlInstancesService'
The name of the service.
SERVICE_ADDRESS
Value: 'sqladmin.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.