Google Cloud Memorystore V1 Client - Class MemorystoreClient (0.12.0)

Reference documentation and code samples for the Google Cloud Memorystore V1 Client class MemorystoreClient.

Service Description: Service describing handlers for resources

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

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 \ Memorystore \ 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\Memorystore\V1\MemorystoreClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new MemorystoreClient(['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 token for a user of a token based auth enabled instance.

The async variant is MemorystoreClient::addAuthTokenAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\TokenAuthUser>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\AddAuthTokenRequest;
use Google\Cloud\Memorystore\V1\AuthToken;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\TokenAuthUser;
use Google\Rpc\Status;

/**
 * @param string $formattedTokenAuthUser The name of the token auth user resource that this token will be
 *                                       added for. Please see
 *                                       {@see MemorystoreClient::tokenAuthUserName()} for help formatting this field.
 */
function add_auth_token_sample(string $formattedTokenAuthUser): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

    // 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 = $memorystoreClient->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 = MemorystoreClient::tokenAuthUserName(
        '[PROJECT]',
        '[LOCATION]',
        '[INSTANCE]',
        '[TOKEN_AUTH_USER]'
    );

    add_auth_token_sample($formattedTokenAuthUser);
}

addTokenAuthUser

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

The async variant is MemorystoreClient::addTokenAuthUserAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\Instance>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\AddTokenAuthUserRequest;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\Instance;
use Google\Rpc\Status;

/**
 * @param string $formattedInstance The instance resource that this token auth user will be added
 *                                  for. Format: projects/{project}/locations/{location}/instances/{instance}
 *                                  Please see {@see MemorystoreClient::instanceName()} for help formatting this field.
 * @param string $tokenAuthUser     The name of the token auth user to add.
 */
function add_token_auth_user_sample(string $formattedInstance, string $tokenAuthUser): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

    // Prepare the request message.
    $request = (new AddTokenAuthUserRequest())
        ->setInstance($formattedInstance)
        ->setTokenAuthUser($tokenAuthUser);

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

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedInstance = MemorystoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
    $tokenAuthUser = '[TOKEN_AUTH_USER]';

    add_token_auth_user_sample($formattedInstance, $tokenAuthUser);
}

backupInstance

Backup Instance.

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 instance'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 MemorystoreClient::backupInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\BackupInstanceRequest

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\Memorystore\V1\Instance>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\BackupInstanceRequest;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\Instance;
use Google\Rpc\Status;

/**
 * @param string $formattedName Instance resource name using the form:
 *                              `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
 *                              where `location_id` refers to a Google Cloud region. Please see
 *                              {@see MemorystoreClient::instanceName()} for help formatting this field.
 */
function backup_instance_sample(string $formattedName): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = MemorystoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    backup_instance_sample($formattedName);
}

createInstance

Creates a new Instance in a given project and location.

The async variant is MemorystoreClient::createInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\CreateInstanceRequest

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\Memorystore\V1\Instance>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\CreateInstanceRequest;
use Google\Cloud\Memorystore\V1\Instance;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent resource where this instance will be created.
 *                                Format: projects/{project}/locations/{location}
 *                                Please see {@see MemorystoreClient::locationName()} for help formatting this field.
 * @param string $instanceId      The ID to use for the instance, which will become the final
 *                                component of the instance's resource name.
 *
 *                                This value is subject to the following restrictions:
 *
 *                                * Must be 4-63 characters in length
 *                                * Must begin with a letter or digit
 *                                * Must contain only lowercase letters, digits, and hyphens
 *                                * Must not end with a hyphen
 *                                * Must be unique within a location
 */
function create_instance_sample(string $formattedParent, string $instanceId): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

    // Prepare the request message.
    $instance = new Instance();
    $request = (new CreateInstanceRequest())
        ->setParent($formattedParent)
        ->setInstanceId($instanceId)
        ->setInstance($instance);

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

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = MemorystoreClient::locationName('[PROJECT]', '[LOCATION]');
    $instanceId = '[INSTANCE_ID]';

    create_instance_sample($formattedParent, $instanceId);
}

deleteAuthToken

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

The async variant is MemorystoreClient::deleteAuthTokenAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\DeleteAuthTokenRequest;
use Google\Rpc\Status;

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

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

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

    delete_auth_token_sample($formattedName);
}

deleteBackup

Deletes a specific backup.

The async variant is MemorystoreClient::deleteBackupAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\DeleteBackupRequest;
use Google\Rpc\Status;

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

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

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

    delete_backup_sample($formattedName);
}

deleteInstance

Deletes a single Instance.

