Google Cloud Redis Cluster V1 Client - Class CloudRedisClusterClient (0.11.0)

Reference documentation and code samples for the Google Cloud Redis Cluster V1 Client class CloudRedisClusterClient.

Service Description: Configures and manages Cloud Memorystore for Redis clusters

Google Cloud Memorystore for Redis Cluster

The redis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis clusters:

  • The service works with a collection of cloud projects, named: /projects/*
  • Each project has a collection of available locations, named: /locations/*
  • Each location has a collection of Redis clusters, named: /clusters/*
  • As such, Redis clusters are resources of the form: /projects/{project_id}/locations/{location_id}/clusters/{instance_id}

Note that location_id must be a GCP region; for example:

  • projects/redpepper-1290/locations/us-central1/clusters/my-redis

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Cloud \ Redis \ Cluster \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array|Google\ApiCore\Options\ClientOptions

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials Google\Auth\FetchAuthTokenInterface|Google\ApiCore\CredentialsWrapper

This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\Redis\Cluster\V1\CloudRedisClusterClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new CloudRedisClusterClient(['credentials' => $creds]); https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

↳ 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 false.

↳ 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|Google\ApiCore\Transport\TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

↳ logger false|Psr\Log\LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

↳ universeDomain string

The service domain for the client. Defaults to 'googleapis.com'.

addAuthToken

Adds a auth token for a user of a token based auth enabled cluster.

The async variant is CloudRedisClusterClient::addAuthTokenAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\AddAuthTokenRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<Google\Cloud\Redis\Cluster\V1\TokenAuthUser>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\AddAuthTokenRequest;
use Google\Cloud\Redis\Cluster\V1\AuthToken;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\TokenAuthUser;
use Google\Rpc\Status;

/**
 * @param string $formattedTokenAuthUser The name of the token auth user resource that this auth token
 *                                       will be added for. Format:
 *                                       projects/{project}/locations/{location}/clusters/{cluster}/tokenAuthUsers/{token_auth_user}
 *                                       Please see {@see CloudRedisClusterClient::tokenAuthUserName()} for help formatting this field.
 */
function add_auth_token_sample(string $formattedTokenAuthUser): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $authToken = new AuthToken();
    $request = (new AddAuthTokenRequest())
        ->setTokenAuthUser($formattedTokenAuthUser)
        ->setAuthToken($authToken);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->addAuthToken($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var TokenAuthUser $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
{
    $formattedTokenAuthUser = CloudRedisClusterClient::tokenAuthUserName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[TOKEN_AUTH_USER]'
    );

    add_auth_token_sample($formattedTokenAuthUser);
}

addTokenAuthUser

Adds a token auth user for a token based auth enabled cluster.

The async variant is CloudRedisClusterClient::addTokenAuthUserAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\AddTokenAuthUserRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<Google\Cloud\Redis\Cluster\V1\Cluster>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\AddTokenAuthUserRequest;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\Cluster;
use Google\Rpc\Status;

/**
 * @param string $formattedCluster       The cluster resource that this token auth user will be added for.
 *                                       Format: projects/{project}/locations/{location}/clusters/{cluster}
 *                                       Please see {@see CloudRedisClusterClient::clusterName()} for help formatting this field.
 * @param string $formattedTokenAuthUser The id of the token auth user to add. Please see
 *                                       {@see CloudRedisClusterClient::tokenAuthUserName()} for help formatting this field.
 */
function add_token_auth_user_sample(
    string $formattedCluster,
    string $formattedTokenAuthUser
): void {
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new AddTokenAuthUserRequest())
        ->setCluster($formattedCluster)
        ->setTokenAuthUser($formattedTokenAuthUser);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->addTokenAuthUser($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
{
    $formattedCluster = CloudRedisClusterClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
    $formattedTokenAuthUser = CloudRedisClusterClient::tokenAuthUserName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[TOKEN_AUTH_USER]'
    );

    add_token_auth_user_sample($formattedCluster, $formattedTokenAuthUser);
}

backupCluster

Backup Redis Cluster.

If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the cluster's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for backup.

The async variant is CloudRedisClusterClient::backupClusterAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\BackupClusterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<Google\Cloud\Redis\Cluster\V1\Cluster>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\BackupClusterRequest;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\Cluster;
use Google\Rpc\Status;

/**
 * @param string $formattedName Redis cluster resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
 *                              where `location_id` refers to a GCP region. Please see
 *                              {@see CloudRedisClusterClient::clusterName()} for help formatting this field.
 */
function backup_cluster_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new BackupClusterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->backupCluster($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 = CloudRedisClusterClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    backup_cluster_sample($formattedName);
}

createAclPolicy

Creates an ACL policy.

