cloudmemorystore

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const NamePrefix = "cms"

NamePrefix is the prefix for all created CloudMemorystore instances.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the supplied error indicates a CloudMemorystore instance was not found.

func NeedsUpdate

func NeedsUpdate(kube *v1alpha2.CloudMemorystoreInstance, gcp *redisv1pb.Instance) bool

NeedsUpdate returns true if the supplied Kubernetes resource differs from the supplied GCP resource. It considers only fields that can be modified in place without deleting and recreating the instance.

func NewCreateInstanceRequest

NewCreateInstanceRequest creates a request to create an instance suitable for use with the GCP API.

func NewDeleteInstanceRequest

func NewDeleteInstanceRequest(id InstanceID) *redisv1pb.DeleteInstanceRequest

NewDeleteInstanceRequest creates a request to delete an instance suitable for use with the GCP API.

func NewGetInstanceRequest

func NewGetInstanceRequest(id InstanceID) *redisv1pb.GetInstanceRequest

NewGetInstanceRequest creates a request to get an instance from the GCP API.

func NewInstanceTier

func NewInstanceTier(t string) redisv1pb.Instance_Tier

NewInstanceTier converts the supplied string representation of a tier into an Instance_Tier suitable for use with requests to the GCP API.

func NewUpdateInstanceRequest

NewUpdateInstanceRequest creates a request to update an instance suitable for use with the GCP API.

Types

type Client

type Client interface {
	CreateInstance(ctx context.Context, req *redisv1pb.CreateInstanceRequest, opts ...gax.CallOption) (*redisv1.CreateInstanceOperation, error)
	UpdateInstance(ctx context.Context, req *redisv1pb.UpdateInstanceRequest, opts ...gax.CallOption) (*redisv1.UpdateInstanceOperation, error)
	DeleteInstance(ctx context.Context, req *redisv1pb.DeleteInstanceRequest, opts ...gax.CallOption) (*redisv1.DeleteInstanceOperation, error)
	GetInstance(ctx context.Context, req *redisv1pb.GetInstanceRequest, opts ...gax.CallOption) (*redisv1pb.Instance, error)
}

A Client handles CRUD operations for Cloud Memorystore instances. This interface is compatible with the upstream CloudRedisClient.

func NewClient

func NewClient(ctx context.Context, credentials []byte) (Client, error)

NewClient returns a new CloudMemorystore Client. Credentials must be passed as JSON encoded data.

type InstanceID

type InstanceID struct {
	// Project in which this instance exists.
	Project string

	// Region in which this instance exists. The API calls this a 'location',
	// which is an overloaded term considering instances also have a 'location
	// id' (and 'alternative location id'), which represent zones.
	Region string

	// Instance name, or ID. The GCP API appears to call the unqualified name
	// (e.g. 'coolinstance') an ID, and the qualified name (e.g.
	// 'projects/coolproject/locations/us-west2/instances/coolinstance') a name.
	Instance string
}

An InstanceID represents a CloudMemorystore instance in the GCP API.

func NewInstanceID

func NewInstanceID(project string, i *v1alpha2.CloudMemorystoreInstance) InstanceID

NewInstanceID returns an identifier used to represent CloudMemorystore instances in the GCP API. Instances may have names of up to 40 characters. We use a four character prefix and a 36 character UUID. https://godoc.org/google.golang.org/genproto/googleapis/cloud/redis/v1#CreateInstanceRequest

func (InstanceID) Name

func (id InstanceID) Name() string

Name returns the instance's name, suitable for get and delete API calls.

func (InstanceID) Parent

func (id InstanceID) Parent() string

Parent returns the instance's parent, suitable for the create API call.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL