framework

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 26 Imported by: 49

Documentation

Overview

Package framework is the common package that any plugin client will need to import, for example, both plugin authors and Velero core.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllPluginKinds added in v1.0.1

func AllPluginKinds() map[string]PluginKind

AllPluginKinds contains all the valid plugin kinds that Velero supports, excluding PluginLister because that is not a kind that a developer would ever need to implement (it's handled by Velero and the Velero plugin library code).

func Handshake

func Handshake() plugin.HandshakeConfig

Handshake returns the configuration information that allows go-plugin clients and servers to perform a handshake.

func ValidateObjectStoreConfigKeys added in v1.2.0

func ValidateObjectStoreConfigKeys(config map[string]string, validKeys ...string) error

ValidateObjectStoreConfigKeys ensures that an object store's config is valid by making sure each `config` key is in the `validKeys` list. The special keys "bucket" and "prefix" are always considered valid.

func ValidatePluginName

func ValidatePluginName(name string, existingNames []string) error

ValidatePluginName checks if the given name: - the plugin name has two parts separated by '/' - non of the above parts is empty - the prefix is a valid DNS subdomain name - a plugin with the same name does not already exist (if list of existing names is passed in)

func ValidateVolumeSnapshotterConfigKeys added in v1.2.0

func ValidateVolumeSnapshotterConfigKeys(config map[string]string, validKeys ...string) error

ValidateVolumeSnapshotterConfigKeys ensures that a volume snapshotter's config is valid by making sure each `config` key is in the `validKeys` list.

Types

type BackupItemActionGRPCClient

type BackupItemActionGRPCClient struct {
	// contains filtered or unexported fields
}

BackupItemActionGRPCClient implements the backup/ItemAction interface and uses a gRPC client to make calls to the plugin server.

func (*BackupItemActionGRPCClient) AppliesTo

func (*BackupItemActionGRPCClient) Execute

type BackupItemActionGRPCServer

type BackupItemActionGRPCServer struct {
	// contains filtered or unexported fields
}

BackupItemActionGRPCServer implements the proto-generated BackupItemAction interface, and accepts gRPC calls and forwards them to an implementation of the pluggable interface.

func (*BackupItemActionGRPCServer) AppliesTo

func (*BackupItemActionGRPCServer) Execute

type BackupItemActionPlugin

type BackupItemActionPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	// contains filtered or unexported fields
}

BackupItemActionPlugin is an implementation of go-plugin's Plugin interface with support for gRPC for the backup/ItemAction interface.

func NewBackupItemActionPlugin

func NewBackupItemActionPlugin(options ...PluginOption) *BackupItemActionPlugin

NewBackupItemActionPlugin constructs a BackupItemActionPlugin.

func (*BackupItemActionPlugin) GRPCClient

func (p *BackupItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error)

GRPCClient returns a clientDispenser for BackupItemAction gRPC clients.

func (*BackupItemActionPlugin) GRPCServer

func (p *BackupItemActionPlugin) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error

GRPCServer registers a BackupItemAction gRPC server.

type ClientDispenser

type ClientDispenser interface {
	ClientFor(name string) interface{}
}

type CloseFunc

type CloseFunc func() error

CloseFunc is used to signal to the source of data that the StreamReadCloser has been closed.

type DeleteItemActionGRPCClient added in v1.5.0

type DeleteItemActionGRPCClient struct {
	// contains filtered or unexported fields
}

DeleteItemActionGRPCClient implements the backup/ItemAction interface and uses a gRPC client to make calls to the plugin server.

func (*DeleteItemActionGRPCClient) AppliesTo added in v1.5.0

func (*DeleteItemActionGRPCClient) Execute added in v1.5.0

type DeleteItemActionGRPCServer added in v1.5.0

type DeleteItemActionGRPCServer struct {
	// contains filtered or unexported fields
}

DeleteItemActionGRPCServer implements the proto-generated DeleteItemActionServer interface, and accepts gRPC calls and forwards them to an implementation of the pluggable interface.

func (*DeleteItemActionGRPCServer) AppliesTo added in v1.5.0

func (*DeleteItemActionGRPCServer) Execute added in v1.5.0

type DeleteItemActionPlugin added in v1.5.0

type DeleteItemActionPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	// contains filtered or unexported fields
}

RestoreItemActionPlugin is an implementation of go-plugin's Plugin interface with support for gRPC for the restore/ItemAction interface.