The creation is executed synchronously and the policy is available for use immediately after the RPC returns.

The async variant is CloudRedisClusterClient::createAclPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\CreateAclPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\AclPolicy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\AclPolicy;
use Google\Cloud\Redis\Cluster\V1\AclRule;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\CreateAclPolicyRequest;

/**
 * @param string $formattedParent        The resource name of the cluster location using the form:
 *                                       `projects/{project_id}/locations/{location_id}`
 *                                       where `location_id` refers to a Google Cloud region. Please see
 *                                       {@see CloudRedisClusterClient::locationName()} for help formatting this field.
 * @param string $aclPolicyId            The logical name of the ACL policy in the customer project
 *                                       with the following restrictions:
 *
 *                                       * Must contain only lowercase letters, numbers, and hyphens.
 *                                       * Must start with a letter.
 *                                       * Must be between 1-63 characters.
 *                                       * Must end with a number or a letter.
 *                                       * Must be unique within the customer project / location
 * @param string $aclPolicyRulesUsername Specifies the IAM user or service account to be added to the ACL
 *                                       policy. This username will be directly set on the Redis OSS.
 * @param string $aclPolicyRulesRule     The rule to be applied to the username. Ex: "on >password123 ~*
 *                                       +&#64;all" The format of the rule is defined by Redis OSS:
 *                                       https://redis.io/docs/latest/operate/oss_and_stack/management/security/acl/
 */
function create_acl_policy_sample(
    string $formattedParent,
    string $aclPolicyId,
    string $aclPolicyRulesUsername,
    string $aclPolicyRulesRule
): void {
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $aclRule = (new AclRule())
        ->setUsername($aclPolicyRulesUsername)
        ->setRule($aclPolicyRulesRule);
    $aclPolicyRules = [$aclRule,];
    $aclPolicy = (new AclPolicy())
        ->setRules($aclPolicyRules);
    $request = (new CreateAclPolicyRequest())
        ->setParent($formattedParent)
        ->setAclPolicyId($aclPolicyId)
        ->setAclPolicy($aclPolicy);

    // Call the API and handle any network failures.
    try {
        /** @var AclPolicy $response */
        $response = $cloudRedisClusterClient->createAclPolicy($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 = CloudRedisClusterClient::locationName('[PROJECT]', '[LOCATION]');
    $aclPolicyId = '[ACL_POLICY_ID]';
    $aclPolicyRulesUsername = '[USERNAME]';
    $aclPolicyRulesRule = '[RULE]';

    create_acl_policy_sample(
        $formattedParent,
        $aclPolicyId,
        $aclPolicyRulesUsername,
        $aclPolicyRulesRule
    );
}

createCluster

Creates a Redis cluster based on the specified properties.

The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster object in the response field.

The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.

The async variant is CloudRedisClusterClient::createClusterAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\CreateClusterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<Google\Cloud\Redis\Cluster\V1\Cluster>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\Cluster;
use Google\Cloud\Redis\Cluster\V1\CreateClusterRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The resource name of the cluster location using the form:
 *                                `projects/{project_id}/locations/{location_id}`
 *                                where `location_id` refers to a GCP region. Please see
 *                                {@see CloudRedisClusterClient::locationName()} for help formatting this field.
 * @param string $clusterId       The logical name of the Redis cluster in the customer project
 *                                with the following restrictions:
 *
 *                                * Must contain only lowercase letters, numbers, and hyphens.
 *                                * Must start with a letter.
 *                                * Must be between 1-63 characters.
 *                                * Must end with a number or a letter.
 *                                * Must be unique within the customer project / location
 * @param string $clusterName     Identifier. Unique name of the resource in this scope including
 *                                project and location using the form:
 *                                `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
 */
function create_cluster_sample(
    string $formattedParent,
    string $clusterId,
    string $clusterName
): void {
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $cluster = (new Cluster())
        ->setName($clusterName);
    $request = (new CreateClusterRequest())
        ->setParent($formattedParent)
        ->setClusterId($clusterId)
        ->setCluster($cluster);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->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 = CloudRedisClusterClient::locationName('[PROJECT]', '[LOCATION]');
    $clusterId = '[CLUSTER_ID]';
    $clusterName = '[NAME]';

    create_cluster_sample($formattedParent, $clusterId, $clusterName);
}

deleteAclPolicy

Deletes a specific ACL policy. This action will delete the ACL policy and all the rules associated with it. An ACL policy cannot be deleted if it is attached to a cluster.

The async variant is CloudRedisClusterClient::deleteAclPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteAclPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\DeleteAclPolicyRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Redis ACL policy resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/aclPolicies/{acl_policy_id}`
 *                              where `location_id` refers to a Google Cloud region. Please see
 *                              {@see CloudRedisClusterClient::aclPolicyName()} for help formatting this field.
 */
function delete_acl_policy_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new DeleteAclPolicyRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->deleteAclPolicy($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 = CloudRedisClusterClient::aclPolicyName('[PROJECT]', '[LOCATION]', '[ACL_POLICY]');

    delete_acl_policy_sample($formattedName);
}

deleteAuthToken

Removes a auth token for a user of a token based auth enabled instance.

The async variant is CloudRedisClusterClient::deleteAuthTokenAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteAuthTokenRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\DeleteAuthTokenRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the token auth user resource that this auth token
 *                              will be deleted from. Format:
 *                              projects/{project}/locations/{location}/clusters/{cluster}/tokenAuthUsers/{token_auth_user}/authTokens/{auth_token}
 *                              Please see {@see CloudRedisClusterClient::authTokenName()} for help formatting this field.
 */
function delete_auth_token_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new DeleteAuthTokenRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->deleteAuthToken($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 = CloudRedisClusterClient::authTokenName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[TOKEN_AUTH_USER]',
        '[AUTH_TOKEN]'
    );

    delete_auth_token_sample($formattedName);
}

deleteBackup

Deletes a specific backup.

The async variant is CloudRedisClusterClient::deleteBackupAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteBackupRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\DeleteBackupRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Redis backup resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
 *                              Please see {@see CloudRedisClusterClient::backupName()} for help formatting this field.
 */
function delete_backup_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new DeleteBackupRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->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 = CloudRedisClusterClient::backupName(
        '[PROJECT]',
        '[LOCATION]',
        '[BACKUP_COLLECTION]',
        '[BACKUP]'
    );

    delete_backup_sample($formattedName);
}

