Reference documentation and code samples for the Google Cloud Gke Backup V1 Client class BackupForGKEClient.
Service Description: BackupForGKE allows Kubernetes administrators to configure, execute, and manage backup and restore operations for their GKE clusters.
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:
$backupForGKEClient = new BackupForGKEClient();
try {
$formattedParent = $backupForGKEClient->backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]');
$operationResponse = $backupForGKEClient->createBackup($formattedParent);
$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 = $backupForGKEClient->createBackup($formattedParent);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $backupForGKEClient->resumeOperation($operationName, 'createBackup');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$backupForGKEClient->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.
Methods
backupName
Formats a string containing the fully-qualified path to represent a backup resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
backupPlan |
string
|
backup |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted backup resource. |
backupPlanName
Formats a string containing the fully-qualified path to represent a backup_plan resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
backupPlan |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted backup_plan resource. |
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. |
cryptoKeyName
Formats a string containing the fully-qualified path to represent a crypto_key resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
keyRing |
string
|
cryptoKey |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted crypto_key resource. |
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. |
restoreName
Formats a string containing the fully-qualified path to represent a restore resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
restorePlan |
string
|
restore |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted restore resource. |
restorePlanName
Formats a string containing the fully-qualified path to represent a restore_plan resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
restorePlan |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted restore_plan resource. |
volumeBackupName
Formats a string containing the fully-qualified path to represent a volume_backup resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
backupPlan |
string
|
backup |
string
|
volumeBackup |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted volume_backup resource. |
volumeRestoreName
Formats a string containing the fully-qualified path to represent a volume_restore resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
restorePlan |
string
|
restore |
string
|
volumeRestore |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted volume_restore resource. |
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}/backupPlans/{backup_plan}/backups/{backup}
- backupPlan: projects/{project}/locations/{location}/backupPlans/{backup_plan}
- cluster: projects/{project}/locations/{location}/clusters/{cluster}
- cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
- location: projects/{project}/locations/{location}
- restore: projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}
- restorePlan: projects/{project}/locations/{location}/restorePlans/{restore_plan}
- volumeBackup: projects/{project}/locations/{location}/backupPlans/{backup_plan}/backups/{backup}/volumeBackups/{volume_backup}
- volumeRestore: projects/{project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore}/volumeRestores/{volume_restore}
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. |
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 |
__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. |
createBackup
Creates a Backup for the given BackupPlan.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The BackupPlan within which to create the Backup. Format: projects//locations//backupPlans/* |
optionalArgs |
array
Optional. |
↳ backup |
Backup
The Backup resource to create. |
↳ backupId |
string
The client-provided short name for the Backup resource. This name must: - be between 1 and 63 characters long (inclusive) - consist of only lower-case ASCII letters, numbers, and dashes - start with a lower-case letter - end with a lower-case letter or number - be unique within the set of Backups in this BackupPlan |
↳ 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\GkeBackup\V1\Backup;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Rpc\Status;
/**
* @param string $formattedParent The BackupPlan within which to create the Backup.
* Format: projects/*/locations/*/backupPlans/*
* Please see {@see BackupForGKEClient::backupPlanName()} for help formatting this field.
*/
function create_backup_sample(string $formattedParent): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->createBackup($formattedParent);
$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());
}
}
/**
* 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 = BackupForGKEClient::backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]');
create_backup_sample($formattedParent);
}
createBackupPlan
Creates a new BackupPlan in a given location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The location within which to create the BackupPlan. Format: projects//locations/ |
backupPlan |
Google\Cloud\GkeBackup\V1\BackupPlan
Required. The BackupPlan resource object to create. |
backupPlanId |
string
Required. The client-provided short name for the BackupPlan resource. This name must:
|
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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\BackupPlan;
use Google\Rpc\Status;
/**
* @param string $formattedParent The location within which to create the BackupPlan.
* Format: projects/*/locations/*
* Please see {@see BackupForGKEClient::locationName()} for help formatting this field.
* @param string $formattedBackupPlanCluster Immutable. The source cluster from which Backups will be created via
* this BackupPlan.
* Valid formats:
*
* - projects/*/locations/*/clusters/*
* - projects/*/zones/*/clusters/*
* Please see {@see BackupForGKEClient::clusterName()} for help formatting this field.
* @param string $backupPlanId The client-provided short name for the BackupPlan resource.
* This name must:
*
* - be between 1 and 63 characters long (inclusive)
* - consist of only lower-case ASCII letters, numbers, and dashes
* - start with a lower-case letter
* - end with a lower-case letter or number
* - be unique within the set of BackupPlans in this location
*/
function create_backup_plan_sample(
string $formattedParent,
string $formattedBackupPlanCluster,
string $backupPlanId
): void {
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Prepare any non-scalar elements to be passed along with the request.
$backupPlan = (new BackupPlan())
->setCluster($formattedBackupPlanCluster);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->createBackupPlan($formattedParent, $backupPlan, $backupPlanId);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BackupPlan $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());
}
}
/**
* 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 = BackupForGKEClient::locationName('[PROJECT]', '[LOCATION]');
$formattedBackupPlanCluster = BackupForGKEClient::clusterName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]'
);
$backupPlanId = '[BACKUP_PLAN_ID]';
create_backup_plan_sample($formattedParent, $formattedBackupPlanCluster, $backupPlanId);
}
createRestore
Creates a new Restore for the given RestorePlan.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The RestorePlan within which to create the Restore. Format: projects//locations//restorePlans/* |
restore |
Google\Cloud\GkeBackup\V1\Restore
Required. The restore resource to create. |
restoreId |
string
Required. The client-provided short name for the Restore resource. This name must:
|
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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\Restore;
use Google\Rpc\Status;
/**
* @param string $formattedParent The RestorePlan within which to create the Restore.
* Format: projects/*/locations/*/restorePlans/*
* Please see {@see BackupForGKEClient::restorePlanName()} for help formatting this field.
* @param string $formattedRestoreBackup Immutable. A reference to the [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which this Restore
* will restore. Note that this Backup must be a sub-resource of the
* RestorePlan's [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan].
* Format: projects/*/locations/*/backupPlans/*/backups/*. Please see
* {@see BackupForGKEClient::backupName()} for help formatting this field.
* @param string $restoreId The client-provided short name for the Restore resource.
* This name must:
*
* - be between 1 and 63 characters long (inclusive)
* - consist of only lower-case ASCII letters, numbers, and dashes
* - start with a lower-case letter
* - end with a lower-case letter or number
* - be unique within the set of Restores in this RestorePlan.
*/
function create_restore_sample(
string $formattedParent,
string $formattedRestoreBackup,
string $restoreId
): void {
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Prepare any non-scalar elements to be passed along with the request.
$restore = (new Restore())
->setBackup($formattedRestoreBackup);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->createRestore($formattedParent, $restore, $restoreId);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Restore $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());
}
}
/**
* 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 = BackupForGKEClient::restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]');
$formattedRestoreBackup = BackupForGKEClient::backupName(
'[PROJECT]',
'[LOCATION]',
'[BACKUP_PLAN]',
'[BACKUP]'
);
$restoreId = '[RESTORE_ID]';
create_restore_sample($formattedParent, $formattedRestoreBackup, $restoreId);
}
createRestorePlan
Creates a new RestorePlan in a given location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The location within which to create the RestorePlan. Format: projects//locations/ |
restorePlan |
Google\Cloud\GkeBackup\V1\RestorePlan
Required. The RestorePlan resource object to create. |
restorePlanId |
string
Required. The client-provided short name for the RestorePlan resource. This name must:
|
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\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\RestoreConfig;
use Google\Cloud\GkeBackup\V1\RestorePlan;
use Google\Rpc\Status;
/**
* @param string $formattedParent The location within which to create the RestorePlan.
* Format: projects/*/locations/*
* Please see {@see BackupForGKEClient::locationName()} for help formatting this field.
* @param string $formattedRestorePlanBackupPlan Immutable. A reference to the [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may be used as the
* source for Restores created via this RestorePlan.
* Format: projects/*/locations/*/backupPlans/*. Please see
* {@see BackupForGKEClient::backupPlanName()} for help formatting this field.
* @param string $formattedRestorePlanCluster Immutable. The target cluster into which Restores created via this RestorePlan
* will restore data. NOTE: the cluster's region must be the same as the
* RestorePlan.
* Valid formats:
*
* - projects/*/locations/*/clusters/*
* - projects/*/zones/*/clusters/*
* Please see {@see BackupForGKEClient::clusterName()} for help formatting this field.
* @param string $restorePlanId The client-provided short name for the RestorePlan resource.
* This name must:
*
* - be between 1 and 63 characters long (inclusive)
* - consist of only lower-case ASCII letters, numbers, and dashes
* - start with a lower-case letter
* - end with a lower-case letter or number
* - be unique within the set of RestorePlans in this location
*/
function create_restore_plan_sample(
string $formattedParent,
string $formattedRestorePlanBackupPlan,
string $formattedRestorePlanCluster,
string $restorePlanId
): void {
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Prepare any non-scalar elements to be passed along with the request.
$restorePlanRestoreConfig = new RestoreConfig();
$restorePlan = (new RestorePlan())
->setBackupPlan($formattedRestorePlanBackupPlan)
->setCluster($formattedRestorePlanCluster)
->setRestoreConfig($restorePlanRestoreConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->createRestorePlan($formattedParent, $restorePlan, $restorePlanId);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var RestorePlan $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());
}
}
/**
* 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 = BackupForGKEClient::locationName('[PROJECT]', '[LOCATION]');
$formattedRestorePlanBackupPlan = BackupForGKEClient::backupPlanName(
'[PROJECT]',
'[LOCATION]',
'[BACKUP_PLAN]'
);
$formattedRestorePlanCluster = BackupForGKEClient::clusterName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]'
);
$restorePlanId = '[RESTORE_PLAN_ID]';
create_restore_plan_sample(
$formattedParent,
$formattedRestorePlanBackupPlan,
$formattedRestorePlanCluster,
$restorePlanId
);
}
deleteBackup
Deletes an existing Backup.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the Backup resource. Format: projects//locations//backupPlans//backups/ |
optionalArgs |
array
Optional. |
↳ etag |
string
If provided, this value must match the current value of the target Backup's etag field or the request is rejected. |
↳ force |
bool
If set to true, any VolumeBackups below this Backup will also be deleted. Otherwise, the request will only succeed if the Backup has no VolumeBackups. |
↳ 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\GkeBackup\V1\BackupForGKEClient;
use Google\Rpc\Status;
/**
* @param string $formattedName Name of the Backup resource.
* Format: projects/*/locations/*/backupPlans/*/backups/*
* Please see {@see BackupForGKEClient::backupName()} for help formatting this field.
*/
function delete_backup_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->deleteBackup($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::backupName(
'[PROJECT]',
'[LOCATION]',
'[BACKUP_PLAN]',
'[BACKUP]'
);
delete_backup_sample($formattedName);
}
deleteBackupPlan
Deletes an existing BackupPlan.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Fully qualified BackupPlan name. Format: projects//locations//backupPlans/* |
optionalArgs |
array
Optional. |
↳ etag |
string
If provided, this value must match the current value of the target BackupPlan's etag field or the request is rejected. |
↳ 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\GkeBackup\V1\BackupForGKEClient;
use Google\Rpc\Status;
/**
* @param string $formattedName Fully qualified BackupPlan name.
* Format: projects/*/locations/*/backupPlans/*
* Please see {@see BackupForGKEClient::backupPlanName()} for help formatting this field.
*/
function delete_backup_plan_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->deleteBackupPlan($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]');
delete_backup_plan_sample($formattedName);
}
deleteRestore
Deletes an existing Restore.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Full name of the Restore Format: projects//locations//restorePlans//restores/ |
optionalArgs |
array
Optional. |
↳ etag |
string
If provided, this value must match the current value of the target Restore's etag field or the request is rejected. |
↳ force |
bool
If set to true, any VolumeRestores below this restore will also be deleted. Otherwise, the request will only succeed if the restore has no VolumeRestores. |
↳ 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\GkeBackup\V1\BackupForGKEClient;
use Google\Rpc\Status;
/**
* @param string $formattedName Full name of the Restore
* Format: projects/*/locations/*/restorePlans/*/restores/*
* Please see {@see BackupForGKEClient::restoreName()} for help formatting this field.
*/
function delete_restore_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->deleteRestore($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::restoreName(
'[PROJECT]',
'[LOCATION]',
'[RESTORE_PLAN]',
'[RESTORE]'
);
delete_restore_sample($formattedName);
}
deleteRestorePlan
Deletes an existing RestorePlan.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Fully qualified RestorePlan name. Format: projects//locations//restorePlans/* |
optionalArgs |
array
Optional. |
↳ etag |
string
If provided, this value must match the current value of the target RestorePlan's etag field or the request is rejected. |
↳ force |
bool
If set to true, any Restores below this RestorePlan will also be deleted. Otherwise, the request will only succeed if the RestorePlan has no Restores. |
↳ 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\GkeBackup\V1\BackupForGKEClient;
use Google\Rpc\Status;
/**
* @param string $formattedName Fully qualified RestorePlan name.
* Format: projects/*/locations/*/restorePlans/*
* Please see {@see BackupForGKEClient::restorePlanName()} for help formatting this field.
*/
function delete_restore_plan_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->deleteRestorePlan($formattedName);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]');
delete_restore_plan_sample($formattedName);
}
getBackup
Retrieve the details of a single Backup.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Full name of the Backup resource. Format: projects//locations//backupPlans//backups/ |
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\GkeBackup\V1\Backup |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeBackup\V1\Backup;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
/**
* @param string $formattedName Full name of the Backup resource.
* Format: projects/*/locations/*/backupPlans/*/backups/*
* Please see {@see BackupForGKEClient::backupName()} for help formatting this field.
*/
function get_backup_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var Backup $response */
$response = $backupForGKEClient->getBackup($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::backupName(
'[PROJECT]',
'[LOCATION]',
'[BACKUP_PLAN]',
'[BACKUP]'
);
get_backup_sample($formattedName);
}
getBackupPlan
Retrieve the details of a single BackupPlan.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Fully qualified BackupPlan name. Format: projects//locations//backupPlans/* |
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\GkeBackup\V1\BackupPlan |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\BackupPlan;
/**
* @param string $formattedName Fully qualified BackupPlan name.
* Format: projects/*/locations/*/backupPlans/*
* Please see {@see BackupForGKEClient::backupPlanName()} for help formatting this field.
*/
function get_backup_plan_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var BackupPlan $response */
$response = $backupForGKEClient->getBackupPlan($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]');
get_backup_plan_sample($formattedName);
}
getRestore
Retrieves the details of a single Restore.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Name of the restore resource. Format: projects//locations//restorePlans//restores/ |
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\GkeBackup\V1\Restore |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\Restore;
/**
* @param string $formattedName Name of the restore resource.
* Format: projects/*/locations/*/restorePlans/*/restores/*
* Please see {@see BackupForGKEClient::restoreName()} for help formatting this field.
*/
function get_restore_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var Restore $response */
$response = $backupForGKEClient->getRestore($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::restoreName(
'[PROJECT]',
'[LOCATION]',
'[RESTORE_PLAN]',
'[RESTORE]'
);
get_restore_sample($formattedName);
}
getRestorePlan
Retrieve the details of a single RestorePlan.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Fully qualified RestorePlan name. Format: projects//locations//restorePlans/* |
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\GkeBackup\V1\RestorePlan |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\RestorePlan;
/**
* @param string $formattedName Fully qualified RestorePlan name.
* Format: projects/*/locations/*/restorePlans/*
* Please see {@see BackupForGKEClient::restorePlanName()} for help formatting this field.
*/
function get_restore_plan_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var RestorePlan $response */
$response = $backupForGKEClient->getRestorePlan($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]');
get_restore_plan_sample($formattedName);
}
getVolumeBackup
Retrieve the details of a single VolumeBackup.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Full name of the VolumeBackup resource. Format: projects//locations//backupPlans//backups//volumeBackups/* |
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\GkeBackup\V1\VolumeBackup |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\VolumeBackup;
/**
* @param string $formattedName Full name of the VolumeBackup resource.
* Format: projects/*/locations/*/backupPlans/*/backups/*/volumeBackups/*
* Please see {@see BackupForGKEClient::volumeBackupName()} for help formatting this field.
*/
function get_volume_backup_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var VolumeBackup $response */
$response = $backupForGKEClient->getVolumeBackup($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::volumeBackupName(
'[PROJECT]',
'[LOCATION]',
'[BACKUP_PLAN]',
'[BACKUP]',
'[VOLUME_BACKUP]'
);
get_volume_backup_sample($formattedName);
}
getVolumeRestore
Retrieve the details of a single VolumeRestore.
Parameters | |
---|---|
Name | Description |
name |
string
Required. Full name of the VolumeRestore resource. Format: projects//locations//restorePlans//restores//volumeRestores/* |
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\GkeBackup\V1\VolumeRestore |
use Google\ApiCore\ApiException;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\VolumeRestore;
/**
* @param string $formattedName Full name of the VolumeRestore resource.
* Format: projects/*/locations/*/restorePlans/*/restores/*/volumeRestores/*
* Please see {@see BackupForGKEClient::volumeRestoreName()} for help formatting this field.
*/
function get_volume_restore_sample(string $formattedName): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var VolumeRestore $response */
$response = $backupForGKEClient->getVolumeRestore($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::volumeRestoreName(
'[PROJECT]',
'[LOCATION]',
'[RESTORE_PLAN]',
'[RESTORE]',
'[VOLUME_RESTORE]'
);
get_volume_restore_sample($formattedName);
}
listBackupPlans
Lists BackupPlans in a given location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The location that contains the BackupPlans to list. Format: projects//locations/ |
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
Field match expression used to filter the results. |
↳ orderBy |
string
Field by which to sort 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\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\BackupPlan;
/**
* @param string $formattedParent The location that contains the BackupPlans to list.
* Format: projects/*/locations/*
* Please see {@see BackupForGKEClient::locationName()} for help formatting this field.
*/
function list_backup_plans_sample(string $formattedParent): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $backupForGKEClient->listBackupPlans($formattedParent);
/** @var BackupPlan $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());
}
}
/**
* 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 = BackupForGKEClient::locationName('[PROJECT]', '[LOCATION]');
list_backup_plans_sample($formattedParent);
}
listBackups
Lists the Backups for a given BackupPlan.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The BackupPlan that contains the Backups to list. Format: projects//locations//backupPlans/* |
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
Field match expression used to filter the results. |
↳ orderBy |
string
Field by which to sort 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\GkeBackup\V1\Backup;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
/**
* @param string $formattedParent The BackupPlan that contains the Backups to list.
* Format: projects/*/locations/*/backupPlans/*
* Please see {@see BackupForGKEClient::backupPlanName()} for help formatting this field.
*/
function list_backups_sample(string $formattedParent): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $backupForGKEClient->listBackups($formattedParent);
/** @var Backup $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = BackupForGKEClient::backupPlanName('[PROJECT]', '[LOCATION]', '[BACKUP_PLAN]');
list_backups_sample($formattedParent);
}
listRestorePlans
Lists RestorePlans in a given location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The location that contains the RestorePlans to list. Format: projects//locations/ |
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
Field match expression used to filter the results. |
↳ orderBy |
string
Field by which to sort 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\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\RestorePlan;
/**
* @param string $formattedParent The location that contains the RestorePlans to list.
* Format: projects/*/locations/*
* Please see {@see BackupForGKEClient::locationName()} for help formatting this field.
*/
function list_restore_plans_sample(string $formattedParent): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $backupForGKEClient->listRestorePlans($formattedParent);
/** @var RestorePlan $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());
}
}
/**
* 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 = BackupForGKEClient::locationName('[PROJECT]', '[LOCATION]');
list_restore_plans_sample($formattedParent);
}
listRestores
Lists the Restores for a given RestorePlan.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The RestorePlan that contains the Restores to list. Format: projects//locations//restorePlans/* |
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
Field match expression used to filter the results. |
↳ orderBy |
string
Field by which to sort 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\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\Restore;
/**
* @param string $formattedParent The RestorePlan that contains the Restores to list.
* Format: projects/*/locations/*/restorePlans/*
* Please see {@see BackupForGKEClient::restorePlanName()} for help formatting this field.
*/
function list_restores_sample(string $formattedParent): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $backupForGKEClient->listRestores($formattedParent);
/** @var Restore $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());
}
}
/**
* 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 = BackupForGKEClient::restorePlanName('[PROJECT]', '[LOCATION]', '[RESTORE_PLAN]');
list_restores_sample($formattedParent);
}
listVolumeBackups
Lists the VolumeBackups for a given Backup.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The Backup that contains the VolumeBackups to list. Format: projects//locations//backupPlans//backups/ |
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
Field match expression used to filter the results. |
↳ orderBy |
string
Field by which to sort 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\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\VolumeBackup;
/**
* @param string $formattedParent The Backup that contains the VolumeBackups to list.
* Format: projects/*/locations/*/backupPlans/*/backups/*
* Please see {@see BackupForGKEClient::backupName()} for help formatting this field.
*/
function list_volume_backups_sample(string $formattedParent): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $backupForGKEClient->listVolumeBackups($formattedParent);
/** @var VolumeBackup $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());
}
}
/**
* 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 = BackupForGKEClient::backupName(
'[PROJECT]',
'[LOCATION]',
'[BACKUP_PLAN]',
'[BACKUP]'
);
list_volume_backups_sample($formattedParent);
}
listVolumeRestores
Lists the VolumeRestores for a given Restore.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The Restore that contains the VolumeRestores to list. Format: projects//locations//restorePlans//restores/ |
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
Field match expression used to filter the results. |
↳ orderBy |
string
Field by which to sort 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\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\VolumeRestore;
/**
* @param string $formattedParent The Restore that contains the VolumeRestores to list.
* Format: projects/*/locations/*/restorePlans/*/restores/*
* Please see {@see BackupForGKEClient::restoreName()} for help formatting this field.
*/
function list_volume_restores_sample(string $formattedParent): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $backupForGKEClient->listVolumeRestores($formattedParent);
/** @var VolumeRestore $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());
}
}
/**
* 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 = BackupForGKEClient::restoreName(
'[PROJECT]',
'[LOCATION]',
'[RESTORE_PLAN]',
'[RESTORE]'
);
list_volume_restores_sample($formattedParent);
}
updateBackup
Update a Backup.
Parameters | |
---|---|
Name | Description |
backup |
Google\Cloud\GkeBackup\V1\Backup
Required. A new version of the Backup resource that contains updated fields.
This may be sparsely populated if an |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
This is used to specify the fields to be overwritten in the Backup targeted for update. The values for each of these updated fields will be taken from the |
↳ 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\GkeBackup\V1\Backup;
use Google\Cloud\GkeBackup\V1\BackupForGKEClient;
use Google\Rpc\Status;
/**
* 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_backup_sample(): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Prepare any non-scalar elements to be passed along with the request.
$backup = new Backup();
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->updateBackup($backup);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Backup $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateBackupPlan
Update a BackupPlan.
Parameters | |
---|---|
Name | Description |
backupPlan |
Google\Cloud\GkeBackup\V1\BackupPlan
Required. A new version of the BackupPlan resource that contains updated fields.
This may be sparsely populated if an |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
This is used to specify the fields to be overwritten in the BackupPlan targeted for update. The values for each of these updated fields will be taken from the |
↳ 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\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\BackupPlan;
use Google\Rpc\Status;
/**
* @param string $formattedBackupPlanCluster Immutable. The source cluster from which Backups will be created via
* this BackupPlan.
* Valid formats:
*
* - projects/*/locations/*/clusters/*
* - projects/*/zones/*/clusters/*
* Please see {@see BackupForGKEClient::clusterName()} for help formatting this field.
*/
function update_backup_plan_sample(string $formattedBackupPlanCluster): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Prepare any non-scalar elements to be passed along with the request.
$backupPlan = (new BackupPlan())
->setCluster($formattedBackupPlanCluster);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->updateBackupPlan($backupPlan);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var BackupPlan $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());
}
}
/**
* 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
{
$formattedBackupPlanCluster = BackupForGKEClient::clusterName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]'
);
update_backup_plan_sample($formattedBackupPlanCluster);
}
updateRestore
Update a Restore.
Parameters | |
---|---|
Name | Description |
restore |
Google\Cloud\GkeBackup\V1\Restore
Required. A new version of the Restore resource that contains updated fields.
This may be sparsely populated if an |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
This is used to specify the fields to be overwritten in the Restore targeted for update. The values for each of these updated fields will be taken from the |
↳ 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\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\Restore;
use Google\Rpc\Status;
/**
* @param string $formattedRestoreBackup Immutable. A reference to the [Backup][google.cloud.gkebackup.v1.Backup] used as the source from which this Restore
* will restore. Note that this Backup must be a sub-resource of the
* RestorePlan's [backup_plan][google.cloud.gkebackup.v1.RestorePlan.backup_plan].
* Format: projects/*/locations/*/backupPlans/*/backups/*. Please see
* {@see BackupForGKEClient::backupName()} for help formatting this field.
*/
function update_restore_sample(string $formattedRestoreBackup): void
{
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Prepare any non-scalar elements to be passed along with the request.
$restore = (new Restore())
->setBackup($formattedRestoreBackup);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->updateRestore($restore);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Restore $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());
}
}
/**
* 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
{
$formattedRestoreBackup = BackupForGKEClient::backupName(
'[PROJECT]',
'[LOCATION]',
'[BACKUP_PLAN]',
'[BACKUP]'
);
update_restore_sample($formattedRestoreBackup);
}
updateRestorePlan
Update a RestorePlan.
Parameters | |
---|---|
Name | Description |
restorePlan |
Google\Cloud\GkeBackup\V1\RestorePlan
Required. A new version of the RestorePlan resource that contains updated fields.
This may be sparsely populated if an |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
This is used to specify the fields to be overwritten in the RestorePlan targeted for update. The values for each of these updated fields will be taken from the |
↳ 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\GkeBackup\V1\BackupForGKEClient;
use Google\Cloud\GkeBackup\V1\RestoreConfig;
use Google\Cloud\GkeBackup\V1\RestorePlan;
use Google\Rpc\Status;
/**
* @param string $formattedRestorePlanBackupPlan Immutable. A reference to the [BackupPlan][google.cloud.gkebackup.v1.BackupPlan] from which Backups may be used as the
* source for Restores created via this RestorePlan.
* Format: projects/*/locations/*/backupPlans/*. Please see
* {@see BackupForGKEClient::backupPlanName()} for help formatting this field.
* @param string $formattedRestorePlanCluster Immutable. The target cluster into which Restores created via this RestorePlan
* will restore data. NOTE: the cluster's region must be the same as the
* RestorePlan.
* Valid formats:
*
* - projects/*/locations/*/clusters/*
* - projects/*/zones/*/clusters/*
* Please see {@see BackupForGKEClient::clusterName()} for help formatting this field.
*/
function update_restore_plan_sample(
string $formattedRestorePlanBackupPlan,
string $formattedRestorePlanCluster
): void {
// Create a client.
$backupForGKEClient = new BackupForGKEClient();
// Prepare any non-scalar elements to be passed along with the request.
$restorePlanRestoreConfig = new RestoreConfig();
$restorePlan = (new RestorePlan())
->setBackupPlan($formattedRestorePlanBackupPlan)
->setCluster($formattedRestorePlanCluster)
->setRestoreConfig($restorePlanRestoreConfig);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $backupForGKEClient->updateRestorePlan($restorePlan);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var RestorePlan $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());
}
}
/**
* 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
{
$formattedRestorePlanBackupPlan = BackupForGKEClient::backupPlanName(
'[PROJECT]',
'[LOCATION]',
'[BACKUP_PLAN]'
);
$formattedRestorePlanCluster = BackupForGKEClient::clusterName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]'
);
update_restore_plan_sample($formattedRestorePlanBackupPlan, $formattedRestorePlanCluster);
}
Constants
SERVICE_NAME
Value: 'google.cloud.gkebackup.v1.BackupForGKE'
The name of the service.
SERVICE_ADDRESS
Value: 'gkebackup.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.