The async variant is MemorystoreClient::deleteInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\DeleteInstanceRequest

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\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\DeleteInstanceRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the instance to delete.
 *                              Format: projects/{project}/locations/{location}/instances/{instance}
 *                              Please see {@see MemorystoreClient::instanceName()} for help formatting this field.
 */
function delete_instance_sample(string $formattedName): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = MemorystoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    delete_instance_sample($formattedName);
}

deleteTokenAuthUser

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

The async variant is MemorystoreClient::deleteTokenAuthUserAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\DeleteTokenAuthUserRequest;
use Google\Rpc\Status;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $memorystoreClient->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 = MemorystoreClient::tokenAuthUserName(
        '[PROJECT]',
        '[LOCATION]',
        '[INSTANCE]',
        '[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 MemorystoreClient::exportBackupAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\Backup>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\Backup;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\ExportBackupRequest;
use Google\Rpc\Status;

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

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

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

    export_backup_sample($formattedName);
}

finishMigration

Finalizes the migration process.

After the successful completion of this operation, the target instance will:

  1. Stop replicating from the source instance.
  2. Allow both reads and writes.

The async variant is MemorystoreClient::finishMigrationAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\FinishMigrationRequest

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\Memorystore\V1\Instance>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\FinishMigrationRequest;
use Google\Cloud\Memorystore\V1\Instance;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the instance to finalize migration on.
 *                              Format: projects/{project}/locations/{location}/instances/{instance}
 *                              Please see {@see MemorystoreClient::instanceName()} for help formatting this field.
 */
function finish_migration_sample(string $formattedName): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = MemorystoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    finish_migration_sample($formattedName);
}

getAuthToken

Gets a token based auth enabled instance's auth token for a given user.

The async variant is MemorystoreClient::getAuthTokenAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\AuthToken
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Memorystore\V1\AuthToken;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\GetAuthTokenRequest;

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

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

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

    get_auth_token_sample($formattedName);
}

getBackup

Gets the details of a specific backup.

The async variant is MemorystoreClient::getBackupAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\Backup
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Memorystore\V1\Backup;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\GetBackupRequest;

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

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

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

    get_backup_sample($formattedName);
}

getBackupCollection

Get a backup collection.

The async variant is MemorystoreClient::getBackupCollectionAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\BackupCollection
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Memorystore\V1\BackupCollection;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\GetBackupCollectionRequest;

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

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

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

    get_backup_collection_sample($formattedName);
}

getCertificateAuthority

Gets details about the certificate authority for an Instance.

The async variant is MemorystoreClient::getCertificateAuthorityAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\GetCertificateAuthorityRequest

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\Memorystore\V1\CertificateAuthority
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Memorystore\V1\CertificateAuthority;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\GetCertificateAuthorityRequest;

/**
 * @param string $formattedName The name of the certificate authority.
 *                              Format:
 *                              projects/{project}/locations/{location}/instances/{instance}/certificateAuthority
 *                              Please see {@see MemorystoreClient::instanceName()} for help formatting this field.
 */
function get_certificate_authority_sample(string $formattedName): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var CertificateAuthority $response */
        $response = $memorystoreClient->getCertificateAuthority($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 = MemorystoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    get_certificate_authority_sample($formattedName);
}

getInstance

Gets details of a single Instance.

The async variant is MemorystoreClient::getInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\GetInstanceRequest

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\Memorystore\V1\Instance
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\GetInstanceRequest;
use Google\Cloud\Memorystore\V1\Instance;

/**
 * @param string $formattedName The name of the instance to retrieve.
 *                              Format: projects/{project}/locations/{location}/instances/{instance}
 *                              Please see {@see MemorystoreClient::instanceName()} for help formatting this field.
 */
function get_instance_sample(string $formattedName): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Instance $response */
        $response = $memorystoreClient->getInstance($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = MemorystoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    get_instance_sample($formattedName);
}

getSharedRegionalCertificateAuthority

Gets the details of shared regional certificate authority information for Memorystore instance.

The async variant is MemorystoreClient::getSharedRegionalCertificateAuthorityAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\SharedRegionalCertificateAuthority
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\GetSharedRegionalCertificateAuthorityRequest;
use Google\Cloud\Memorystore\V1\SharedRegionalCertificateAuthority;

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

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

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

    get_shared_regional_certificate_authority_sample($formattedName);
}

getTokenAuthUser

Gets a specific token auth user for a token based auth enabled instance.

The async variant is MemorystoreClient::getTokenAuthUserAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\TokenAuthUser
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\GetTokenAuthUserRequest;
use Google\Cloud\Memorystore\V1\TokenAuthUser;

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

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

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

    get_token_auth_user_sample($formattedName);
}

listAuthTokens

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

The async variant is MemorystoreClient::listAuthTokensAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\AuthToken;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\ListAuthTokensRequest;