deleteCluster

Deletes a specific Redis cluster. Cluster stops serving and data is deleted.

The async variant is CloudRedisClusterClient::deleteClusterAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteClusterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\DeleteClusterRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Redis cluster resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
 *                              where `location_id` refers to a GCP region. Please see
 *                              {@see CloudRedisClusterClient::clusterName()} for help formatting this field.
 */
function delete_cluster_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new DeleteClusterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->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 = CloudRedisClusterClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    delete_cluster_sample($formattedName);
}

deleteTokenAuthUser

Deletes a token auth user for a token based auth enabled cluster.

The async variant is CloudRedisClusterClient::deleteTokenAuthUserAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteTokenAuthUserRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\DeleteTokenAuthUserRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the token auth user to delete.
 *                              Format:
 *                              projects/{project}/locations/{location}/clusters/{cluster}/tokenAuthUsers/{token_auth_user}
 *                              Please see {@see CloudRedisClusterClient::tokenAuthUserName()} for help formatting this field.
 */
function delete_token_auth_user_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new DeleteTokenAuthUserRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->deleteTokenAuthUser($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 = CloudRedisClusterClient::tokenAuthUserName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[TOKEN_AUTH_USER]'
    );

    delete_token_auth_user_sample($formattedName);
}

exportBackup

Exports a specific backup to a customer target Cloud Storage URI.

The async variant is CloudRedisClusterClient::exportBackupAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ExportBackupRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<Google\Cloud\Redis\Cluster\V1\Backup>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Backup;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\ExportBackupRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Redis backup resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
 *                              Please see {@see CloudRedisClusterClient::backupName()} for help formatting this field.
 */