func NewDeleteItemActionPlugin added in v1.5.0

func NewDeleteItemActionPlugin(options ...PluginOption) *DeleteItemActionPlugin

NewDeleteItemActionPlugin constructs a DeleteItemActionPlugin.

func (*DeleteItemActionPlugin) GRPCClient added in v1.5.0

func (p *DeleteItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error)

GRPCClient returns a RestoreItemAction gRPC client.

func (*DeleteItemActionPlugin) GRPCServer added in v1.5.0

func (p *DeleteItemActionPlugin) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error

GRPCServer registers a DeleteItemAction gRPC server.

type HandlerInitializer

type HandlerInitializer func(logger logrus.FieldLogger) (interface{}, error)

HandlerInitializer is a function that initializes and returns a new instance of one of Velero's plugin interfaces (ObjectStore, VolumeSnapshotter, BackupItemAction, RestoreItemAction).

type Interface

type Interface interface {
	plugin.Plugin
	// contains filtered or unexported methods
}

Interface represents a Velero plugin.

type ObjectStoreGRPCClient

type ObjectStoreGRPCClient struct {
	// contains filtered or unexported fields
}

ObjectStoreGRPCClient implements the ObjectStore interface and uses a gRPC client to make calls to the plugin server.

func (*ObjectStoreGRPCClient) CreateSignedURL

func (c *ObjectStoreGRPCClient) CreateSignedURL(bucket, key string, ttl time.Duration) (string, error)

CreateSignedURL creates a pre-signed URL for the given bucket and key that expires after ttl.

func (*ObjectStoreGRPCClient) DeleteObject

func (c *ObjectStoreGRPCClient) DeleteObject(bucket, key string) error

DeleteObject removes object with the specified key from the given bucket.

func (*ObjectStoreGRPCClient) GetObject

func (c *ObjectStoreGRPCClient) GetObject(bucket, key string) (io.ReadCloser, error)

GetObject retrieves the object with the given key from the specified bucket in object storage.

func (*ObjectStoreGRPCClient) Init

func (c *ObjectStoreGRPCClient) Init(config map[string]string) error

Init prepares the ObjectStore for usage using the provided map of configuration key-value pairs. It returns an error if the ObjectStore cannot be initialized from the provided config.

func (*ObjectStoreGRPCClient) ListCommonPrefixes

func (c *ObjectStoreGRPCClient) ListCommonPrefixes(bucket, prefix, delimiter string) ([]string, error)

ListCommonPrefixes gets a list of all object key prefixes that come after the provided prefix and before the provided delimiter (this is often used to simulate a directory hierarchy in object storage).

func (*ObjectStoreGRPCClient) ListObjects

func (c *ObjectStoreGRPCClient) ListObjects(bucket, prefix string) ([]string, error)

ListObjects gets a list of all objects in bucket that have the same prefix.

func (*ObjectStoreGRPCClient) ObjectExists

func (c *ObjectStoreGRPCClient) ObjectExists(bucket, key string) (bool, error)

ObjectExists checks if there is an object with the given key in the object storage bucket.

func (*ObjectStoreGRPCClient) PutObject

func (c *ObjectStoreGRPCClient) PutObject(bucket, key string, body io.Reader) error

PutObject creates a new object using the data in body within the specified object storage bucket with the given key.

type ObjectStoreGRPCServer

type ObjectStoreGRPCServer struct {
	// contains filtered or unexported fields
}

ObjectStoreGRPCServer implements the proto-generated ObjectStoreServer interface, and accepts gRPC calls and forwards them to an implementation of the pluggable interface.

func (*ObjectStoreGRPCServer) CreateSignedURL

CreateSignedURL creates a pre-signed URL for the given bucket and key that expires after ttl.

func (*ObjectStoreGRPCServer) DeleteObject

func (s *ObjectStoreGRPCServer) DeleteObject(ctx context.Context, req *proto.DeleteObjectRequest) (response *proto.Empty, err error)

DeleteObject removes object with the specified key from the given bucket.

func (*ObjectStoreGRPCServer) GetObject

GetObject retrieves the object with the given key from the specified bucket in object storage.

func (*ObjectStoreGRPCServer) Init

func (s *ObjectStoreGRPCServer) Init(ctx context.Context, req *proto.ObjectStoreInitRequest) (response *proto.Empty, err error)

Init prepares the ObjectStore for usage using the provided map of configuration key-value pairs. It returns an error if the ObjectStore cannot be initialized from the provided config.

func (*ObjectStoreGRPCServer) ListCommonPrefixes

ListCommonPrefixes gets a list of all object key prefixes that start with the specified prefix and stop at the next instance of the provided delimiter (this is often used to simulate a directory hierarchy in object storage).

func (*ObjectStoreGRPCServer) ListObjects

func (s *ObjectStoreGRPCServer) ListObjects(ctx context.Context, req *proto.ListObjectsRequest) (response *proto.ListObjectsResponse, err error)

ListObjects gets a list of all objects in bucket that have the same prefix.

func (*ObjectStoreGRPCServer) ObjectExists

func (s *ObjectStoreGRPCServer) ObjectExists(ctx context.Context, req *proto.ObjectExistsRequest) (response *proto.ObjectExistsResponse, err error)

ObjectExists checks if there is an object with the given key in the object storage bucket.

func (*ObjectStoreGRPCServer) PutObject

func (s *ObjectStoreGRPCServer) PutObject(stream proto.ObjectStore_PutObjectServer) (err error)

PutObject creates a new object using the data in body within the specified object storage bucket with the given key.

type ObjectStorePlugin

type ObjectStorePlugin struct {
	plugin.NetRPCUnsupportedPlugin
	// contains filtered or unexported fields
}

ObjectStorePlugin is an implementation of go-plugin's Plugin interface with support for gRPC for the cloudprovider/ObjectStore interface.

func NewObjectStorePlugin

func NewObjectStorePlugin(options ...PluginOption) *ObjectStorePlugin

NewObjectStorePlugin construct an ObjectStorePlugin.

func (*ObjectStorePlugin) GRPCClient

func (p *ObjectStorePlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error)

GRPCClient returns an ObjectStore gRPC client.

func (*ObjectStorePlugin) GRPCServer

func (p *ObjectStorePlugin) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error

GRPCServer registers an ObjectStore gRPC server.

type PluginIdentifier

type PluginIdentifier struct {
	Command string
	Kind    PluginKind
	Name    string
}

PluginIdentifier uniquely identifies a plugin by command, kind, and name.

type PluginKind

type PluginKind string

PluginKind is a type alias for a string that describes the kind of a Velero-supported plugin.

const (
	// PluginKindObjectStore represents an object store plugin.
	PluginKindObjectStore PluginKind = "ObjectStore"

	// PluginKindVolumeSnapshotter represents a volume snapshotter plugin.
	PluginKindVolumeSnapshotter PluginKind = "VolumeSnapshotter"

	// PluginKindBackupItemAction represents a backup item action plugin.
	PluginKindBackupItemAction PluginKind = "BackupItemAction"

	// PluginKindRestoreItemAction represents a restore item action plugin.
	PluginKindRestoreItemAction PluginKind = "RestoreItemAction"

	// PluginKindDeleteItemAction represents a delete item action plugin.
	PluginKindDeleteItemAction PluginKind = "DeleteItemAction"

	// PluginKindPluginLister represents a plugin lister plugin.
	PluginKindPluginLister PluginKind = "PluginLister"
)

func (PluginKind) String

func (k PluginKind) String() string

String returns the string for k.

type PluginLister

type PluginLister interface {
	ListPlugins() ([]PluginIdentifier, error)
}

PluginLister lists plugins.

func NewPluginLister

func NewPluginLister(plugins ...PluginIdentifier) PluginLister

NewPluginLister returns a new PluginLister for plugins.

type PluginListerGRPCClient

type PluginListerGRPCClient struct {
	// contains filtered or unexported fields
}

PluginListerGRPCClient implements PluginLister and uses a gRPC client to make calls to the plugin server.

func (*PluginListerGRPCClient) ListPlugins

func (c *PluginListerGRPCClient) ListPlugins() ([]PluginIdentifier, error)

ListPlugins uses the gRPC client to request the list of plugins from the server. It translates the protobuf response to []PluginIdentifier.

type PluginListerGRPCServer

type PluginListerGRPCServer struct {
	// contains filtered or unexported fields
}

PluginListerGRPCServer implements the proto-generated PluginLister gRPC service interface. It accepts gRPC calls, forwards them to impl, and translates the responses to protobuf.

func (*PluginListerGRPCServer) ListPlugins