/**
 * @param string $formattedParent The parent to list auth tokens from.
 *                                Format:
 *                                projects/{project}/locations/{location}/instances/{instance}/tokenAuthUsers/{token_auth_user}
 *                                Please see {@see MemorystoreClient::tokenAuthUserName()} for help formatting this field.
 */
function list_auth_tokens_sample(string $formattedParent): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\BackupCollection;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\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 Google Cloud region. Please see
 *                                {@see MemorystoreClient::locationName()} for help formatting this field.
 */
function list_backup_collections_sample(string $formattedParent): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

    list_backup_collections_sample($formattedParent);
}

listBackups

Lists all backups owned by a backup collection.

The async variant is MemorystoreClient::listBackupsAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\Backup;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\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 MemorystoreClient::backupCollectionName()} for help formatting this field.
 */
function list_backups_sample(string $formattedParent): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

    list_backups_sample($formattedParent);
}

listInstances

Lists Instances in a given project and location.

The async variant is MemorystoreClient::listInstancesAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\ListInstancesRequest

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\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\Instance;
use Google\Cloud\Memorystore\V1\ListInstancesRequest;

/**
 * @param string $formattedParent The parent to list instances from.
 *                                Format: projects/{project}/locations/{location}
 *                                Please see {@see MemorystoreClient::locationName()} for help formatting this field.
 */
function list_instances_sample(string $formattedParent): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

        /** @var Instance $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = MemorystoreClient::locationName('[PROJECT]', '[LOCATION]');

    list_instances_sample($formattedParent);
}

listTokenAuthUsers

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

The async variant is MemorystoreClient::listTokenAuthUsersAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\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\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\ListTokenAuthUsersRequest;
use Google\Cloud\Memorystore\V1\TokenAuthUser;

/**
 * @param string $formattedParent The parent to list token auth users from.
 *                                Format: projects/{project}/locations/{location}/instances/{instance}
 *                                Please see {@see MemorystoreClient::instanceName()} for help formatting this field.
 */
function list_token_auth_users_sample(string $formattedParent): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

    list_token_auth_users_sample($formattedParent);
}

rescheduleMaintenance

Reschedules upcoming maintenance event.

The async variant is MemorystoreClient::rescheduleMaintenanceAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\RescheduleMaintenanceRequest

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\Memorystore\V1\Instance>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\Instance;
use Google\Cloud\Memorystore\V1\RescheduleMaintenanceRequest;
use Google\Cloud\Memorystore\V1\RescheduleMaintenanceRequest\RescheduleType;
use Google\Rpc\Status;

/**
 * @param string $formattedName  Name of the instance to reschedule maintenance for:
 *                               `projects/{project}/locations/{location_id}/instances/{instance}`
 *                               Please see {@see MemorystoreClient::instanceName()} for help formatting this field.
 * @param int    $rescheduleType If reschedule type is SPECIFIC_TIME, schedule_time must be set.
 */
function reschedule_maintenance_sample(string $formattedName, int $rescheduleType): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = MemorystoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');
    $rescheduleType = RescheduleType::RESCHEDULE_TYPE_UNSPECIFIED;

    reschedule_maintenance_sample($formattedName, $rescheduleType);
}

startMigration

Initiates the migration of a source instance to the target Memorystore instance.

After the successful completion of this operation, the target instance will:

  1. Set up replication with the source instance and replicate any writes to the source instance.
  2. Only allow reads.

The async variant is MemorystoreClient::startMigrationAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\StartMigrationRequest

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\Memorystore\V1\Instance>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\Instance;
use Google\Cloud\Memorystore\V1\SelfManagedSource;
use Google\Cloud\Memorystore\V1\StartMigrationRequest;
use Google\Rpc\Status;

/**
 * @param string $selfManagedSourceIpAddress                  The IP address of the source instance.
 *                                                            This IP address should be a stable IP address that can be accessed by the
 *                                                            Memorystore instance throughout the migration process.
 * @param int    $selfManagedSourcePort                       The port of the source instance.
 *                                                            This port should be a stable port that can be accessed by the Memorystore
 *                                                            instance throughout the migration process.
 * @param string $formattedSelfManagedSourceNetworkAttachment The resource name of the Private Service Connect Network
 *                                                            Attachment used to establish connectivity to the source instance. This
 *                                                            network attachment has the following requirements:
 *                                                            1. It must be in the same project as the Memorystore instance.
 *                                                            2. It must be in the same region as the Memorystore instance.
 *                                                            3. The subnet attached to the network attachment must be in the same VPC
 *                                                            network as the source instance nodes.
 *
 *                                                            Format:
 *                                                            projects/{project}/regions/{region}/networkAttachments/{network_attachment}
 *                                                            Please see {@see MemorystoreClient::networkAttachmentName()} for help formatting this field.
 * @param string $formattedName                               The resource name of the instance to start migration on.
 *                                                            Format: projects/{project}/locations/{location}/instances/{instance}
 *                                                            Please see {@see MemorystoreClient::instanceName()} for help formatting this field.
 */