function export_backup_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new ExportBackupRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->exportBackup($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
{
    $formattedName = CloudRedisClusterClient::backupName(
        '[PROJECT]',
        '[LOCATION]',
        '[BACKUP_COLLECTION]',
        '[BACKUP]'
    );

    export_backup_sample($formattedName);
}

getAclPolicy

Gets the details of a specific Redis Cluster ACL policy.

The async variant is CloudRedisClusterClient::getAclPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetAclPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\AclPolicy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\AclPolicy;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\GetAclPolicyRequest;

/**
 * @param string $formattedName Redis ACL policy resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/aclPolicies/{acl_policy_id}`
 *                              where `location_id` refers to a Google Cloud region. Please see
 *                              {@see CloudRedisClusterClient::aclPolicyName()} for help formatting this field.
 */
function get_acl_policy_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetAclPolicyRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AclPolicy $response */
        $response = $cloudRedisClusterClient->getAclPolicy($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 = CloudRedisClusterClient::aclPolicyName('[PROJECT]', '[LOCATION]', '[ACL_POLICY]');

    get_acl_policy_sample($formattedName);
}

getAclPolicyRevision

Gets details of a specific ACL policy revision.

The async variant is CloudRedisClusterClient::getAclPolicyRevisionAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetAclPolicyRevisionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\AclPolicyRevision
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\AclPolicyRevision;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\GetAclPolicyRevisionRequest;

/**
 * @param string $formattedName Redis ACL policy revision resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/aclPolicies/{acl_policy_id}/revisions/{revision_id}`
 *                              where `location_id` refers to a Google Cloud region. Please see
 *                              {@see CloudRedisClusterClient::aclPolicyRevisionName()} for help formatting this field.
 */
function get_acl_policy_revision_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetAclPolicyRevisionRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AclPolicyRevision $response */
        $response = $cloudRedisClusterClient->getAclPolicyRevision($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 = CloudRedisClusterClient::aclPolicyRevisionName(
        '[PROJECT]',
        '[LOCATION]',
        '[ACL_POLICY]',
        '[REVISION]'
    );

    get_acl_policy_revision_sample($formattedName);
}

getAuthToken

Gets a specific auth token for a specific token auth user.

The async variant is CloudRedisClusterClient::getAuthTokenAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetAuthTokenRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\AuthToken
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\AuthToken;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\GetAuthTokenRequest;

/**
 * @param string $formattedName The name of auth token for a token based auth enabled cluster.
 *                              Format:
 *                              projects/{project}/locations/{location}/clusters/{cluster}/tokenAuthUsers/{token_auth_user}/authTokens/{auth_token}
 *                              Please see {@see CloudRedisClusterClient::authTokenName()} for help formatting this field.
 */
function get_auth_token_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetAuthTokenRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var AuthToken $response */
        $response = $cloudRedisClusterClient->getAuthToken($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 = CloudRedisClusterClient::authTokenName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[TOKEN_AUTH_USER]',
        '[AUTH_TOKEN]'
    );

    get_auth_token_sample($formattedName);
}

getBackup

Gets the details of a specific backup.

The async variant is CloudRedisClusterClient::getBackupAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetBackupRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\Backup
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\Backup;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\GetBackupRequest;

/**
 * @param string $formattedName Redis backup resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
 *                              Please see {@see CloudRedisClusterClient::backupName()} for help formatting this field.
 */
function get_backup_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetBackupRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Backup $response */
        $response = $cloudRedisClusterClient->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 = CloudRedisClusterClient::backupName(
        '[PROJECT]',
        '[LOCATION]',
        '[BACKUP_COLLECTION]',
        '[BACKUP]'
    );

    get_backup_sample($formattedName);
}

getBackupCollection

Get a backup collection.

The async variant is CloudRedisClusterClient::getBackupCollectionAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetBackupCollectionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\BackupCollection
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\BackupCollection;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\GetBackupCollectionRequest;

/**
 * @param string $formattedName Redis backupCollection resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
 *                              where `location_id` refers to a GCP region. Please see
 *                              {@see CloudRedisClusterClient::backupCollectionName()} for help formatting this field.
 */
function get_backup_collection_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetBackupCollectionRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var BackupCollection $response */
        $response = $cloudRedisClusterClient->getBackupCollection($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 = CloudRedisClusterClient::backupCollectionName(
        '[PROJECT]',
        '[LOCATION]',
        '[BACKUP_COLLECTION]'
    );

    get_backup_collection_sample($formattedName);
}

getCluster

Gets the details of a specific Redis cluster.

The async variant is CloudRedisClusterClient::getClusterAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetClusterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\Cluster
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\Cluster;
use Google\Cloud\Redis\Cluster\V1\GetClusterRequest;

/**
 * @param string $formattedName Redis cluster resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
 *                              where `location_id` refers to a GCP region. Please see
 *                              {@see CloudRedisClusterClient::clusterName()} for help formatting this field.
 */
function get_cluster_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetClusterRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Cluster $response */
        $response = $cloudRedisClusterClient->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 = CloudRedisClusterClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    get_cluster_sample($formattedName);
}

getClusterCertificateAuthority

Gets the details of certificate authority information for Redis cluster.

The async variant is CloudRedisClusterClient::getClusterCertificateAuthorityAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetClusterCertificateAuthorityRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\CertificateAuthority
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\CertificateAuthority;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\GetClusterCertificateAuthorityRequest;

/**
 * @param string $formattedName Redis cluster certificate authority resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority`
 *                              where `location_id` refers to a GCP region. Please see
 *                              {@see CloudRedisClusterClient::certificateAuthorityName()} for help formatting this field.
 */
function get_cluster_certificate_authority_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetClusterCertificateAuthorityRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var CertificateAuthority $response */
        $response = $cloudRedisClusterClient->getClusterCertificateAuthority($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 = CloudRedisClusterClient::certificateAuthorityName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]'
    );

    get_cluster_certificate_authority_sample($formattedName);
}

getSharedRegionalCertificateAuthority

Gets the details of regional certificate authority information for Redis cluster.