ListPlugins returns a list of registered plugins, delegating to s.impl to perform the listing.

type PluginListerPlugin

type PluginListerPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	// contains filtered or unexported fields
}

PluginListerPlugin is a go-plugin Plugin for a PluginLister.

func NewPluginListerPlugin

func NewPluginListerPlugin(impl PluginLister) *PluginListerPlugin

NewPluginListerPlugin creates a new PluginListerPlugin with impl as the server-side implementation.

func (*PluginListerPlugin) GRPCClient

func (p *PluginListerPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error)

GRPCClient returns a PluginLister gRPC client.

func (*PluginListerPlugin) GRPCServer

func (p *PluginListerPlugin) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error

GRPCServer registers a PluginLister gRPC server.

type PluginOption

type PluginOption func(base *pluginBase)

func ClientLogger

func ClientLogger(logger logrus.FieldLogger) PluginOption

type ReceiveFunc

type ReceiveFunc func() ([]byte, error)

ReceiveFunc is a function that either returns a slice of an arbitrary number of bytes OR an error. Returning an io.EOF means there is no more data to be read; any other error is considered an actual error.

type RestoreItemActionGRPCClient

type RestoreItemActionGRPCClient struct {
	// contains filtered or unexported fields
}

RestoreItemActionGRPCClient implements the backup/ItemAction interface and uses a gRPC client to make calls to the plugin server.

func (*RestoreItemActionGRPCClient) AppliesTo

func (*RestoreItemActionGRPCClient) Execute

type RestoreItemActionGRPCServer

type RestoreItemActionGRPCServer struct {
	// contains filtered or unexported fields
}

RestoreItemActionGRPCServer implements the proto-generated RestoreItemActionServer interface, and accepts gRPC calls and forwards them to an implementation of the pluggable interface.

func (*RestoreItemActionGRPCServer) AppliesTo

func (*RestoreItemActionGRPCServer) Execute

type RestoreItemActionPlugin

type RestoreItemActionPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	// contains filtered or unexported fields
}

RestoreItemActionPlugin is an implementation of go-plugin's Plugin interface with support for gRPC for the restore/ItemAction interface.

func NewRestoreItemActionPlugin

func NewRestoreItemActionPlugin(options ...PluginOption) *RestoreItemActionPlugin

NewRestoreItemActionPlugin constructs a RestoreItemActionPlugin.

func (*RestoreItemActionPlugin) GRPCClient

func (p *RestoreItemActionPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error)

GRPCClient returns a RestoreItemAction gRPC client.

func (*RestoreItemActionPlugin) GRPCServer

func (p *RestoreItemActionPlugin) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error

GRPCServer registers a RestoreItemAction gRPC server.

type Server

type Server interface {
	// BindFlags defines the plugin server's command-line flags
	// on the provided FlagSet. If you're not sure what flag set
	// to use, pflag.CommandLine is the default set of command-line
	// flags.
	//
	// This method must be called prior to calling .Serve().
	BindFlags(flags *pflag.FlagSet) Server

	// RegisterBackupItemAction registers a backup item action. Accepted format
	// for the plugin name is <DNS subdomain>/<non-empty name>.
	RegisterBackupItemAction(pluginName string, initializer HandlerInitializer) Server

	// RegisterBackupItemActions registers multiple backup item actions.
	RegisterBackupItemActions(map[string]HandlerInitializer) Server

	// RegisterVolumeSnapshotter registers a volume snapshotter. Accepted format
	// for the plugin name is <DNS subdomain>/<non-empty name>.
	RegisterVolumeSnapshotter(pluginName string, initializer HandlerInitializer) Server

	// RegisterVolumeSnapshotters registers multiple volume snapshotters.
	RegisterVolumeSnapshotters(map[string]HandlerInitializer) Server

	// RegisterObjectStore registers an object store. Accepted format
	// for the plugin name is <DNS subdomain>/<non-empty name>.
	RegisterObjectStore(pluginName string, initializer HandlerInitializer) Server

	// RegisterObjectStores registers multiple object stores.
	RegisterObjectStores(map[string]HandlerInitializer) Server

	// RegisterRestoreItemAction registers a restore item action. Accepted format
	// for the plugin name is <DNS subdomain>/<non-empty name>.
	RegisterRestoreItemAction(pluginName string, initializer HandlerInitializer) Server

	// RegisterRestoreItemActions registers multiple restore item actions.
	RegisterRestoreItemActions(map[string]HandlerInitializer) Server

	// RegisterDeleteItemAction registers a delete item action. Accepted format
	// for the plugin name is <DNS subdomain>/<non-empty name>.
	RegisterDeleteItemAction(pluginName string, initializer HandlerInitializer) Server

	// RegisterDeleteItemActions registers multiple Delete item actions.
	RegisterDeleteItemActions(map[string]HandlerInitializer) Server

	// Server runs the plugin server.
	Serve()
}

