Stay organized with collections Save and categorize content based on your preferences.
CloudRedisClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Configures and manages Cloud Memorystore for Redis instances
Google Cloud Memorystore for Redis v1
The redis.googleapis.com
service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:
/projects/*
/locations/*
/instances/*
/projects/{project_id}/locations/{location_id}/instances/{instance_id}
Note that location_id must be referring to a GCP region
; for example:
projects/redpepper-1290/locations/us-central1/instances/my-redis
CloudRedisClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Parameters Name Description channelgrpc.Channel
DEPRECATED. A Channel
instance through which to make calls. This argument is mutually exclusive with credentials
; providing both will raise an exception.
google.auth.credentials.Credentials
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport
; doing so will raise an exception.
dict
DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.
client_infogoogle.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If None
, then default info will be used. Generally, you only need to set this if you're developing your own client library.
Union[dict, google.api_core.client_options.ClientOptions]
Client options used to set user options on the client. API Endpoint should be set through client_options.
create_instancecreate_instance(parent, instance_id, instance, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project's default network <https://cloud.google.com/compute/docs/networks-and-firewalls#networks>
__.
The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
.. rubric:: Example
Parameters Name Description parentfrom google.cloud import redis_v1 from google.cloud.redis_v1 import enums
client = redis_v1.CloudRedisClient()
parent = client.location_path('[PROJECT]', '[LOCATION]') instance_id = 'test_instance' tier = enums.Instance.Tier.BASIC memory_size_gb = 1 instance = {'tier': tier, 'memory_size_gb': memory_size_gb}
response = client.create_instance(parent, instance_id, instance)
def callback(operation_future): ... # Handle result. ... result = operation_future.result()
response.add_done_callback(callback)
metadata = response.metadata()
str
Required. The resource name of the instance location using the form: projects/{project_id}/locations/{location_id}
where location_id
refers to a GCP region.
str
Required. The logical name of the Redis instance in the customer project with the following restrictions: - Must contain only lowercase letters, numbers, and hyphens. - Must start with a letter. - Must be between 1-40 characters. - Must end with a number or a letter. - Must be unique within the customer project / location
instanceUnion[dict, Instance]
Required. A Redis [Instance] resource If a dict is provided, it must be of the same form as the protobuf message Instance
retryOptional[google.api_core.retry.Retry]
A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method.
Exceptions Type Description google.api_core.exceptions.GoogleAPICallError If the request failed for any reason. google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed. ValueError If the parameters are invalid. delete_instancedelete_instance(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Deletes a specific Redis instance. Instance stops serving and data is deleted.
.. rubric:: Example
Parameters Name Description namefrom google.cloud import redis_v1
client = redis_v1.CloudRedisClient()
name = client.instance_path('[PROJECT]', '[LOCATION]', '[INSTANCE]')
response = client.delete_instance(name)
def callback(operation_future): ... # Handle result. ... result = operation_future.result()
response.add_done_callback(callback)
metadata = response.metadata()
str
Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id}
where location_id
refers to a GCP region.
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method.
Exceptions Type Description google.api_core.exceptions.GoogleAPICallError If the request failed for any reason. google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed. ValueError If the parameters are invalid. export_instanceexport_instance(name, output_config, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Export Redis instance data into a Redis RDB format file in Cloud Storage.
Redis will continue serving during this operation.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
.. rubric:: Example
Parameters Name Description namefrom google.cloud import redis_v1
client = redis_v1.CloudRedisClient()
TODO: Initializename
:name = ''
TODO: Initializeoutput_config
:output_config = {}
response = client.export_instance(name, output_config)
def callback(operation_future): ... # Handle result. ... result = operation_future.result()
response.add_done_callback(callback)
metadata = response.metadata()
str
Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id}
where location_id
refers to a GCP region.
Union[dict, OutputConfig]
Required. Specify data to be exported. If a dict is provided, it must be of the same form as the protobuf message OutputConfig
retryOptional[google.api_core.retry.Retry]
A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method.
Exceptions Type Description google.api_core.exceptions.GoogleAPICallError If the request failed for any reason. google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed. ValueError If the parameters are invalid. failover_instancefailover_instance(name, data_protection_mode=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Initiates a failover of the master node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.
.. rubric:: Example
Parameters Name Description namefrom google.cloud import redis_v1
client = redis_v1.CloudRedisClient()
name = client.instance_path('[PROJECT]', '[LOCATION]', '[INSTANCE]')
response = client.failover_instance(name)
def callback(operation_future): ... # Handle result. ... result = operation_future.result()
response.add_done_callback(callback)
metadata = response.metadata()
str
Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id}
where location_id
refers to a GCP region.
DataProtectionMode
Optional. Available data protection modes that the user can choose. If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
retryOptional[google.api_core.retry.Retry]
A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method.
Exceptions Type Description google.api_core.exceptions.GoogleAPICallError If the request failed for any reason. google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed. ValueError If the parameters are invalid. from_service_account_filefrom_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter Name Description filenamestr
The path to the service account private key json file.
Returns Type Description CloudRedisClient The constructed client. from_service_account_jsonfrom_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter Name Description filenamestr
The path to the service account private key json file.
Returns Type Description CloudRedisClient The constructed client. get_instanceget_instance(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets the details of a specific Redis instance.
.. rubric:: Example
Parameters Name Description namefrom google.cloud import redis_v1
client = redis_v1.CloudRedisClient()
name = client.instance_path('[PROJECT]', '[LOCATION]', '[INSTANCE]')
response = client.get_instance(name)
str
Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id}
where location_id
refers to a GCP region.
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method.
Exceptions Type Description google.api_core.exceptions.GoogleAPICallError If the request failed for any reason. google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed. ValueError If the parameters are invalid. import_instanceimport_instance(name, input_config, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
.. rubric:: Example
Parameters Name Description namefrom google.cloud import redis_v1
client = redis_v1.CloudRedisClient()
TODO: Initializename
:name = ''
TODO: Initializeinput_config
:input_config = {}
response = client.import_instance(name, input_config)
def callback(operation_future): ... # Handle result. ... result = operation_future.result()
response.add_done_callback(callback)
metadata = response.metadata()
str
Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id}
where location_id
refers to a GCP region.
Union[dict, InputConfig]
Required. Specify data to be imported. If a dict is provided, it must be of the same form as the protobuf message InputConfig
retryOptional[google.api_core.retry.Retry]
A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method.
Exceptions Type Description google.api_core.exceptions.GoogleAPICallError If the request failed for any reason. google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed. ValueError If the parameters are invalid. instance_pathinstance_path(project, location, instance)
Return a fully-qualified instance string.
list_instanceslist_instances(parent, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists all Redis instances owned by a project in either the specified location (region) or all locations.
The location should have the following format:
projects/{project_id}/locations/{location_id}
If location_id
is specified as -
(wildcard), then all regions available to the project are queried, and the results are aggregated.
.. rubric:: Example
Parameters Name Description parentfrom google.cloud import redis_v1
client = redis_v1.CloudRedisClient()
parent = client.location_path('[PROJECT]', '[LOCATION]')
Iterate over all resultsfor element in client.list_instances(parent): ... # process element ... pass
Alternatively: Iterate over results one page at a timefor page in client.list_instances(parent).pages: ... for element in page: ... # process element ... pass
str
Required. The resource name of the instance location using the form: projects/{project_id}/locations/{location_id}
where location_id
refers to a GCP region.
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.
retryOptional[google.api_core.retry.Retry]
A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method.
Exceptions Type Description google.api_core.exceptions.GoogleAPICallError If the request failed for any reason. google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed. ValueError If the parameters are invalid. location_pathlocation_path(project, location)
Return a fully-qualified location string.
update_instanceupdate_instance(update_mask, instance, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates the metadata and configuration of a specific Redis instance.
Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
.. rubric:: Example
Parameters Name Description update_maskfrom google.cloud import redis_v1
client = redis_v1.CloudRedisClient()
paths_element = 'display_name' paths_element_2 = 'memory_size_gb' paths = [paths_element, paths_element_2] update_mask = {'paths': paths} display_name = 'UpdatedDisplayName' name = 'projects/
response = client.update_instance(update_mask, instance)
def callback(operation_future): ... # Handle result. ... result = operation_future.result()
response.add_done_callback(callback)
metadata = response.metadata()
Union[dict, FieldMask]
Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field may only include these fields from Instance
: - displayName
- labels
- memorySizeGb
- redisConfig
If a dict is provided, it must be of the same form as the protobuf message FieldMask
Union[dict, Instance]
Required. Update description. Only fields specified in update_mask are updated. If a dict is provided, it must be of the same form as the protobuf message Instance
retryOptional[google.api_core.retry.Retry]
A retry object used to retry requests. If None
is specified, requests will be retried using a default configuration.
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if retry
is specified, the timeout applies to each individual attempt.
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method.
Exceptions Type Description google.api_core.exceptions.GoogleAPICallError If the request failed for any reason. google.api_core.exceptions.RetryError If the request failed due to a retryable error and retry attempts failed. ValueError If the parameters are invalid.Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4