The async variant is CloudRedisClusterClient::getSharedRegionalCertificateAuthorityAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetSharedRegionalCertificateAuthorityRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\SharedRegionalCertificateAuthority
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\GetSharedRegionalCertificateAuthorityRequest;
use Google\Cloud\Redis\Cluster\V1\SharedRegionalCertificateAuthority;

/**
 * @param string $formattedName Regional certificate authority resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/sharedRegionalCertificateAuthority`
 *                              where `location_id` refers to a Google Cloud region. Please see
 *                              {@see CloudRedisClusterClient::sharedRegionalCertificateAuthorityName()} for help formatting this field.
 */
function get_shared_regional_certificate_authority_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetSharedRegionalCertificateAuthorityRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var SharedRegionalCertificateAuthority $response */
        $response = $cloudRedisClusterClient->getSharedRegionalCertificateAuthority($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 = CloudRedisClusterClient::sharedRegionalCertificateAuthorityName(
        '[PROJECT]',
        '[LOCATION]'
    );

    get_shared_regional_certificate_authority_sample($formattedName);
}

getTokenAuthUser

Gets a specific token auth user for a basic auth enabled cluster.

The async variant is CloudRedisClusterClient::getTokenAuthUserAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetTokenAuthUserRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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\Redis\Cluster\V1\TokenAuthUser
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\GetTokenAuthUserRequest;
use Google\Cloud\Redis\Cluster\V1\TokenAuthUser;

/**
 * @param string $formattedName The name of token auth user for a token based auth enabled
 *                              cluster. Format:
 *                              projects/{project}/locations/{location}/clusters/{cluster}/tokenAuthUsers/{token_auth_user}
 *                              Please see {@see CloudRedisClusterClient::tokenAuthUserName()} for help formatting this field.
 */
function get_token_auth_user_sample(string $formattedName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new GetTokenAuthUserRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var TokenAuthUser $response */
        $response = $cloudRedisClusterClient->getTokenAuthUser($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 = CloudRedisClusterClient::tokenAuthUserName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[TOKEN_AUTH_USER]'
    );

    get_token_auth_user_sample($formattedName);
}

listAclPolicies

Lists all ACL policies owned by a project in either the specified location (region) or all locations.

The location should have the following format:

  • projects/{project_id}/locations/{location_id}

If location_id is specified as - (wildcard), then all regions available to the project are queried, and the results are aggregated.

The async variant is CloudRedisClusterClient::listAclPoliciesAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListAclPoliciesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Redis\Cluster\V1\AclPolicy;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\ListAclPoliciesRequest;

/**
 * @param string $formattedParent The resource name of the ACL policy location using the form:
 *                                `projects/{project_id}/locations/{location_id}`
 *                                where `location_id` refers to a Google Cloud region. Please see
 *                                {@see CloudRedisClusterClient::locationName()} for help formatting this field.
 */
function list_acl_policies_sample(string $formattedParent): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new ListAclPoliciesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudRedisClusterClient->listAclPolicies($request);

        /** @var AclPolicy $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 = CloudRedisClusterClient::locationName('[PROJECT]', '[LOCATION]');

    list_acl_policies_sample($formattedParent);
}

listAclPolicyRevisions

Lists all ACL policy revisions in a given ACL policy.

The async variant is CloudRedisClusterClient::listAclPolicyRevisionsAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListAclPolicyRevisionsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Redis\Cluster\V1\AclPolicyRevision;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\ListAclPolicyRevisionsRequest;

/**
 * @param string $formattedParent The name of the ACL policy to list revisions for.
 *                                Format:
 *                                "projects/{project_id}/locations/{location_id}/aclPolicies/{acl_policy_id}"
 *                                Please see {@see CloudRedisClusterClient::aclPolicyName()} for help formatting this field.
 */
function list_acl_policy_revisions_sample(string $formattedParent): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new ListAclPolicyRevisionsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudRedisClusterClient->listAclPolicyRevisions($request);

        /** @var AclPolicyRevision $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 = CloudRedisClusterClient::aclPolicyName(
        '[PROJECT]',
        '[LOCATION]',
        '[ACL_POLICY]'
    );

    list_acl_policy_revisions_sample($formattedParent);
}

listAuthTokens

Lists all the auth tokens for a specific token auth user.

The async variant is CloudRedisClusterClient::listAuthTokensAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListAuthTokensRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Redis\Cluster\V1\AuthToken;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\ListAuthTokensRequest;

/**
 * @param string $formattedParent The parent resource that this auth token will be listed for.
 *                                Format:
 *                                projects/{project}/locations/{location}/clusters/{cluster}/tokenAuthUsers/{token_auth_user}
 *                                Please see {@see CloudRedisClusterClient::tokenAuthUserName()} for help formatting this field.
 */