Server serves registered plugin implementations.

func NewServer

func NewServer() Server

NewServer returns a new Server

Example (VolumeSnapshotter)
package main

import (
	"github.com/sirupsen/logrus"
	"k8s.io/apimachinery/pkg/runtime"

	"github.com/vmware-tanzu/velero/pkg/plugin/velero"
)

func main() {
	NewServer(). // call the server
			RegisterVolumeSnapshotter("example.io/volumesnapshotter", newVolumeSnapshotter). // register the plugin with a valid name
			RegisterDeleteItemAction("example.io/delete-item-action", newDeleteItemAction).
			Serve() // serve the plugin
}

func newVolumeSnapshotter(logger logrus.FieldLogger) (interface{}, error) {
	return &VolumeSnapshotter{FieldLogger: logger}, nil
}

type VolumeSnapshotter struct {
	FieldLogger logrus.FieldLogger
}

// Implement all methods for the VolumeSnapshotter interface...
func (b *VolumeSnapshotter) Init(config map[string]string) error {
	b.FieldLogger.Infof("VolumeSnapshotter.Init called")

	// ...

	return nil
}

func (b *VolumeSnapshotter) CreateVolumeFromSnapshot(snapshotID, volumeType, volumeAZ string, iops *int64) (volumeID string, err error) {
	b.FieldLogger.Infof("CreateVolumeFromSnapshot called")

	// ...

	return "volumeID", nil
}

func (b *VolumeSnapshotter) GetVolumeID(pv runtime.Unstructured) (string, error) {
	b.FieldLogger.Infof("GetVolumeID called")

	// ...

	return "volumeID", nil
}

func (b *VolumeSnapshotter) SetVolumeID(pv runtime.Unstructured, volumeID string) (runtime.Unstructured, error) {
	b.FieldLogger.Infof("SetVolumeID called")

	// ...

	return nil, nil
}

func (b *VolumeSnapshotter) GetVolumeInfo(volumeID, volumeAZ string) (string, *int64, error) {
	b.FieldLogger.Infof("GetVolumeInfo called")

	// ...

	return "volumeFilesystemType", nil, nil
}

func (b *VolumeSnapshotter) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (snapshotID string, err error) {
	b.FieldLogger.Infof("CreateSnapshot called")

	// ...

	return "snapshotID", nil
}

func (b *VolumeSnapshotter) DeleteSnapshot(snapshotID string) error {
	b.FieldLogger.Infof("DeleteSnapshot called")

	// ...

	return nil
}

// Implement all methods for the DeleteItemAction interface

func newDeleteItemAction(logger logrus.FieldLogger) (interface{}, error) {
	return DeleteItemAction{FieldLogger: logger}, nil
}

type DeleteItemAction struct {
	FieldLogger logrus.FieldLogger
}

func (d *DeleteItemAction) AppliesTo() (velero.ResourceSelector, error) {
	d.FieldLogger.Infof("AppliesTo called")

	// ...

	return velero.ResourceSelector{}, nil
}

func (d *DeleteItemAction) Execute(input *velero.DeleteItemActionExecuteInput) error {
	d.FieldLogger.Infof("Execute called")

	// ...

	return nil
}
Output:

type StreamReadCloser

type StreamReadCloser struct {
	// contains filtered or unexported fields
}

StreamReadCloser wraps a ReceiveFunc and a CloseSendFunc to implement io.ReadCloser.

func (*StreamReadCloser) Close

func (s *StreamReadCloser) Close() error

func (*StreamReadCloser) Read

func (s *StreamReadCloser) Read(p []byte) (n int, err error)

type VolumeSnapshotterGRPCClient

type VolumeSnapshotterGRPCClient struct {
	// contains filtered or unexported fields
}

VolumeSnapshotterGRPCClient implements the cloudprovider.VolumeSnapshotter interface and uses a gRPC client to make calls to the plugin server.

