package cluster
import "cloud.google.com/go/redis/cluster/apiv1"
Package cluster is an auto-generated package for the Google Cloud Memorystore for Redis API.
Creates and manages Redis instances on the Google Cloud Platform.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page 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.
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_Options c, err := cluster.NewCloudRedisClusterClient(ctx) if err != nil { // TODO: Handle error. } defer c.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.
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_Options c, err := cluster.NewCloudRedisClusterClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &clusterpb.CreateClusterRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/redis/cluster/apiv1/clusterpb#CreateClusterRequest. } op, err := c.CreateCluster(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewCloudRedisClusterClient is used for authentication requests and for 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.
Index ¶
- func DefaultAuthScopes() []string
- type CloudRedisClusterCallOptions
- type CloudRedisClusterClient
- func NewCloudRedisClusterClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClusterClient, error)
- func NewCloudRedisClusterRESTClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClusterClient, error)
- func (c *CloudRedisClusterClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
- func (c *CloudRedisClusterClient) Close() error
- func (c *CloudRedisClusterClient) Connection() *grpc.ClientConn
- func (c *CloudRedisClusterClient) CreateCluster(ctx context.Context, req *clusterpb.CreateClusterRequest, opts ...gax.CallOption) (*CreateClusterOperation, error)
- func (c *CloudRedisClusterClient) CreateClusterOperation(name string) *CreateClusterOperation
- func (c *CloudRedisClusterClient) DeleteCluster(ctx context.Context, req *clusterpb.DeleteClusterRequest, opts ...gax.CallOption) (*DeleteClusterOperation, error)
- func (c *CloudRedisClusterClient) DeleteClusterOperation(name string) *DeleteClusterOperation
- func (c *CloudRedisClusterClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
- func (c *CloudRedisClusterClient) GetCluster(ctx context.Context, req *clusterpb.GetClusterRequest, opts ...gax.CallOption) (*clusterpb.Cluster, error)
- func (c *CloudRedisClusterClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
- func (c *CloudRedisClusterClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *CloudRedisClusterClient) ListClusters(ctx context.Context, req *clusterpb.ListClustersRequest, opts ...gax.CallOption) *ClusterIterator
- func (c *CloudRedisClusterClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
- func (c *CloudRedisClusterClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
- func (c *CloudRedisClusterClient) UpdateCluster(ctx context.Context, req *clusterpb.UpdateClusterRequest, opts ...gax.CallOption) (*UpdateClusterOperation, error)
- func (c *CloudRedisClusterClient) UpdateClusterOperation(name string) *UpdateClusterOperation
- type ClusterIterator
- func (it *ClusterIterator) Next() (*clusterpb.Cluster, error)
- func (it *ClusterIterator) PageInfo() *iterator.PageInfo
- type CreateClusterOperation
- func (op *CreateClusterOperation) Done() bool
- func (op *CreateClusterOperation) Metadata() (*anypb.Any, error)
- func (op *CreateClusterOperation) Name() string
- func (op *CreateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*clusterpb.Cluster, error)
- func (op *CreateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*clusterpb.Cluster, error)
- type DeleteClusterOperation
- func (op *DeleteClusterOperation) Done() bool
- func (op *DeleteClusterOperation) Metadata() (*anypb.Any, error)
- func (op *DeleteClusterOperation) Name() string
- func (op *DeleteClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type LocationIterator
- func (it *LocationIterator) Next() (*locationpb.Location, error)
- func (it *LocationIterator) PageInfo() *iterator.PageInfo
- type OperationIterator
- func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
- func (it *OperationIterator) PageInfo() *iterator.PageInfo
- type UpdateClusterOperation
- func (op *UpdateClusterOperation) Done() bool
- func (op *UpdateClusterOperation) Metadata() (*anypb.Any, error)
- func (op *UpdateClusterOperation) Name() string
- func (op *UpdateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*clusterpb.Cluster, error)
- func (op *UpdateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*clusterpb.Cluster, error)
Examples ¶
- CloudRedisClusterClient.CancelOperation
- CloudRedisClusterClient.CreateCluster
- CloudRedisClusterClient.DeleteCluster
- CloudRedisClusterClient.DeleteOperation
- CloudRedisClusterClient.GetCluster
- CloudRedisClusterClient.GetLocation
- CloudRedisClusterClient.GetOperation
- CloudRedisClusterClient.ListClusters
- CloudRedisClusterClient.ListLocations
- CloudRedisClusterClient.ListOperations
- CloudRedisClusterClient.UpdateCluster
- NewCloudRedisClusterClient
- NewCloudRedisClusterRESTClient
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type CloudRedisClusterCallOptions ¶
type CloudRedisClusterCallOptions struct { ListClusters []gax.CallOption GetCluster []gax.CallOption UpdateCluster []gax.CallOption DeleteCluster []gax.CallOption CreateCluster []gax.CallOption GetLocation []gax.CallOption ListLocations []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
CloudRedisClusterCallOptions contains the retry settings for each method of CloudRedisClusterClient.
type CloudRedisClusterClient ¶
type CloudRedisClusterClient struct { // The call options for this service. CallOptions *CloudRedisClusterCallOptions // 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 }
CloudRedisClusterClient 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 clusters
Google Cloud Memorystore for Redis Cluster
The redis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis clusters:
The service works with a collection of cloud projects, named: /projects/* Each project has a collection of available locations, named: /locations/* Each location has a collection of Redis clusters, named: /clusters/* As such, Redis clusters are resources of the form: /projects/{project_id}/locations/{location_id}/clusters/{instance_id}
Note that location_id must be a GCP region; for example:
projects/redpepper-1290/locations/us-central1/clusters/my-redis
We use API version selector for Flex APIs
The versioning strategy is release-based versioning Our backend CLH only deals with the superset version (called v1main) Existing backend for Redis Gen1 and MRR is not touched. More details in go/redis-flex-api-versioning
func NewCloudRedisClusterClient ¶
func NewCloudRedisClusterClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClusterClient, error)
NewCloudRedisClusterClient creates a new cloud redis cluster 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 clusters
Google Cloud Memorystore for Redis Cluster
The redis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis clusters:
The service works with a collection of cloud projects, named: /projects/* Each project has a collection of available locations, named: /locations/* Each location has a collection of Redis clusters, named: /clusters/* As such, Redis clusters are resources of the form: /projects/{project_id}/locations/{location_id}/clusters/{instance_id}
Note that location_id must be a GCP region; for example:
projects/redpepper-1290/locations/us-central1/clusters/my-redis
We use API version selector for Flex APIs
The versioning strategy is release-based versioning Our backend CLH only deals with the superset version (called v1main) Existing backend for Redis Gen1 and MRR is not touched. More details in go/redis-flex-api-versioning
Example¶
Code:play
package main import ( "context" cluster "cloud.google.com/go/redis/cluster/apiv1" ) func main() { 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_Options c, err := cluster.NewCloudRedisClusterClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
func NewCloudRedisClusterRESTClient ¶
func NewCloudRedisClusterRESTClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClusterClient, error)
NewCloudRedisClusterRESTClient creates a new cloud redis cluster rest client.
Configures and manages Cloud Memorystore for Redis clusters
Google Cloud Memorystore for Redis Cluster
The redis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis clusters:
The service works with a collection of cloud projects, named: /projects/* Each project has a collection of available locations, named: /locations/* Each location has a collection of Redis clusters, named: /clusters/* As such, Redis clusters are resources of the form: /projects/{project_id}/locations/{location_id}/clusters/{instance_id}
Note that location_id must be a GCP region; for example:
projects/redpepper-1290/locations/us-central1/clusters/my-redis
We use API version selector for Flex APIs
The versioning strategy is release-based versioning Our backend CLH only deals with the superset version (called v1main) Existing backend for Redis Gen1 and MRR is not touched. More details in go/redis-flex-api-versioning
Example¶
Code:play
package main import ( "context" cluster "cloud.google.com/go/redis/cluster/apiv1" ) func main() { 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_Options c, err := cluster.NewCloudRedisClusterRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
func (*CloudRedisClusterClient) CancelOperation ¶
func (c *CloudRedisClusterClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
cluster "cloud.google.com/go/redis/cluster/apiv1"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
}
func (*CloudRedisClusterClient) Close ¶
func (c *CloudRedisClusterClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CloudRedisClusterClient) Connection ¶
func (c *CloudRedisClusterClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*CloudRedisClusterClient) CreateCluster ¶
func (c *CloudRedisClusterClient) CreateCluster(ctx context.Context, req *clusterpb.CreateClusterRequest, opts ...gax.CallOption) (*CreateClusterOperation, error)
CreateCluster creates a Redis cluster based on the specified properties. The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster object in the response field.
The returned operation is automatically deleted after a few hours, so there
is no need to call DeleteOperation.
Code:play
Example¶
package main
import (
"context"
cluster "cloud.google.com/go/redis/cluster/apiv1"
clusterpb "cloud.google.com/go/redis/cluster/apiv1/clusterpb"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &clusterpb.CreateClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/redis/cluster/apiv1/clusterpb#CreateClusterRequest.
}
op, err := c.CreateCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudRedisClusterClient) CreateClusterOperation ¶
func (c *CloudRedisClusterClient) CreateClusterOperation(name string) *CreateClusterOperation
CreateClusterOperation returns a new CreateClusterOperation from a given name. The name must be that of a previously created CreateClusterOperation, possibly from a different process.
func (*CloudRedisClusterClient) DeleteCluster ¶
func (c *CloudRedisClusterClient) DeleteCluster(ctx context.Context, req *clusterpb.DeleteClusterRequest, opts ...gax.CallOption) (*DeleteClusterOperation, error)
DeleteCluster deletes a specific Redis cluster. Cluster stops serving and data is
deleted.
Code:play
Example¶
package main
import (
"context"
cluster "cloud.google.com/go/redis/cluster/apiv1"
clusterpb "cloud.google.com/go/redis/cluster/apiv1/clusterpb"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &clusterpb.DeleteClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/redis/cluster/apiv1/clusterpb#DeleteClusterRequest.
}
op, err := c.DeleteCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*CloudRedisClusterClient) DeleteClusterOperation ¶
func (c *CloudRedisClusterClient) DeleteClusterOperation(name string) *DeleteClusterOperation
DeleteClusterOperation returns a new DeleteClusterOperation from a given name. The name must be that of a previously created DeleteClusterOperation, possibly from a different process.
func (*CloudRedisClusterClient) DeleteOperation ¶
func (c *CloudRedisClusterClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
cluster "cloud.google.com/go/redis/cluster/apiv1"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
}
func (*CloudRedisClusterClient) GetCluster ¶
func (c *CloudRedisClusterClient) GetCluster(ctx context.Context, req *clusterpb.GetClusterRequest, opts ...gax.CallOption) (*clusterpb.Cluster, error)
GetCluster gets the details of a specific Redis cluster.
Code:play
Example¶
package main
import (
"context"
cluster "cloud.google.com/go/redis/cluster/apiv1"
clusterpb "cloud.google.com/go/redis/cluster/apiv1/clusterpb"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &clusterpb.GetClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/redis/cluster/apiv1/clusterpb#GetClusterRequest.
}
resp, err := c.GetCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudRedisClusterClient) GetLocation ¶
func (c *CloudRedisClusterClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Code:play
Example¶
package main
import (
"context"
cluster "cloud.google.com/go/redis/cluster/apiv1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudRedisClusterClient) GetOperation ¶
func (c *CloudRedisClusterClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
cluster "cloud.google.com/go/redis/cluster/apiv1"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudRedisClusterClient) ListClusters ¶
func (c *CloudRedisClusterClient) ListClusters(ctx context.Context, req *clusterpb.ListClustersRequest, opts ...gax.CallOption) *ClusterIterator
ListClusters lists all Redis clusters owned by a project in either the specified location (region) or all locations.
The location should have the following format:
projects/{project_id}/locations/{location_id}
If location_id is specified as - (wildcard), then all regions
available to the project are queried, and the results are aggregated.
Code:play
Example¶
package main
import (
"context"
cluster "cloud.google.com/go/redis/cluster/apiv1"
clusterpb "cloud.google.com/go/redis/cluster/apiv1/clusterpb"
"google.golang.org/api/iterator"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &clusterpb.ListClustersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/redis/cluster/apiv1/clusterpb#ListClustersRequest.
}
it := c.ListClusters(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CloudRedisClusterClient) ListLocations ¶
func (c *CloudRedisClusterClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Code:play
Example¶
package main
import (
"context"
cluster "cloud.google.com/go/redis/cluster/apiv1"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CloudRedisClusterClient) ListOperations ¶
func (c *CloudRedisClusterClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
cluster "cloud.google.com/go/redis/cluster/apiv1"
"google.golang.org/api/iterator"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CloudRedisClusterClient) UpdateCluster ¶
func (c *CloudRedisClusterClient) UpdateCluster(ctx context.Context, req *clusterpb.UpdateClusterRequest, opts ...gax.CallOption) (*UpdateClusterOperation, error)
UpdateCluster updates the metadata and configuration of a specific Redis cluster.
Completed longrunning.Operation will contain the new cluster object
in the response field. The returned operation is automatically deleted
after a few hours, so there is no need to call DeleteOperation.
Code:play
Example¶
package main
import (
"context"
cluster "cloud.google.com/go/redis/cluster/apiv1"
clusterpb "cloud.google.com/go/redis/cluster/apiv1/clusterpb"
)
func main() {
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_Options
c, err := cluster.NewCloudRedisClusterClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &clusterpb.UpdateClusterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/redis/cluster/apiv1/clusterpb#UpdateClusterRequest.
}
op, err := c.UpdateCluster(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudRedisClusterClient) UpdateClusterOperation ¶
func (c *CloudRedisClusterClient) UpdateClusterOperation(name string) *UpdateClusterOperation
UpdateClusterOperation returns a new UpdateClusterOperation from a given name. The name must be that of a previously created UpdateClusterOperation, possibly from a different process.
type ClusterIterator ¶
type ClusterIterator struct { // 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. Response interface{} // 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. InternalFetch func(pageSize int, pageToken string) (results []*clusterpb.Cluster, nextPageToken string, err error) // contains filtered or unexported fields }
ClusterIterator manages a stream of *clusterpb.Cluster.
func (*ClusterIterator) Next ¶
func (it *ClusterIterator) Next() (*clusterpb.Cluster, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ClusterIterator) PageInfo ¶
func (it *ClusterIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type CreateClusterOperation ¶
type CreateClusterOperation struct {
// contains filtered or unexported fields
}
CreateClusterOperation manages a long-running operation from CreateCluster.
func (*CreateClusterOperation) Done ¶
func (op *CreateClusterOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateClusterOperation) Metadata ¶
func (op *CreateClusterOperation) Metadata() (*anypb.Any, 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 (*CreateClusterOperation) Name ¶
func (op *CreateClusterOperation) Name() string
Name 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 (*CreateClusterOperation) Poll ¶
func (op *CreateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*clusterpb.Cluster, 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 and the 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 (*CreateClusterOperation) Wait ¶
func (op *CreateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*clusterpb.Cluster, 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.
type DeleteClusterOperation ¶
type DeleteClusterOperation struct {
// contains filtered or unexported fields
}
DeleteClusterOperation manages a long-running operation from DeleteCluster.
func (*DeleteClusterOperation) Done ¶
func (op *DeleteClusterOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteClusterOperation) Metadata ¶
func (op *DeleteClusterOperation) Metadata() (*anypb.Any, 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 (*DeleteClusterOperation) Name ¶
func (op *DeleteClusterOperation) Name() string
Name 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 (*DeleteClusterOperation) Poll ¶
func (op *DeleteClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) 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 and the 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 (*DeleteClusterOperation) Wait ¶
func (op *DeleteClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
type LocationIterator ¶
type LocationIterator struct { // 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. Response interface{} // 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. InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error) // contains filtered or unexported fields }
LocationIterator manages a stream of *locationpb.Location.
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 more results. Once Next returns Done, all subsequent calls will return Done.
func (*LocationIterator) PageInfo ¶
func (it *LocationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type OperationIterator ¶
type OperationIterator struct { // 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. Response interface{} // 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. InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) // contains filtered or unexported fields }
OperationIterator manages a stream of *longrunningpb.Operation.
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 more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo ¶
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type UpdateClusterOperation ¶
type UpdateClusterOperation struct {
// contains filtered or unexported fields
}
UpdateClusterOperation manages a long-running operation from UpdateCluster.
func (*UpdateClusterOperation) Done ¶
func (op *UpdateClusterOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateClusterOperation) Metadata ¶
func (op *UpdateClusterOperation) Metadata() (*anypb.Any, 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 (*UpdateClusterOperation) Name ¶
func (op *UpdateClusterOperation) Name() string
Name 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 (*UpdateClusterOperation) Poll ¶
func (op *UpdateClusterOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*clusterpb.Cluster, 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 and the 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 (*UpdateClusterOperation) Wait ¶
func (op *UpdateClusterOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*clusterpb.Cluster, 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.
Source Files ¶
auxiliary.go cloud_redis_cluster_client.go doc.go version.go
Directories ¶
Path | Synopsis |
---|---|
cluster/apiv1/clusterpb |
- Version
- v1.14.2
- Published
- Jan 30, 2024
- Platform
- js/wasm
- Imports
- 25 packages
- Last checked
- 10 hours ago –
Tools for package owners.