function list_auth_tokens_sample(string $formattedParent): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new ListAuthTokensRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudRedisClusterClient->listAuthTokens($request);

        /** @var AuthToken $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 = CloudRedisClusterClient::tokenAuthUserName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[TOKEN_AUTH_USER]'
    );

    list_auth_tokens_sample($formattedParent);
}

listBackupCollections

Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.

If location_id is specified as - (wildcard), then all regions available to the project are queried, and the results are aggregated.

The async variant is CloudRedisClusterClient::listBackupCollectionsAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListBackupCollectionsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Redis\Cluster\V1\BackupCollection;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\ListBackupCollectionsRequest;

/**
 * @param string $formattedParent The resource name of the backupCollection location using the
 *                                form:
 *                                `projects/{project_id}/locations/{location_id}`
 *                                where `location_id` refers to a GCP region. Please see
 *                                {@see CloudRedisClusterClient::locationName()} for help formatting this field.
 */
function list_backup_collections_sample(string $formattedParent): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new ListBackupCollectionsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudRedisClusterClient->listBackupCollections($request);

        /** @var BackupCollection $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 = CloudRedisClusterClient::locationName('[PROJECT]', '[LOCATION]');

    list_backup_collections_sample($formattedParent);
}

listBackups

Lists all backups owned by a backup collection.

The async variant is CloudRedisClusterClient::listBackupsAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListBackupsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Redis\Cluster\V1\Backup;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\ListBackupsRequest;

/**
 * @param string $formattedParent The resource name of the backupCollection using the form:
 *                                `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
 *                                Please see {@see CloudRedisClusterClient::backupCollectionName()} for help formatting this field.
 */
function list_backups_sample(string $formattedParent): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new ListBackupsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudRedisClusterClient->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 = CloudRedisClusterClient::backupCollectionName(
        '[PROJECT]',
        '[LOCATION]',
        '[BACKUP_COLLECTION]'
    );

    list_backups_sample($formattedParent);
}

listClusters

Lists all Redis clusters owned by a project in either the specified location (region) or all locations.

The location should have the following format:

  • projects/{project_id}/locations/{location_id}

If location_id is specified as - (wildcard), then all regions available to the project are queried, and the results are aggregated.

The async variant is CloudRedisClusterClient::listClustersAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListClustersRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\Cluster;
use Google\Cloud\Redis\Cluster\V1\ListClustersRequest;

/**
 * @param string $formattedParent The resource name of the cluster location using the form:
 *                                `projects/{project_id}/locations/{location_id}`
 *                                where `location_id` refers to a GCP region. Please see
 *                                {@see CloudRedisClusterClient::locationName()} for help formatting this field.
 */
function list_clusters_sample(string $formattedParent): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new ListClustersRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudRedisClusterClient->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 = CloudRedisClusterClient::locationName('[PROJECT]', '[LOCATION]');

    list_clusters_sample($formattedParent);
}

listTokenAuthUsers

Lists all the token auth users for a token based auth enabled cluster.

The async variant is CloudRedisClusterClient::listTokenAuthUsersAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListTokenAuthUsersRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\ListTokenAuthUsersRequest;
use Google\Cloud\Redis\Cluster\V1\TokenAuthUser;

/**
 * @param string $formattedParent The parent resource that this token based auth user will be
 *                                listed for. Format:
 *                                projects/{project}/locations/{location}/clusters/{cluster}
 *                                Please see {@see CloudRedisClusterClient::clusterName()} for help formatting this field.
 */
function list_token_auth_users_sample(string $formattedParent): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new ListTokenAuthUsersRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudRedisClusterClient->listTokenAuthUsers($request);

        /** @var TokenAuthUser $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 = CloudRedisClusterClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    list_token_auth_users_sample($formattedParent);
}

rescheduleClusterMaintenance

Reschedules upcoming maintenance event.

The async variant is CloudRedisClusterClient::rescheduleClusterMaintenanceAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\RescheduleClusterMaintenanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<Google\Cloud\Redis\Cluster\V1\Cluster>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\Cluster;
use Google\Cloud\Redis\Cluster\V1\RescheduleClusterMaintenanceRequest;
use Google\Cloud\Redis\Cluster\V1\RescheduleClusterMaintenanceRequest\RescheduleType;
use Google\Rpc\Status;

/**
 * @param string $formattedName  Redis Cluster instance resource name using the form:
 *                               `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
 *                               where `location_id` refers to a GCP region. Please see
 *                               {@see CloudRedisClusterClient::clusterName()} for help formatting this field.
 * @param int    $rescheduleType If reschedule type is SPECIFIC_TIME, must set up schedule_time as
 *                               well.
 */