function start_migration_sample(
    string $selfManagedSourceIpAddress,
    int $selfManagedSourcePort,
    string $formattedSelfManagedSourceNetworkAttachment,
    string $formattedName
): void {
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

    // Prepare the request message.
    $selfManagedSource = (new SelfManagedSource())
        ->setIpAddress($selfManagedSourceIpAddress)
        ->setPort($selfManagedSourcePort)
        ->setNetworkAttachment($formattedSelfManagedSourceNetworkAttachment);
    $request = (new StartMigrationRequest())
        ->setSelfManagedSource($selfManagedSource)
        ->setName($formattedName);

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

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $selfManagedSourceIpAddress = '[IP_ADDRESS]';
    $selfManagedSourcePort = 0;
    $formattedSelfManagedSourceNetworkAttachment = MemorystoreClient::networkAttachmentName(
        '[PROJECT]',
        '[REGION]',
        '[NETWORK_ATTACHMENT]'
    );
    $formattedName = MemorystoreClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]');

    start_migration_sample(
        $selfManagedSourceIpAddress,
        $selfManagedSourcePort,
        $formattedSelfManagedSourceNetworkAttachment,
        $formattedName
    );
}

updateInstance

Updates the parameters of a single Instance.

The async variant is MemorystoreClient::updateInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Memorystore\V1\UpdateInstanceRequest

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\Memorystore\V1\Instance>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Memorystore\V1\Client\MemorystoreClient;
use Google\Cloud\Memorystore\V1\Instance;
use Google\Cloud\Memorystore\V1\UpdateInstanceRequest;
use Google\Rpc\Status;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_instance_sample(): void
{
    // Create a client.
    $memorystoreClient = new MemorystoreClient();

    // Prepare the request message.
    $instance = new Instance();
    $request = (new UpdateInstanceRequest())
        ->setInstance($instance);

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

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getLocation

Gets information about a location.

The async variant is MemorystoreClient::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\Memorystore\V1\Client\MemorystoreClient;

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

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

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

This method lists locations based on the resource scope provided in the ListLocationsRequest.name field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.

For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.

The async variant is MemorystoreClient::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\Memorystore\V1\Client\MemorystoreClient;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $memorystoreClient->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\Memorystore\V1\AddAuthTokenRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

addTokenAuthUserAsync

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

backupInstanceAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\BackupInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createInstanceAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\CreateInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteAuthTokenAsync

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

deleteBackupAsync

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

deleteInstanceAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\DeleteInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteTokenAuthUserAsync

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

exportBackupAsync

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

finishMigrationAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\FinishMigrationRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getAuthTokenAsync

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

getBackupAsync

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

getBackupCollectionAsync

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

getCertificateAuthorityAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\GetCertificateAuthorityRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Memorystore\V1\CertificateAuthority>

getInstanceAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\GetInstanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Memorystore\V1\Instance>

getSharedRegionalCertificateAuthorityAsync

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

getTokenAuthUserAsync

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

listAuthTokensAsync

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

listBackupCollectionsAsync

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

listBackupsAsync

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

listInstancesAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\ListInstancesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listTokenAuthUsersAsync

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

rescheduleMaintenanceAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\RescheduleMaintenanceRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

startMigrationAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\StartMigrationRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateInstanceAsync

Parameters
Name Description
request Google\Cloud\Memorystore\V1\UpdateInstanceRequest
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::authTokenName

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

Parameters
Name Description
project string
location string
instance 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::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::instanceName

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

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

static::locationName

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

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

static::networkName

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

Parameters
Name Description
project string
network string
Returns
Type Description
string The formatted network resource.

static::networkAttachmentName

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

Parameters
Name Description
project string
region string
networkAttachment string
Returns
Type Description
string The formatted network_attachment 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
instance 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

  • authToken: projects/{project}/locations/{location}/instances/{instance}/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}
  • 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}
  • instance: projects/{project}/locations/{location}/instances/{instance}
  • location: projects/{project}/locations/{location}
  • network: projects/{project}/global/networks/{network}
  • networkAttachment: projects/{project}/regions/{region}/networkAttachments/{network_attachment}
  • serviceAttachment: projects/{project}/regions/{region}/serviceAttachments/{service_attachment}
  • sharedRegionalCertificateAuthority: projects/{project}/locations/{location}/sharedRegionalCertificateAuthority
  • tokenAuthUser: projects/{project}/locations/{location}/instances/{instance}/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.