Reference documentation and code samples for the Google Cloud AlloyDB for PostgreSQL V1beta Client class AlloyDBAdminClient.
Service Description: Service describing handlers for resources
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:
$alloyDBAdminClient = new AlloyDBAdminClient();
try {
$formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
$requests = new CreateInstanceRequests();
$operationResponse = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'batchCreateInstances');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$alloyDBAdminClient->close();
}
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 \ AlloyDb \ V1betaMethods
__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. |
batchCreateInstances
Creates new instances under the given project, location and cluster.
There can be only one primary instance in a cluster. If the primary instance exists in the cluster as well as this request, then API will throw an error. The primary instance should exist before any read pool instance is created. If the primary instance is a part of the request payload, then the API will take care of creating instances in the correct order. This method is here to support Google-internal use cases, and is not meant for external customers to consume. Please do not start relying on it; its behavior is subject to change without notice.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. |
requests |
Google\Cloud\AlloyDb\V1beta\CreateInstanceRequests
Required. Resources being created. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\BatchCreateInstancesResponse;
use Google\Cloud\AlloyDb\V1beta\CreateInstanceRequest;
use Google\Cloud\AlloyDb\V1beta\CreateInstanceRequests;
use Google\Cloud\AlloyDb\V1beta\Instance;
use Google\Cloud\AlloyDb\V1beta\Instance\InstanceType;
use Google\Rpc\Status;
/**
* @param string $formattedParent The name of the parent resource. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
* @param string $formattedRequestsCreateInstanceRequestsParent The name of the parent resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
* @param string $requestsCreateInstanceRequestsInstanceId ID of the requesting object.
* @param int $requestsCreateInstanceRequestsInstanceInstanceType The type of the instance. Specified at creation time.
*/
function batch_create_instances_sample(
string $formattedParent,
string $formattedRequestsCreateInstanceRequestsParent,
string $requestsCreateInstanceRequestsInstanceId,
int $requestsCreateInstanceRequestsInstanceInstanceType
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$requestsCreateInstanceRequestsInstance = (new Instance())
->setInstanceType($requestsCreateInstanceRequestsInstanceInstanceType);
$createInstanceRequest = (new CreateInstanceRequest())
->setParent($formattedRequestsCreateInstanceRequestsParent)
->setInstanceId($requestsCreateInstanceRequestsInstanceId)
->setInstance($requestsCreateInstanceRequestsInstance);
$requestsCreateInstanceRequests = [$createInstanceRequest,];
$requests = (new CreateInstanceRequests())
->setCreateInstanceRequests($requestsCreateInstanceRequests);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BatchCreateInstancesResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
$formattedRequestsCreateInstanceRequestsParent = AlloyDBAdminClient::clusterName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]'
);
$requestsCreateInstanceRequestsInstanceId = '[INSTANCE_ID]';
$requestsCreateInstanceRequestsInstanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED;
batch_create_instances_sample(
$formattedParent,
$formattedRequestsCreateInstanceRequestsParent,
$requestsCreateInstanceRequestsInstanceId,
$requestsCreateInstanceRequestsInstanceInstanceType
);
}
createBackup
Creates a new Backup in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Value for parent. |
backupId |
string
Required. ID of the requesting object. |
backup |
Google\Cloud\AlloyDb\V1beta\Backup
Required. The resource being created |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, the backend validates the request, but doesn't actually execute it. |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Backup;
use Google\Rpc\Status;
/**
* @param string $formattedParent Value for parent. Please see
* {@see AlloyDBAdminClient::locationName()} for help formatting this field.
* @param string $backupId ID of the requesting object.
* @param string $formattedBackupClusterName The full resource name of the backup source cluster
* (e.g., projects/{project}/locations/{region}/clusters/{cluster_id}). Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function create_backup_sample(
string $formattedParent,
string $backupId,
string $formattedBackupClusterName
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$backup = (new Backup())
->setClusterName($formattedBackupClusterName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createBackup($formattedParent, $backupId, $backup);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Backup $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedParent = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]');
$backupId = '[BACKUP_ID]';
$formattedBackupClusterName = AlloyDBAdminClient::clusterName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]'
);
create_backup_sample($formattedParent, $backupId, $formattedBackupClusterName);
}
createCluster
Creates a new Cluster in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The location of the new cluster. For the required format, see the comment on the Cluster.name field. |
clusterId |
string
Required. ID of the requesting object. |
cluster |
Google\Cloud\AlloyDb\V1beta\Cluster
Required. The resource being created |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the create 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Cluster;
use Google\Rpc\Status;
/**
* @param string $formattedParent The location of the new cluster. For the required format, see the
* comment on the Cluster.name field. Please see
* {@see AlloyDBAdminClient::locationName()} for help formatting this field.
* @param string $clusterId ID of the requesting object.
* @param string $formattedClusterNetwork The resource link for the VPC network in which cluster resources
* are created and from which they are accessible via Private IP. The network
* must belong to the same project as the cluster. It is specified in the
* form: "projects/{project_number}/global/networks/{network_id}". This is
* required to create a cluster. It can be updated, but it cannot be removed. Please see
* {@see AlloyDBAdminClient::networkName()} for help formatting this field.
*/
function create_cluster_sample(
string $formattedParent,
string $clusterId,
string $formattedClusterNetwork
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Cluster $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedParent = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]');
$clusterId = '[CLUSTER_ID]';
$formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]');
create_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork);
}
createInstance
Creates a new Instance in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. For the required format, see the comment on the Instance.name field. |
instanceId |
string
Required. ID of the requesting object. |
instance |
Google\Cloud\AlloyDb\V1beta\Instance
Required. The resource being created |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the create 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Instance;
use Google\Cloud\AlloyDb\V1beta\Instance\InstanceType;
use Google\Rpc\Status;
/**
* @param string $formattedParent The name of the parent resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
* @param string $instanceId ID of the requesting object.
* @param int $instanceInstanceType The type of the instance. Specified at creation time.
*/
function create_instance_sample(
string $formattedParent,
string $instanceId,
int $instanceInstanceType
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$instance = (new Instance())
->setInstanceType($instanceInstanceType);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createInstance($formattedParent, $instanceId, $instance);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Instance $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
$instanceId = '[INSTANCE_ID]';
$instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED;
create_instance_sample($formattedParent, $instanceId, $instanceInstanceType);
}
createSecondaryCluster
Creates a cluster of type SECONDARY in the given location using the primary cluster as the source.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The location of the new cluster. For the required format, see the comment on the Cluster.name field. |
clusterId |
string
Required. ID of the requesting object (the secondary cluster). |
cluster |
Google\Cloud\AlloyDb\V1beta\Cluster
Required. Configuration of the requesting object (the secondary cluster). |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the create 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Cluster;
use Google\Rpc\Status;
/**
* @param string $formattedParent The location of the new cluster. For the required
* format, see the comment on the Cluster.name field. Please see
* {@see AlloyDBAdminClient::locationName()} for help formatting this field.
* @param string $clusterId ID of the requesting object (the secondary cluster).
* @param string $formattedClusterNetwork The resource link for the VPC network in which cluster resources
* are created and from which they are accessible via Private IP. The network
* must belong to the same project as the cluster. It is specified in the
* form: "projects/{project_number}/global/networks/{network_id}". This is
* required to create a cluster. It can be updated, but it cannot be removed. Please see
* {@see AlloyDBAdminClient::networkName()} for help formatting this field.
*/
function create_secondary_cluster_sample(
string $formattedParent,
string $clusterId,
string $formattedClusterNetwork
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createSecondaryCluster($formattedParent, $clusterId, $cluster);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Cluster $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedParent = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]');
$clusterId = '[CLUSTER_ID]';
$formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]');
create_secondary_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork);
}
createSecondaryInstance
Creates a new SECONDARY Instance in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. For the required format, see the comment on the Instance.name field. |
instanceId |
string
Required. ID of the requesting object. |
instance |
Google\Cloud\AlloyDb\V1beta\Instance
Required. The resource being created |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the create 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Instance;
use Google\Cloud\AlloyDb\V1beta\Instance\InstanceType;
use Google\Rpc\Status;
/**
* @param string $formattedParent The name of the parent resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
* @param string $instanceId ID of the requesting object.
* @param int $instanceInstanceType The type of the instance. Specified at creation time.
*/
function create_secondary_instance_sample(
string $formattedParent,
string $instanceId,
int $instanceInstanceType
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$instance = (new Instance())
->setInstanceType($instanceInstanceType);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createSecondaryInstance($formattedParent, $instanceId, $instance);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Instance $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
$instanceId = '[INSTANCE_ID]';
$instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED;
create_secondary_instance_sample($formattedParent, $instanceId, $instanceInstanceType);
}
createUser
Creates a new User in a given project, location, and cluster.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Value for parent. |
userId |
string
Required. ID of the requesting object. |
user |
Google\Cloud\AlloyDb\V1beta\User
Required. The resource being created |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, the backend validates the request, but doesn't actually execute it. |
↳ 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\AlloyDb\V1beta\User |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\User;
/**
* @param string $formattedParent Value for parent. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
* @param string $userId ID of the requesting object.
*/
function create_user_sample(string $formattedParent, string $userId): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$user = new User();
// Call the API and handle any network failures.
try {
/** @var User $response */
$response = $alloyDBAdminClient->createUser($formattedParent, $userId, $user);
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
{
$formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
$userId = '[USER_ID]';
create_user_sample($formattedParent, $userId);
}
deleteBackup
Deletes a single Backup.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource. For the required format, see the comment on the Backup.name field. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, the backend validates the request, but doesn't actually execute it. |
↳ etag |
string
Optional. The current etag of the Backup. If an etag is provided and does not match the current etag of the Backup, deletion will be blocked and an ABORTED error will be returned. |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the resource. For the required format, see the comment on
* the Backup.name field. Please see
* {@see AlloyDBAdminClient::backupName()} for help formatting this field.
*/
function delete_backup_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->deleteBackup($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedName = AlloyDBAdminClient::backupName('[PROJECT]', '[LOCATION]', '[BACKUP]');
delete_backup_sample($formattedName);
}
deleteCluster
Deletes a single Cluster.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the Cluster.name field. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ etag |
string
Optional. The current etag of the Cluster. If an etag is provided and does not match the current etag of the Cluster, deletion will be blocked and an ABORTED error will be returned. |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the delete. |
↳ force |
bool
Optional. Whether to cascade delete child instances for given cluster. |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the Cluster.name field. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function delete_cluster_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->deleteCluster($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
delete_cluster_sample($formattedName);
}
deleteInstance
Deletes a single Instance.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the Instance.name field. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ etag |
string
Optional. The current etag of the Instance. If an etag is provided and does not match the current etag of the Instance, deletion will be blocked and an ABORTED error will be returned. |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the delete. |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::instanceName()} for help formatting this field.
*/
function delete_instance_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->deleteInstance($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedName = AlloyDBAdminClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]',
'[INSTANCE]'
);
delete_instance_sample($formattedName);
}
deleteUser
Deletes a single User.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the User.name field. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, the backend validates the request, but doesn't actually execute it. |
↳ 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. |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the User.name field. Please see
* {@see AlloyDBAdminClient::userName()} for help formatting this field.
*/
function delete_user_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
$alloyDBAdminClient->deleteUser($formattedName);
printf('Call completed successfully.' . PHP_EOL);
} 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
{
$formattedName = AlloyDBAdminClient::userName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[USER]');
delete_user_sample($formattedName);
}
failoverInstance
Forces a Failover for a highly available instance.
Failover promotes the HA standby instance as the new primary. Imperative only.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the Instance.name field. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the failover. |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Instance;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::instanceName()} for help formatting this field.
*/
function failover_instance_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->failoverInstance($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Instance $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedName = AlloyDBAdminClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]',
'[INSTANCE]'
);
failover_instance_sample($formattedName);
}
generateClientCertificate
Generate a client certificate signed by a Cluster CA.
The sole purpose of this endpoint is to support the Auth Proxy client and the endpoint's behavior is subject to change without notice, so do not rely on its behavior remaining constant. Future changes will not break the Auth Proxy client.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. The required format is:
|
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ pemCsr |
string
Optional. A pem-encoded X.509 certificate signing request (CSR). |
↳ certDuration |
Duration
Optional. An optional hint to the endpoint to generate the client certificate with the requested duration. The duration can be from 1 hour to 24 hours. The endpoint may or may not honor the hint. If the hint is left unspecified or is not honored, then the endpoint will pick an appropriate default duration. |
↳ publicKey |
string
Optional. The public key from the client. |
↳ 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\AlloyDb\V1beta\GenerateClientCertificateResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\GenerateClientCertificateResponse;
/**
* @param string $formattedParent The name of the parent resource. The required format is:
* * projects/{project}/locations/{location}/clusters/{cluster}
* Please see {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function generate_client_certificate_sample(string $formattedParent): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var GenerateClientCertificateResponse $response */
$response = $alloyDBAdminClient->generateClientCertificate($formattedParent);
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
{
$formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
generate_client_certificate_sample($formattedParent);
}
getBackup
Gets details of a single Backup.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the resource |
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\AlloyDb\V1beta\Backup |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Backup;
/**
* @param string $formattedName Name of the resource
* Please see {@see AlloyDBAdminClient::backupName()} for help formatting this field.
*/
function get_backup_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var Backup $response */
$response = $alloyDBAdminClient->getBackup($formattedName);
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
{
$formattedName = AlloyDBAdminClient::backupName('[PROJECT]', '[LOCATION]', '[BACKUP]');
get_backup_sample($formattedName);
}
getCluster
Gets details of a single Cluster.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the Cluster.name field. |
optionalArgs |
array
Optional. |
↳ view |
int
Optional. The view of the cluster to return. Returns all default fields if not set. For allowed values, use constants defined on Google\Cloud\AlloyDb\V1beta\ClusterView |
↳ 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\AlloyDb\V1beta\Cluster |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Cluster;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the Cluster.name field. Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function get_cluster_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var Cluster $response */
$response = $alloyDBAdminClient->getCluster($formattedName);
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
{
$formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
get_cluster_sample($formattedName);
}
getConnectionInfo
Get instance metadata used for a connection.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. The required format is: projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ 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\AlloyDb\V1beta\ConnectionInfo |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\ConnectionInfo;
/**
* @param string $formattedParent The name of the parent resource. The required format is:
* projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}
* Please see {@see AlloyDBAdminClient::instanceName()} for help formatting this field.
*/
function get_connection_info_sample(string $formattedParent): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var ConnectionInfo $response */
$response = $alloyDBAdminClient->getConnectionInfo($formattedParent);
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
{
$formattedParent = AlloyDBAdminClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]',
'[INSTANCE]'
);
get_connection_info_sample($formattedParent);
}
getInstance
Gets details of a single Instance.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the Instance.name field. |
optionalArgs |
array
Optional. |
↳ view |
int
The view of the instance to return. For allowed values, use constants defined on Google\Cloud\AlloyDb\V1beta\InstanceView |
↳ 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\AlloyDb\V1beta\Instance |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Instance;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::instanceName()} for help formatting this field.
*/
function get_instance_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var Instance $response */
$response = $alloyDBAdminClient->getInstance($formattedName);
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
{
$formattedName = AlloyDBAdminClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]',
'[INSTANCE]'
);
get_instance_sample($formattedName);
}
getUser
Gets details of a single User.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the User.name field. |
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\AlloyDb\V1beta\User |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\User;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the User.name field. Please see
* {@see AlloyDBAdminClient::userName()} for help formatting this field.
*/
function get_user_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var User $response */
$response = $alloyDBAdminClient->getUser($formattedName);
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
{
$formattedName = AlloyDBAdminClient::userName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[USER]');
get_user_sample($formattedName);
}
injectFault
Injects fault in an instance.
Imperative only.
Parameters | |
---|---|
Name | Description |
faultType |
int
Required. The type of fault to be injected in an instance. For allowed values, use constants defined on Google\Cloud\AlloyDb\V1beta\InjectFaultRequest\FaultType |
name |
string
Required. The name of the resource. For the required format, see the comment on the Instance.name field. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the fault injection. |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\InjectFaultRequest\FaultType;
use Google\Cloud\AlloyDb\V1beta\Instance;
use Google\Rpc\Status;
/**
* @param int $faultType The type of fault to be injected in an instance.
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::instanceName()} for help formatting this field.
*/
function inject_fault_sample(int $faultType, string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->injectFault($faultType, $formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Instance $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$faultType = FaultType::FAULT_TYPE_UNSPECIFIED;
$formattedName = AlloyDBAdminClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]',
'[INSTANCE]'
);
inject_fault_sample($faultType, $formattedName);
}
listBackups
Lists Backups in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Parent value for ListBackupsRequest |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ filter |
string
Filtering results |
↳ orderBy |
string
Hint for how to order the results |
↳ 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\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Backup;
/**
* @param string $formattedParent Parent value for ListBackupsRequest
* Please see {@see AlloyDBAdminClient::locationName()} for help formatting this field.
*/
function list_backups_sample(string $formattedParent): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listBackups($formattedParent);
/** @var Backup $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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
{
$formattedParent = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]');
list_backups_sample($formattedParent);
}
listClusters
Lists Clusters in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. For the required format, see the comment on the Cluster.name field. Additionally, you can perform an aggregated list operation by specifying a value with the following format:
|
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ filter |
string
Optional. Filtering results |
↳ orderBy |
string
Optional. Hint for how to order the results |
↳ 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\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Cluster;
/**
* @param string $formattedParent The name of the parent resource. For the required format, see the
* comment on the Cluster.name field. Additionally, you can perform an
* aggregated list operation by specifying a value with the following format:
* * projects/{project}/locations/-
* Please see {@see AlloyDBAdminClient::locationName()} for help formatting this field.
*/
function list_clusters_sample(string $formattedParent): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listClusters($formattedParent);
/** @var Cluster $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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
{
$formattedParent = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]');
list_clusters_sample($formattedParent);
}
listInstances
Lists Instances in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. For the required format, see the comment on the Instance.name field. Additionally, you can perform an aggregated list operation by specifying a value with one of the following formats:
|
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ filter |
string
Optional. Filtering results |
↳ orderBy |
string
Optional. Hint for how to order the results |
↳ 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\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Instance;
/**
* @param string $formattedParent The name of the parent resource. For the required format, see the
* comment on the Instance.name field. Additionally, you can perform an
* aggregated list operation by specifying a value with one of the following
* formats:
* * projects/{project}/locations/-/clusters/-
* * projects/{project}/locations/{region}/clusters/-
* Please see {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function list_instances_sample(string $formattedParent): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listInstances($formattedParent);
/** @var Instance $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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
{
$formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
list_instances_sample($formattedParent);
}
listSupportedDatabaseFlags
Lists SupportedDatabaseFlags for a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. The required format is:
Regardless of the parent specified here, as long it is contains a valid project and location, the service will return a static list of supported flags resources. Note that we do not yet support region-specific flags. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ 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\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag;
/**
* @param string $formattedParent The name of the parent resource. The required format is:
* * projects/{project}/locations/{location}
*
* Regardless of the parent specified here, as long it is contains a valid
* project and location, the service will return a static list of supported
* flags resources. Note that we do not yet support region-specific
* flags. Please see
* {@see AlloyDBAdminClient::locationName()} for help formatting this field.
*/
function list_supported_database_flags_sample(string $formattedParent): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listSupportedDatabaseFlags($formattedParent);
/** @var SupportedDatabaseFlag $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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
{
$formattedParent = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]');
list_supported_database_flags_sample($formattedParent);
}
listUsers
Lists Users in a given project and location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. Parent value for ListUsersRequest |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ filter |
string
Optional. Filtering results |
↳ orderBy |
string
Optional. Hint for how to order the results |
↳ 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\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\User;
/**
* @param string $formattedParent Parent value for ListUsersRequest
* Please see {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function list_users_sample(string $formattedParent): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listUsers($formattedParent);
/** @var User $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->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
{
$formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
list_users_sample($formattedParent);
}
promoteCluster
Promotes a SECONDARY cluster. This turns down replication from the PRIMARY cluster and promotes a secondary cluster into its own standalone cluster.
Imperative only.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the Cluster.name field |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ etag |
string
Optional. The current etag of the Cluster. If an etag is provided and does not match the current etag of the Cluster, deletion will be blocked and an ABORTED error will be returned. |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the delete. |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Cluster;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the Cluster.name field
* Please see {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function promote_cluster_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->promoteCluster($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Cluster $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
promote_cluster_sample($formattedName);
}
restartInstance
Restart an Instance in a cluster.
Imperative only.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the resource. For the required format, see the comment on the Instance.name field. |
optionalArgs |
array
Optional. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the restart. |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Instance;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the resource. For the required format, see the
* comment on the Instance.name field. Please see
* {@see AlloyDBAdminClient::instanceName()} for help formatting this field.
*/
function restart_instance_sample(string $formattedName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->restartInstance($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Instance $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedName = AlloyDBAdminClient::instanceName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]',
'[INSTANCE]'
);
restart_instance_sample($formattedName);
}
restoreCluster
Creates a new Cluster in a given project and location, with a volume restored from the provided source, either a backup ID or a point-in-time and a source cluster.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the parent resource. For the required format, see the comment on the Cluster.name field. |
clusterId |
string
Required. ID of the requesting object. |
cluster |
Google\Cloud\AlloyDb\V1beta\Cluster
Required. The resource being created |
optionalArgs |
array
Optional. |
↳ backupSource |
BackupSource
Backup source. |
↳ continuousBackupSource |
ContinuousBackupSource
ContinuousBackup source. Continuous backup needs to be enabled in the source cluster for this operation to succeed. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the import 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Cluster;
use Google\Rpc\Status;
/**
* @param string $formattedParent The name of the parent resource. For the required format, see the
* comment on the Cluster.name field. Please see
* {@see AlloyDBAdminClient::locationName()} for help formatting this field.
* @param string $clusterId ID of the requesting object.
* @param string $formattedClusterNetwork The resource link for the VPC network in which cluster resources
* are created and from which they are accessible via Private IP. The network
* must belong to the same project as the cluster. It is specified in the
* form: "projects/{project_number}/global/networks/{network_id}". This is
* required to create a cluster. It can be updated, but it cannot be removed. Please see
* {@see AlloyDBAdminClient::networkName()} for help formatting this field.
*/
function restore_cluster_sample(
string $formattedParent,
string $clusterId,
string $formattedClusterNetwork
): void {
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Cluster $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedParent = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]');
$clusterId = '[CLUSTER_ID]';
$formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]');
restore_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork);
}
updateBackup
Updates the parameters of a single Backup.
Parameters | |
---|---|
Name | Description |
backup |
Google\Cloud\AlloyDb\V1beta\Backup
Required. The resource being updated |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Optional. Field mask is used to specify the fields to be overwritten in the Backup resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, the backend validates the request, but doesn't actually execute it. |
↳ allowMissing |
bool
Optional. If set to true, update succeeds even if instance is not found. In that case, a new backup is created and |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Backup;
use Google\Rpc\Status;
/**
* @param string $formattedBackupClusterName The full resource name of the backup source cluster
* (e.g., projects/{project}/locations/{region}/clusters/{cluster_id}). Please see
* {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
*/
function update_backup_sample(string $formattedBackupClusterName): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$backup = (new Backup())
->setClusterName($formattedBackupClusterName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->updateBackup($backup);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Backup $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedBackupClusterName = AlloyDBAdminClient::clusterName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]'
);
update_backup_sample($formattedBackupClusterName);
}
updateCluster
Updates the parameters of a single Cluster.
Parameters | |
---|---|
Name | Description |
cluster |
Google\Cloud\AlloyDb\V1beta\Cluster
Required. The resource being updated |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Optional. Field mask is used to specify the fields to be overwritten in the Cluster resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the update request. |
↳ allowMissing |
bool
Optional. If set to true, update succeeds even if cluster is not found. In that case, a new cluster is created and |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Cluster;
use Google\Rpc\Status;
/**
* @param string $formattedClusterNetwork The resource link for the VPC network in which cluster resources
* are created and from which they are accessible via Private IP. The network
* must belong to the same project as the cluster. It is specified in the
* form: "projects/{project_number}/global/networks/{network_id}". This is
* required to create a cluster. It can be updated, but it cannot be removed. Please see
* {@see AlloyDBAdminClient::networkName()} for help formatting this field.
*/
function update_cluster_sample(string $formattedClusterNetwork): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->updateCluster($cluster);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Cluster $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]');
update_cluster_sample($formattedClusterNetwork);
}
updateInstance
Updates the parameters of a single Instance.
Parameters | |
---|---|
Name | Description |
instance |
Google\Cloud\AlloyDb\V1beta\Instance
Required. The resource being updated |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Optional. Field mask is used to specify the fields to be overwritten in the Instance resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, performs request validation (e.g. permission checks and any other type of validation), but do not actually execute the update request. |
↳ allowMissing |
bool
Optional. If set to true, update succeeds even if instance is not found. In that case, a new instance is created and |
↳ 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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\Instance;
use Google\Cloud\AlloyDb\V1beta\Instance\InstanceType;
use Google\Rpc\Status;
/**
* @param int $instanceInstanceType The type of the instance. Specified at creation time.
*/
function update_instance_sample(int $instanceInstanceType): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$instance = (new Instance())
->setInstanceType($instanceInstanceType);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->updateInstance($instance);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Instance $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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
{
$instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED;
update_instance_sample($instanceInstanceType);
}
updateUser
Updates the parameters of a single User.
Parameters | |
---|---|
Name | Description |
user |
Google\Cloud\AlloyDb\V1beta\User
Required. The resource being updated |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Optional. Field mask is used to specify the fields to be overwritten in the User resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten. |
↳ requestId |
string
Optional. An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
↳ validateOnly |
bool
Optional. If set, the backend validates the request, but doesn't actually execute it. |
↳ allowMissing |
bool
Optional. Allow missing fields in the update mask. |
↳ 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\AlloyDb\V1beta\User |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1beta\User;
/**
* 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_user_sample(): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare any non-scalar elements to be passed along with the request.
$user = new User();
// Call the API and handle any network failures.
try {
/** @var User $response */
$response = $alloyDBAdminClient->updateUser($user);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getLocation
Gets information about a location.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ name |
string
Resource name for the location. |
↳ 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\Location\Location |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\Location\Location;
/**
* 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_location_sample(): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $alloyDBAdminClient->getLocation();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ name |
string
The resource that owns the locations collection, if applicable. |
↳ filter |
string
The standard list filter. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ 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\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AlloyDb\V1beta\AlloyDBAdminClient;
use Google\Cloud\Location\Location;
/**
* 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_locations_sample(): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listLocations();
/** @var Location $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\OperationsClient |
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
static::backupName
Formats a string containing the fully-qualified path to represent a backup resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
backup |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted backup resource. |
static::clusterName
Formats a string containing the fully-qualified path to represent a cluster resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
cluster |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted cluster resource. |
static::cryptoKeyVersionName
Formats a string containing the fully-qualified path to represent a crypto_key_version resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
keyRing |
string
|
cryptoKey |
string
|
cryptoKeyVersion |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted crypto_key_version resource. |
static::instanceName
Formats a string containing the fully-qualified path to represent a instance resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
cluster |
string
|
instance |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted instance resource. |
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location resource. |
static::networkName
Formats a string containing the fully-qualified path to represent a network resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
network |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted network resource. |
static::userName
Formats a string containing the fully-qualified path to represent a user resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
cluster |
string
|
user |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted user 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}/locations/{location}/backups/{backup}
- cluster: projects/{project}/locations/{location}/clusters/{cluster}
- cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}
- instance: projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}
- location: projects/{project}/locations/{location}
- network: projects/{project}/global/networks/{network}
- user: projects/{project}/locations/{location}/clusters/{cluster}/users/{user}
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. |
Constants
SERVICE_NAME
Value: 'google.cloud.alloydb.v1beta.AlloyDBAdmin'
The name of the service.
SERVICE_ADDRESS
Value: 'alloydb.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.