function reschedule_cluster_maintenance_sample(string $formattedName, int $rescheduleType): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = (new RescheduleClusterMaintenanceRequest())
        ->setName($formattedName)
        ->setRescheduleType($rescheduleType);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->rescheduleClusterMaintenance($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 = CloudRedisClusterClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
    $rescheduleType = RescheduleType::RESCHEDULE_TYPE_UNSPECIFIED;

    reschedule_cluster_maintenance_sample($formattedName, $rescheduleType);
}

updateAclPolicy

Updates the ACL policy.

The operation applies the updated ACL policy to all of the linked clusters. If Memorystore can apply the policy to all clusters, then the operation returns a SUCCESS status. If Memorystore can't apply the policy to all clusters, then to ensure eventual consistency, Memorystore uses reconciliation to apply the policy to the failed clusters.

Completed longrunning.Operation will contain the new ACL policy object in the response field.

The async variant is CloudRedisClusterClient::updateAclPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\UpdateAclPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<Google\Cloud\Redis\Cluster\V1\AclPolicy>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\AclPolicy;
use Google\Cloud\Redis\Cluster\V1\AclRule;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\UpdateAclPolicyRequest;
use Google\Rpc\Status;

/**
 * @param string $aclPolicyRulesUsername Specifies the IAM user or service account to be added to the ACL
 *                                       policy. This username will be directly set on the Redis OSS.
 * @param string $aclPolicyRulesRule     The rule to be applied to the username. Ex: "on >password123 ~*
 *                                       +&#64;all" The format of the rule is defined by Redis OSS:
 *                                       https://redis.io/docs/latest/operate/oss_and_stack/management/security/acl/
 */
