Google Cloud Memorystore for Redis API v1 - Package cloud.google.com/go/redis/apiv1 (v1.18.3) Stay organized with collections Save and categorize content based on your preferences.
Package redis is an auto-generated package for theGoogle Cloud Memorystore for Redis API.
Creates and manages Redis instances on the Google Cloud Platform.
General documentation
For information that is relevant for all client libraries please referencehttps://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on thispage includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/redis/apiv1@latestctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed.The methods of Client are safe for concurrent use by multiple goroutines.The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req:=&redispb.CreateInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#CreateInstanceRequest.}op,err:=c.CreateInstance(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp
Use of Context
The ctx passed to NewCloudRedisClient is used for authentication requests andfor creating the underlying connection, but is not used for subsequent calls.Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func DefaultAuthScopes
funcDefaultAuthScopes()[]stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
CloudRedisCallOptions
typeCloudRedisCallOptionsstruct{ListInstances[]gax.CallOptionGetInstance[]gax.CallOptionGetInstanceAuthString[]gax.CallOptionCreateInstance[]gax.CallOptionUpdateInstance[]gax.CallOptionUpgradeInstance[]gax.CallOptionImportInstance[]gax.CallOptionExportInstance[]gax.CallOptionFailoverInstance[]gax.CallOptionDeleteInstance[]gax.CallOptionRescheduleMaintenance[]gax.CallOptionGetLocation[]gax.CallOptionListLocations[]gax.CallOptionCancelOperation[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOption}CloudRedisCallOptions contains the retry settings for each method of CloudRedisClient.
CloudRedisClient
typeCloudRedisClientstruct{// The call options for this service.CallOptions*CloudRedisCallOptions// LROClient is used internally to handle long-running operations.// It is exposed so that its CallOptions can be modified if required.// Users should not Close this client.LROClient*lroauto.OperationsClient// contains filtered or unexported fields}CloudRedisClient is a client for interacting with Google Cloud Memorystore for Redis API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Configures and manages Cloud Memorystore for Redis instances
Google Cloud Memorystore for Redis v1
The redis.googleapis.com service implements the Google Cloud Memorystorefor Redis API and defines the following resource model for managing Redisinstances:
The service works with a collection of cloud projects, named: /projects/*Each project has a collection of available locations, named: /locations/*Each location has a collection of Redis instances, named: /instances/*As such, Redis instances are resources of the form:/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-redisfunc NewCloudRedisClient
funcNewCloudRedisClient(ctxcontext.Context,opts...option.ClientOption)(*CloudRedisClient,error)NewCloudRedisClient creates a new cloud redis client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Configures and manages Cloud Memorystore for Redis instances
Google Cloud Memorystore for Redis v1
The redis.googleapis.com service implements the Google Cloud Memorystorefor Redis API and defines the following resource model for managing Redisinstances:
The service works with a collection of cloud projects, named: /projects/*Each project has a collection of available locations, named: /locations/*Each location has a collection of Redis instances, named: /instances/*As such, Redis instances are resources of the form:/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-redisExample
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewCloudRedisRESTClient
funcNewCloudRedisRESTClient(ctxcontext.Context,opts...option.ClientOption)(*CloudRedisClient,error)NewCloudRedisRESTClient creates a new cloud redis rest client.
Configures and manages Cloud Memorystore for Redis instances
Google Cloud Memorystore for Redis v1
The redis.googleapis.com service implements the Google Cloud Memorystorefor Redis API and defines the following resource model for managing Redisinstances:
The service works with a collection of cloud projects, named: /projects/*Each project has a collection of available locations, named: /locations/*Each location has a collection of Redis instances, named: /instances/*As such, Redis instances are resources of the form:/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-redisExample
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*CloudRedisClient) CancelOperation
func(c*CloudRedisClient)CancelOperation(ctxcontext.Context,req*longrunningpb.CancelOperationRequest,opts...gax.CallOption)errorCancelOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"redis"cloud.google.com/go/redis/apiv1")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.CancelOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.}err=c.CancelOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*CloudRedisClient) Close
func(c*CloudRedisClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*CloudRedisClient) Connection (deprecated)
func(c*CloudRedisClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*CloudRedisClient) CreateInstance
func(c*CloudRedisClient)CreateInstance(ctxcontext.Context,req*redispb.CreateInstanceRequest,opts...gax.CallOption)(*CreateInstanceOperation,error)CreateInstance creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project’sdefault network (athttps://cloud.google.com/vpc/docs/vpc).
The creation is executed asynchronously and callers may check the returnedoperation to track its progress. Once the operation is completed the Redisinstance will be fully functional. Completed longrunning.Operation willcontain the new instance object in the response field.
The returned operation is automatically deleted after a few hours, so thereis no need to call DeleteOperation.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.CreateInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#CreateInstanceRequest.}op,err:=c.CreateInstance(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) CreateInstanceOperation
func(c*CloudRedisClient)CreateInstanceOperation(namestring)*CreateInstanceOperationCreateInstanceOperation returns a new CreateInstanceOperation from a given name.The name must be that of a previously created CreateInstanceOperation, possibly from a different process.
func (*CloudRedisClient) DeleteInstance
func(c*CloudRedisClient)DeleteInstance(ctxcontext.Context,req*redispb.DeleteInstanceRequest,opts...gax.CallOption)(*DeleteInstanceOperation,error)DeleteInstance deletes a specific Redis instance. Instance stops serving and data isdeleted.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.DeleteInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#DeleteInstanceRequest.}op,err:=c.DeleteInstance(ctx,req)iferr!=nil{// TODO: Handle error.}err=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}}func (*CloudRedisClient) DeleteInstanceOperation
func(c*CloudRedisClient)DeleteInstanceOperation(namestring)*DeleteInstanceOperationDeleteInstanceOperation returns a new DeleteInstanceOperation from a given name.The name must be that of a previously created DeleteInstanceOperation, possibly from a different process.
func (*CloudRedisClient) DeleteOperation
func(c*CloudRedisClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"redis"cloud.google.com/go/redis/apiv1")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*CloudRedisClient) ExportInstance
func(c*CloudRedisClient)ExportInstance(ctxcontext.Context,req*redispb.ExportInstanceRequest,opts...gax.CallOption)(*ExportInstanceOperation,error)ExportInstance 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, sothere is no need to call DeleteOperation.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.ExportInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#ExportInstanceRequest.}op,err:=c.ExportInstance(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) ExportInstanceOperation
func(c*CloudRedisClient)ExportInstanceOperation(namestring)*ExportInstanceOperationExportInstanceOperation returns a new ExportInstanceOperation from a given name.The name must be that of a previously created ExportInstanceOperation, possibly from a different process.
func (*CloudRedisClient) FailoverInstance
func(c*CloudRedisClient)FailoverInstance(ctxcontext.Context,req*redispb.FailoverInstanceRequest,opts...gax.CallOption)(*FailoverInstanceOperation,error)FailoverInstance initiates a failover of the primary node to current replica node for aspecific STANDARD tier Cloud Memorystore for Redis instance.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.FailoverInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#FailoverInstanceRequest.}op,err:=c.FailoverInstance(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) FailoverInstanceOperation
func(c*CloudRedisClient)FailoverInstanceOperation(namestring)*FailoverInstanceOperationFailoverInstanceOperation returns a new FailoverInstanceOperation from a given name.The name must be that of a previously created FailoverInstanceOperation, possibly from a different process.
func (*CloudRedisClient) GetInstance
func(c*CloudRedisClient)GetInstance(ctxcontext.Context,req*redispb.GetInstanceRequest,opts...gax.CallOption)(*redispb.Instance,error)GetInstance gets the details of a specific Redis instance.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.GetInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#GetInstanceRequest.}resp,err:=c.GetInstance(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) GetInstanceAuthString
func(c*CloudRedisClient)GetInstanceAuthString(ctxcontext.Context,req*redispb.GetInstanceAuthStringRequest,opts...gax.CallOption)(*redispb.InstanceAuthString,error)GetInstanceAuthString gets the AUTH string for a Redis instance. If AUTH is not enabled for theinstance the response will be empty. This information is not included inthe details returned to GetInstance.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.GetInstanceAuthStringRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#GetInstanceAuthStringRequest.}resp,err:=c.GetInstanceAuthString(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) GetLocation
func(c*CloudRedisClient)GetLocation(ctxcontext.Context,req*locationpb.GetLocationRequest,opts...gax.CallOption)(*locationpb.Location,error)GetLocation gets information about a location.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"locationpb"google.golang.org/genproto/googleapis/cloud/location")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&locationpb.GetLocationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.}resp,err:=c.GetLocation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) GetOperation
func(c*CloudRedisClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"redis"cloud.google.com/go/redis/apiv1")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.GetOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.}resp,err:=c.GetOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) ImportInstance
func(c*CloudRedisClient)ImportInstance(ctxcontext.Context,req*redispb.ImportInstanceRequest,opts...gax.CallOption)(*ImportInstanceOperation,error)ImportInstance import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
Redis may stop serving during this operation. Instance state will beIMPORTING for entire operation. When complete, the instance will containonly data from the imported file.
The returned operation is automatically deleted after a few hours, sothere is no need to call DeleteOperation.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.ImportInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#ImportInstanceRequest.}op,err:=c.ImportInstance(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) ImportInstanceOperation
func(c*CloudRedisClient)ImportInstanceOperation(namestring)*ImportInstanceOperationImportInstanceOperation returns a new ImportInstanceOperation from a given name.The name must be that of a previously created ImportInstanceOperation, possibly from a different process.
func (*CloudRedisClient) ListInstances
func(c*CloudRedisClient)ListInstances(ctxcontext.Context,req*redispb.ListInstancesRequest,opts...gax.CallOption)*InstanceIteratorListInstances lists all Redis instances owned by a project in either the specifiedlocation (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 regionsavailable to the project are queried, and the results are aggregated.
Examples
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.ListInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#ListInstancesRequest.}it:=c.ListInstances(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*redispb.ListInstancesResponse)}}all
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.ListInstancesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#ListInstancesRequest.}forresp,err:=rangec.ListInstances(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*CloudRedisClient) ListLocations
func(c*CloudRedisClient)ListLocations(ctxcontext.Context,req*locationpb.ListLocationsRequest,opts...gax.CallOption)*LocationIteratorListLocations lists information about the supported locations for this service.
Examples
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1""google.golang.org/api/iterator"locationpb"google.golang.org/genproto/googleapis/cloud/location")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&locationpb.ListLocationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.}it:=c.ListLocations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*locationpb.ListLocationsResponse)}}all
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"locationpb"google.golang.org/genproto/googleapis/cloud/location")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&locationpb.ListLocationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.}forresp,err:=rangec.ListLocations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*CloudRedisClient) ListOperations
func(c*CloudRedisClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"redis"cloud.google.com/go/redis/apiv1""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"redis"cloud.google.com/go/redis/apiv1")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*CloudRedisClient) RescheduleMaintenance
func(c*CloudRedisClient)RescheduleMaintenance(ctxcontext.Context,req*redispb.RescheduleMaintenanceRequest,opts...gax.CallOption)(*RescheduleMaintenanceOperation,error)RescheduleMaintenance reschedule maintenance for a given instance in a given project andlocation.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.RescheduleMaintenanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#RescheduleMaintenanceRequest.}op,err:=c.RescheduleMaintenance(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) RescheduleMaintenanceOperation
func(c*CloudRedisClient)RescheduleMaintenanceOperation(namestring)*RescheduleMaintenanceOperationRescheduleMaintenanceOperation returns a new RescheduleMaintenanceOperation from a given name.The name must be that of a previously created RescheduleMaintenanceOperation, possibly from a different process.
func (*CloudRedisClient) UpdateInstance
func(c*CloudRedisClient)UpdateInstance(ctxcontext.Context,req*redispb.UpdateInstanceRequest,opts...gax.CallOption)(*UpdateInstanceOperation,error)UpdateInstance updates the metadata and configuration of a specific Redis instance.
Completed longrunning.Operation will contain the new instance objectin the response field. The returned operation is automatically deletedafter a few hours, so there is no need to call DeleteOperation.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.UpdateInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#UpdateInstanceRequest.}op,err:=c.UpdateInstance(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) UpdateInstanceOperation
func(c*CloudRedisClient)UpdateInstanceOperation(namestring)*UpdateInstanceOperationUpdateInstanceOperation returns a new UpdateInstanceOperation from a given name.The name must be that of a previously created UpdateInstanceOperation, possibly from a different process.
func (*CloudRedisClient) UpgradeInstance
func(c*CloudRedisClient)UpgradeInstance(ctxcontext.Context,req*redispb.UpgradeInstanceRequest,opts...gax.CallOption)(*UpgradeInstanceOperation,error)UpgradeInstance upgrades Redis instance to the newer Redis version specified in therequest.
Example
packagemainimport("context"redis"cloud.google.com/go/redis/apiv1"redispb"cloud.google.com/go/redis/apiv1/redispb")funcmain(){ctx:=context.Background()// This snippet 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 as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=redis.NewCloudRedisClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&redispb.UpgradeInstanceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/redis/apiv1/redispb#UpgradeInstanceRequest.}op,err:=c.UpgradeInstance(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*CloudRedisClient) UpgradeInstanceOperation
func(c*CloudRedisClient)UpgradeInstanceOperation(namestring)*UpgradeInstanceOperationUpgradeInstanceOperation returns a new UpgradeInstanceOperation from a given name.The name must be that of a previously created UpgradeInstanceOperation, possibly from a different process.
CreateInstanceOperation
typeCreateInstanceOperationstruct{// contains filtered or unexported fields}CreateInstanceOperation manages a long-running operation from CreateInstance.
func (*CreateInstanceOperation) Done
func(op*CreateInstanceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*CreateInstanceOperation) Metadata
func(op*CreateInstanceOperation)Metadata()(*redispb.OperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*CreateInstanceOperation) Name
func(op*CreateInstanceOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateInstanceOperation) Poll
func(op*CreateInstanceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateInstanceOperation) Wait
func(op*CreateInstanceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteInstanceOperation
typeDeleteInstanceOperationstruct{// contains filtered or unexported fields}DeleteInstanceOperation manages a long-running operation from DeleteInstance.
func (*DeleteInstanceOperation) Done
func(op*DeleteInstanceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*DeleteInstanceOperation) Metadata
func(op*DeleteInstanceOperation)Metadata()(*redispb.OperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteInstanceOperation) Name
func(op*DeleteInstanceOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteInstanceOperation) Poll
func(op*DeleteInstanceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)errorPoll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteInstanceOperation) Wait
func(op*DeleteInstanceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ExportInstanceOperation
typeExportInstanceOperationstruct{// contains filtered or unexported fields}ExportInstanceOperation manages a long-running operation from ExportInstance.
func (*ExportInstanceOperation) Done
func(op*ExportInstanceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*ExportInstanceOperation) Metadata
func(op*ExportInstanceOperation)Metadata()(*redispb.OperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*ExportInstanceOperation) Name
func(op*ExportInstanceOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*ExportInstanceOperation) Poll
func(op*ExportInstanceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ExportInstanceOperation) Wait
func(op*ExportInstanceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
FailoverInstanceOperation
typeFailoverInstanceOperationstruct{// contains filtered or unexported fields}FailoverInstanceOperation manages a long-running operation from FailoverInstance.
func (*FailoverInstanceOperation) Done
func(op*FailoverInstanceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*FailoverInstanceOperation) Metadata
func(op*FailoverInstanceOperation)Metadata()(*redispb.OperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*FailoverInstanceOperation) Name
func(op*FailoverInstanceOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*FailoverInstanceOperation) Poll
func(op*FailoverInstanceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*FailoverInstanceOperation) Wait
func(op*FailoverInstanceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ImportInstanceOperation
typeImportInstanceOperationstruct{// contains filtered or unexported fields}ImportInstanceOperation manages a long-running operation from ImportInstance.
func (*ImportInstanceOperation) Done
func(op*ImportInstanceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*ImportInstanceOperation) Metadata
func(op*ImportInstanceOperation)Metadata()(*redispb.OperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*ImportInstanceOperation) Name
func(op*ImportInstanceOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportInstanceOperation) Poll
func(op*ImportInstanceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportInstanceOperation) Wait
func(op*ImportInstanceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
InstanceIterator
typeInstanceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*redispb.Instance,nextPageTokenstring,errerror)// contains filtered or unexported fields}InstanceIterator manages a stream of *redispb.Instance.
func (*InstanceIterator) All
func(it*InstanceIterator)All()iter.Seq2[*redispb.Instance,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*InstanceIterator) Next
func(it*InstanceIterator)Next()(*redispb.Instance,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*InstanceIterator) PageInfo
func(it*InstanceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
LocationIterator
typeLocationIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*locationpb.Location,nextPageTokenstring,errerror)// contains filtered or unexported fields}LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All
func(it*LocationIterator)All()iter.Seq2[*locationpb.Location,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*LocationIterator) Next
func(it*LocationIterator)Next()(*locationpb.Location,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*LocationIterator) PageInfo
func(it*LocationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OperationIterator
typeOperationIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*longrunningpb.Operation,nextPageTokenstring,errerror)// contains filtered or unexported fields}OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func(it*OperationIterator)All()iter.Seq2[*longrunningpb.Operation,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*OperationIterator) Next
func(it*OperationIterator)Next()(*longrunningpb.Operation,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo
func(it*OperationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RescheduleMaintenanceOperation
typeRescheduleMaintenanceOperationstruct{// contains filtered or unexported fields}RescheduleMaintenanceOperation manages a long-running operation from RescheduleMaintenance.
func (*RescheduleMaintenanceOperation) Done
func(op*RescheduleMaintenanceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*RescheduleMaintenanceOperation) Metadata
func(op*RescheduleMaintenanceOperation)Metadata()(*redispb.OperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*RescheduleMaintenanceOperation) Name
func(op*RescheduleMaintenanceOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*RescheduleMaintenanceOperation) Poll
func(op*RescheduleMaintenanceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*RescheduleMaintenanceOperation) Wait
func(op*RescheduleMaintenanceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UpdateInstanceOperation
typeUpdateInstanceOperationstruct{// contains filtered or unexported fields}UpdateInstanceOperation manages a long-running operation from UpdateInstance.
func (*UpdateInstanceOperation) Done
func(op*UpdateInstanceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*UpdateInstanceOperation) Metadata
func(op*UpdateInstanceOperation)Metadata()(*redispb.OperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateInstanceOperation) Name
func(op*UpdateInstanceOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateInstanceOperation) Poll
func(op*UpdateInstanceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateInstanceOperation) Wait
func(op*UpdateInstanceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UpgradeInstanceOperation
typeUpgradeInstanceOperationstruct{// contains filtered or unexported fields}UpgradeInstanceOperation manages a long-running operation from UpgradeInstance.
func (*UpgradeInstanceOperation) Done
func(op*UpgradeInstanceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*UpgradeInstanceOperation) Metadata
func(op*UpgradeInstanceOperation)Metadata()(*redispb.OperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*UpgradeInstanceOperation) Name
func(op*UpgradeInstanceOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpgradeInstanceOperation) Poll
func(op*UpgradeInstanceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpgradeInstanceOperation) Wait
func(op*UpgradeInstanceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*redispb.Instance,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.