func (*VolumeSnapshotterGRPCClient) CreateSnapshot

func (c *VolumeSnapshotterGRPCClient) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (string, error)

CreateSnapshot creates a snapshot of the specified block volume, and applies the provided set of tags to the snapshot.

func (*VolumeSnapshotterGRPCClient) CreateVolumeFromSnapshot

func (c *VolumeSnapshotterGRPCClient) CreateVolumeFromSnapshot(snapshotID, volumeType, volumeAZ string, iops *int64) (string, error)

CreateVolumeFromSnapshot creates a new block volume, initialized from the provided snapshot, and with the specified type and IOPS (if using provisioned IOPS).

func (*VolumeSnapshotterGRPCClient) DeleteSnapshot

func (c *VolumeSnapshotterGRPCClient) DeleteSnapshot(snapshotID string) error

DeleteSnapshot deletes the specified volume snapshot.

func (*VolumeSnapshotterGRPCClient) GetVolumeID

func (*VolumeSnapshotterGRPCClient) GetVolumeInfo

func (c *VolumeSnapshotterGRPCClient) GetVolumeInfo(volumeID, volumeAZ string) (string, *int64, error)

GetVolumeInfo returns the type and IOPS (if using provisioned IOPS) for a specified block volume.

func (*VolumeSnapshotterGRPCClient) Init

func (c *VolumeSnapshotterGRPCClient) Init(config map[string]string) error

Init prepares the VolumeSnapshotter for usage using the provided map of configuration key-value pairs. It returns an error if the VolumeSnapshotter cannot be initialized from the provided config.

func (*VolumeSnapshotterGRPCClient) SetVolumeID

type VolumeSnapshotterGRPCServer

type VolumeSnapshotterGRPCServer struct {
	// contains filtered or unexported fields
}

VolumeSnapshotterGRPCServer implements the proto-generated VolumeSnapshotterServer interface, and accepts gRPC calls and forwards them to an implementation of the pluggable interface.

func (*VolumeSnapshotterGRPCServer) CreateSnapshot

CreateSnapshot creates a snapshot of the specified block volume, and applies the provided set of tags to the snapshot.

func (*VolumeSnapshotterGRPCServer) CreateVolumeFromSnapshot

func (s *VolumeSnapshotterGRPCServer) CreateVolumeFromSnapshot(ctx context.Context, req *proto.CreateVolumeRequest) (response *proto.CreateVolumeResponse, err error)

CreateVolumeFromSnapshot creates a new block volume, initialized from the provided snapshot, and with the specified type and IOPS (if using provisioned IOPS).

func (*VolumeSnapshotterGRPCServer) DeleteSnapshot

func (s *VolumeSnapshotterGRPCServer) DeleteSnapshot(ctx context.Context, req *proto.DeleteSnapshotRequest) (response *proto.Empty, err error)

DeleteSnapshot deletes the specified volume snapshot.

func (*VolumeSnapshotterGRPCServer) GetVolumeID

func (*VolumeSnapshotterGRPCServer) GetVolumeInfo

GetVolumeInfo returns the type and IOPS (if using provisioned IOPS) for a specified block volume.

func (*VolumeSnapshotterGRPCServer) Init

Init prepares the VolumeSnapshotter for usage using the provided map of configuration key-value pairs. It returns an error if the VolumeSnapshotter cannot be initialized from the provided config.

func (*VolumeSnapshotterGRPCServer) SetVolumeID

type VolumeSnapshotterPlugin

type VolumeSnapshotterPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	// contains filtered or unexported fields
}

VolumeSnapshotterPlugin is an implementation of go-plugin's Plugin interface with support for gRPC for the cloudprovider/VolumeSnapshotter interface.

func NewVolumeSnapshotterPlugin

func NewVolumeSnapshotterPlugin(options ...PluginOption) *VolumeSnapshotterPlugin

NewVolumeSnapshotterPlugin constructs a VolumeSnapshotterPlugin.

func (*VolumeSnapshotterPlugin) GRPCClient

func (p *VolumeSnapshotterPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error)

GRPCClient returns a VolumeSnapshotter gRPC client.

func (*VolumeSnapshotterPlugin) GRPCServer

func (p *VolumeSnapshotterPlugin) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error

GRPCServer registers a VolumeSnapshotter gRPC server.

Jump to

Keyboard shortcuts

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