function update_acl_policy_sample(
    string $aclPolicyRulesUsername,
    string $aclPolicyRulesRule
): void {
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $aclRule = (new AclRule())
        ->setUsername($aclPolicyRulesUsername)
        ->setRule($aclPolicyRulesRule);
    $aclPolicyRules = [$aclRule,];
    $aclPolicy = (new AclPolicy())
        ->setRules($aclPolicyRules);
    $request = (new UpdateAclPolicyRequest())
        ->setAclPolicy($aclPolicy);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->updateAclPolicy($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var AclPolicy $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
{
    $aclPolicyRulesUsername = '[USERNAME]';
    $aclPolicyRulesRule = '[RULE]';

    update_acl_policy_sample($aclPolicyRulesUsername, $aclPolicyRulesRule);
}

updateCluster

Updates the metadata and configuration of a specific Redis cluster.

Completed longrunning.Operation will contain the new cluster object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.

The async variant is CloudRedisClusterClient::updateClusterAsync() .

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\UpdateClusterRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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<Google\Cloud\Redis\Cluster\V1\Cluster>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;
use Google\Cloud\Redis\Cluster\V1\Cluster;
use Google\Cloud\Redis\Cluster\V1\UpdateClusterRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $clusterName Identifier. Unique name of the resource in this scope including
 *                            project and location using the form:
 *                            `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
 */
function update_cluster_sample(string $clusterName): void
{
    // Create a client.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $cluster = (new Cluster())
        ->setName($clusterName);
    $request = (new UpdateClusterRequest())
        ->setUpdateMask($updateMask)
        ->setCluster($cluster);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudRedisClusterClient->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
{
    $clusterName = '[NAME]';

    update_cluster_sample($clusterName);
}

getLocation

Gets information about a location.

The async variant is CloudRedisClusterClient::getLocationAsync() .

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;

/**
 * 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.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = new GetLocationRequest();

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $cloudRedisClusterClient->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.

The async variant is CloudRedisClusterClient::listLocationsAsync() .

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\Redis\Cluster\V1\Client\CloudRedisClusterClient;

/**
 * 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.
    $cloudRedisClusterClient = new CloudRedisClusterClient();

    // Prepare the request message.
    $request = new ListLocationsRequest();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $cloudRedisClusterClient->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());
    }
}

addAuthTokenAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\AddAuthTokenRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

addTokenAuthUserAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\AddTokenAuthUserRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

backupClusterAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\BackupClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createAclPolicyAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\CreateAclPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\AclPolicy>

createClusterAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\CreateClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteAclPolicyAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteAclPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteAuthTokenAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteAuthTokenRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteBackupAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteBackupRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteClusterAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteTokenAuthUserAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\DeleteTokenAuthUserRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

exportBackupAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ExportBackupRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getAclPolicyAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetAclPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\AclPolicy>

getAclPolicyRevisionAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetAclPolicyRevisionRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\AclPolicyRevision>

getAuthTokenAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetAuthTokenRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\AuthToken>

getBackupAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetBackupRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\Backup>

getBackupCollectionAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetBackupCollectionRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\BackupCollection>

getClusterAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\Cluster>

getClusterCertificateAuthorityAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetClusterCertificateAuthorityRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\CertificateAuthority>

getSharedRegionalCertificateAuthorityAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetSharedRegionalCertificateAuthorityRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\SharedRegionalCertificateAuthority>

getTokenAuthUserAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\GetTokenAuthUserRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Redis\Cluster\V1\TokenAuthUser>

listAclPoliciesAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListAclPoliciesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listAclPolicyRevisionsAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListAclPolicyRevisionsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listAuthTokensAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListAuthTokensRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listBackupCollectionsAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListBackupCollectionsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listBackupsAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListBackupsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listClustersAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListClustersRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listTokenAuthUsersAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\ListTokenAuthUsersRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

rescheduleClusterMaintenanceAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\RescheduleClusterMaintenanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateAclPolicyAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\UpdateAclPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateClusterAsync

Parameters
Name Description
request Google\Cloud\Redis\Cluster\V1\UpdateClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getLocationAsync

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location>

listLocationsAsync

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
Type Description
Google\LongRunning\Client\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::aclPolicyName

Formats a string containing the fully-qualified path to represent a acl_policy resource.

Parameters
Name Description
project string
location string
aclPolicy string
Returns
Type Description
string The formatted acl_policy resource.

static::aclPolicyRevisionName

Formats a string containing the fully-qualified path to represent a acl_policy_revision resource.

Parameters
Name Description
project string
location string
aclPolicy string
revision string
Returns
Type Description
string The formatted acl_policy_revision resource.

static::authTokenName

Formats a string containing the fully-qualified path to represent a auth_token resource.

Parameters
Name Description
project string
location string
cluster string
tokenAuthUser string
authToken string
Returns
Type Description
string The formatted auth_token resource.

static::backupName

Formats a string containing the fully-qualified path to represent a backup resource.

Parameters
Name Description
project string
location string
backupCollection string
backup string
Returns
Type Description
string The formatted backup resource.

static::backupCollectionName

Formats a string containing the fully-qualified path to represent a backup_collection resource.

Parameters
Name Description
project string
location string
backupCollection string
Returns
Type Description
string The formatted backup_collection resource.

static::caPoolName

Formats a string containing the fully-qualified path to represent a ca_pool resource.

Parameters
Name Description
project string
location string
caPool string
Returns
Type Description
string The formatted ca_pool resource.

static::certificateAuthorityName

Formats a string containing the fully-qualified path to represent a certificate_authority resource.

Parameters
Name Description
project string
location string
cluster string
Returns
Type Description
string The formatted certificate_authority 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::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.

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::forwardingRuleName

Formats a string containing the fully-qualified path to represent a forwarding_rule resource.

Parameters
Name Description
project string
region string
forwardingRule string
Returns
Type Description
string The formatted forwarding_rule 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::serviceAttachmentName

Formats a string containing the fully-qualified path to represent a service_attachment resource.

Parameters
Name Description
project string
region string
serviceAttachment string
Returns
Type Description
string The formatted service_attachment resource.

static::sharedRegionalCertificateAuthorityName

Formats a string containing the fully-qualified path to represent a shared_regional_certificate_authority resource.

Parameters
Name Description
project string
location string
Returns
Type Description
string The formatted shared_regional_certificate_authority resource.

static::tokenAuthUserName

Formats a string containing the fully-qualified path to represent a token_auth_user resource.

Parameters
Name Description
project string
location string
cluster string
tokenAuthUser string
Returns
Type Description
string The formatted token_auth_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

  • aclPolicy: projects/{project}/locations/{location}/aclPolicies/{acl_policy}
  • aclPolicyRevision: projects/{project}/locations/{location}/aclPolicies/{acl_policy}/revisions/{revision}
  • authToken: projects/{project}/locations/{location}/clusters/{cluster}/tokenAuthUsers/{token_auth_user}/authTokens/{auth_token}
  • backup: projects/{project}/locations/{location}/backupCollections/{backup_collection}/backups/{backup}
  • backupCollection: projects/{project}/locations/{location}/backupCollections/{backup_collection}
  • caPool: projects/{project}/locations/{location}/caPools/{ca_pool}
  • certificateAuthority: projects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority
  • cluster: projects/{project}/locations/{location}/clusters/{cluster}
  • cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
  • cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}
  • forwardingRule: projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
  • location: projects/{project}/locations/{location}
  • network: projects/{project}/global/networks/{network}
  • serviceAttachment: projects/{project}/regions/{region}/serviceAttachments/{service_attachment}
  • sharedRegionalCertificateAuthority: projects/{project}/locations/{location}/sharedRegionalCertificateAuthority
  • tokenAuthUser: projects/{project}/locations/{location}/clusters/{cluster}/tokenAuthUsers/{token_auth_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.