Reference documentation and code samples for the Google Cloud AlloyDB for PostgreSQL V1 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.
This service has a new (beta) implementation. See Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient to use the new surface.
Namespace
Google \ Cloud \ AlloyDb \ V1Methods
__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\V1\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\V1\BatchCreateInstancesRequest;
use Google\Cloud\AlloyDb\V1\BatchCreateInstancesResponse;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\CreateInstanceRequest;
use Google\Cloud\AlloyDb\V1\CreateInstanceRequests;
use Google\Cloud\AlloyDb\V1\Instance;
use Google\Cloud\AlloyDb\V1\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 the request message.
$requestsCreateInstanceRequestsInstance = (new Instance())
->setInstanceType($requestsCreateInstanceRequestsInstanceInstanceType);
$createInstanceRequest = (new CreateInstanceRequest())
->setParent($formattedRequestsCreateInstanceRequestsParent)
->setInstanceId($requestsCreateInstanceRequestsInstanceId)
->setInstance($requestsCreateInstanceRequestsInstance);
$requestsCreateInstanceRequests = [$createInstanceRequest,];
$requests = (new CreateInstanceRequests())
->setCreateInstanceRequests($requestsCreateInstanceRequests);
$request = (new BatchCreateInstancesRequest())
->setParent($formattedParent)
->setRequests($requests);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->batchCreateInstances($request);
$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\V1\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\V1\Backup;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\CreateBackupRequest;
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 the request message.
$backup = (new Backup())
->setClusterName($formattedBackupClusterName);
$request = (new CreateBackupRequest())
->setParent($formattedParent)
->setBackupId($backupId)
->setBackup($backup);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createBackup($request);
$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\V1\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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Cluster;
use Google\Cloud\AlloyDb\V1\CreateClusterRequest;
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}/global/networks/{network_id}". This is required
* to create a cluster. Deprecated, use network_config.network instead. 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 the request message.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
$request = (new CreateClusterRequest())
->setParent($formattedParent)
->setClusterId($clusterId)
->setCluster($cluster);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createCluster($request);
$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\V1\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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\CreateInstanceRequest;
use Google\Cloud\AlloyDb\V1\Instance;
use Google\Cloud\AlloyDb\V1\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 the request message.
$instance = (new Instance())
->setInstanceType($instanceInstanceType);
$request = (new CreateInstanceRequest())
->setParent($formattedParent)
->setInstanceId($instanceId)
->setInstance($instance);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createInstance($request);
$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\V1\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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Cluster;
use Google\Cloud\AlloyDb\V1\CreateSecondaryClusterRequest;
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}/global/networks/{network_id}". This is required
* to create a cluster. Deprecated, use network_config.network instead. 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 the request message.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
$request = (new CreateSecondaryClusterRequest())
->setParent($formattedParent)
->setClusterId($clusterId)
->setCluster($cluster);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createSecondaryCluster($request);
$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\V1\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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\CreateSecondaryInstanceRequest;
use Google\Cloud\AlloyDb\V1\Instance;
use Google\Cloud\AlloyDb\V1\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 the request message.
$instance = (new Instance())
->setInstanceType($instanceInstanceType);
$request = (new CreateSecondaryInstanceRequest())
->setParent($formattedParent)
->setInstanceId($instanceId)
->setInstance($instance);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->createSecondaryInstance($request);
$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\V1\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\V1\User |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\CreateUserRequest;
use Google\Cloud\AlloyDb\V1\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 the request message.
$user = new User();
$request = (new CreateUserRequest())
->setParent($formattedParent)
->setUserId($userId)
->setUser($user);
// Call the API and handle any network failures.
try {
/** @var User $response */
$response = $alloyDBAdminClient->createUser($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\DeleteBackupRequest;
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();
// Prepare the request message.
$request = (new DeleteBackupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->deleteBackup($request);
$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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\DeleteClusterRequest;
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();
// Prepare the request message.
$request = (new DeleteClusterRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->deleteCluster($request);
$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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\DeleteInstanceRequest;
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();
// Prepare the request message.
$request = (new DeleteInstanceRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->deleteInstance($request);
$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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\DeleteUserRequest;
/**
* @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();
// Prepare the request message.
$request = (new DeleteUserRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$alloyDBAdminClient->deleteUser($request);
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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\FailoverInstanceRequest;
use Google\Cloud\AlloyDb\V1\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();
// Prepare the request message.
$request = (new FailoverInstanceRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->failoverInstance($request);
$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);
}
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\V1\Backup |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1\Backup;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\GetBackupRequest;
/**
* @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();
// Prepare the request message.
$request = (new GetBackupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Backup $response */
$response = $alloyDBAdminClient->getBackup($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$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\V1\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\V1\Cluster |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Cluster;
use Google\Cloud\AlloyDb\V1\GetClusterRequest;
/**
* @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();
// Prepare the request message.
$request = (new GetClusterRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Cluster $response */
$response = $alloyDBAdminClient->getCluster($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
get_cluster_sample($formattedName);
}
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\V1\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\V1\Instance |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\GetInstanceRequest;
use Google\Cloud\AlloyDb\V1\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();
// Prepare the request message.
$request = (new GetInstanceRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Instance $response */
$response = $alloyDBAdminClient->getInstance($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$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\V1\User |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\GetUserRequest;
use Google\Cloud\AlloyDb\V1\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();
// Prepare the request message.
$request = (new GetUserRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var User $response */
$response = $alloyDBAdminClient->getUser($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$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\V1\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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\InjectFaultRequest;
use Google\Cloud\AlloyDb\V1\InjectFaultRequest\FaultType;
use Google\Cloud\AlloyDb\V1\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();
// Prepare the request message.
$request = (new InjectFaultRequest())
->setFaultType($faultType)
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->injectFault($request);
$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\V1\Backup;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\ListBackupsRequest;
/**
* @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();
// Prepare the request message.
$request = (new ListBackupsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listBackups($request);
/** @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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Cluster;
use Google\Cloud\AlloyDb\V1\ListClustersRequest;
/**
* @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();
// Prepare the request message.
$request = (new ListClustersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listClusters($request);
/** @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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Instance;
use Google\Cloud\AlloyDb\V1\ListInstancesRequest;
/**
* @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();
// Prepare the request message.
$request = (new ListInstancesRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listInstances($request);
/** @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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\ListSupportedDatabaseFlagsRequest;
use Google\Cloud\AlloyDb\V1\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();
// Prepare the request message.
$request = (new ListSupportedDatabaseFlagsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listSupportedDatabaseFlags($request);
/** @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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\ListUsersRequest;
use Google\Cloud\AlloyDb\V1\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();
// Prepare the request message.
$request = (new ListUsersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listUsers($request);
/** @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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Cluster;
use Google\Cloud\AlloyDb\V1\PromoteClusterRequest;
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();
// Prepare the request message.
$request = (new PromoteClusterRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->promoteCluster($request);
$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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Instance;
use Google\Cloud\AlloyDb\V1\RestartInstanceRequest;
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();
// Prepare the request message.
$request = (new RestartInstanceRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->restartInstance($request);
$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\V1\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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Cluster;
use Google\Cloud\AlloyDb\V1\RestoreClusterRequest;
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}/global/networks/{network_id}". This is required
* to create a cluster. Deprecated, use network_config.network instead. 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 the request message.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
$request = (new RestoreClusterRequest())
->setParent($formattedParent)
->setClusterId($clusterId)
->setCluster($cluster);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->restoreCluster($request);
$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\V1\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\V1\Backup;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\UpdateBackupRequest;
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 the request message.
$backup = (new Backup())
->setClusterName($formattedBackupClusterName);
$request = (new UpdateBackupRequest())
->setBackup($backup);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->updateBackup($request);
$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\V1\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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Cluster;
use Google\Cloud\AlloyDb\V1\UpdateClusterRequest;
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}/global/networks/{network_id}". This is required
* to create a cluster. Deprecated, use network_config.network instead. Please see
* {@see AlloyDBAdminClient::networkName()} for help formatting this field.
*/
function update_cluster_sample(string $formattedClusterNetwork): void
{
// Create a client.
$alloyDBAdminClient = new AlloyDBAdminClient();
// Prepare the request message.
$cluster = (new Cluster())
->setNetwork($formattedClusterNetwork);
$request = (new UpdateClusterRequest())
->setCluster($cluster);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->updateCluster($request);
$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\V1\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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\Instance;
use Google\Cloud\AlloyDb\V1\Instance\InstanceType;
use Google\Cloud\AlloyDb\V1\UpdateInstanceRequest;
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 the request message.
$instance = (new Instance())
->setInstanceType($instanceInstanceType);
$request = (new UpdateInstanceRequest())
->setInstance($instance);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $alloyDBAdminClient->updateInstance($request);
$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\V1\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\V1\User |
use Google\ApiCore\ApiException;
use Google\Cloud\AlloyDb\V1\Client\AlloyDBAdminClient;
use Google\Cloud\AlloyDb\V1\UpdateUserRequest;
use Google\Cloud\AlloyDb\V1\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 the request message.
$user = new User();
$request = (new UpdateUserRequest())
->setUser($user);
// Call the API and handle any network failures.
try {
/** @var User $response */
$response = $alloyDBAdminClient->updateUser($request);
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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\Location\GetLocationRequest;
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();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $alloyDBAdminClient->getLocation($request);
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\V1\Client\AlloyDBAdminClient;
use Google\Cloud\Location\ListLocationsRequest;
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();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $alloyDBAdminClient->listLocations($request);
/** @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.v1.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.