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 ¶
- func AllPluginKinds() map[string]PluginKind
- func Handshake() plugin.HandshakeConfig
- func ValidatePluginName(name string, existingNames []string) error
- type BackupItemActionGRPCClient
- type BackupItemActionGRPCServer
- func (s *BackupItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.BackupItemActionAppliesToRequest) (response *proto.BackupItemActionAppliesToResponse, err error)
- func (s *BackupItemActionGRPCServer) Execute(ctx context.Context, req *proto.ExecuteRequest) (response *proto.ExecuteResponse, err error)
- type BackupItemActionPlugin
- type ClientDispenser
- type CloseFunc
- type HandlerInitializer
- type Interface
- type ObjectStoreGRPCClient
- func (c *ObjectStoreGRPCClient) CreateSignedURL(bucket, key string, ttl time.Duration) (string, error)
- func (c *ObjectStoreGRPCClient) DeleteObject(bucket, key string) error
- func (c *ObjectStoreGRPCClient) GetObject(bucket, key string) (io.ReadCloser, error)
- func (c *ObjectStoreGRPCClient) Init(config map[string]string) error
- func (c *ObjectStoreGRPCClient) ListCommonPrefixes(bucket, prefix, delimiter string) ([]string, error)
- func (c *ObjectStoreGRPCClient) ListObjects(bucket, prefix string) ([]string, error)
- func (c *ObjectStoreGRPCClient) ObjectExists(bucket, key string) (bool, error)
- func (c *ObjectStoreGRPCClient) PutObject(bucket, key string, body io.Reader) error
- type ObjectStoreGRPCServer
- func (s *ObjectStoreGRPCServer) CreateSignedURL(ctx context.Context, req *proto.CreateSignedURLRequest) (response *proto.CreateSignedURLResponse, err error)
- func (s *ObjectStoreGRPCServer) DeleteObject(ctx context.Context, req *proto.DeleteObjectRequest) (response *proto.Empty, err error)
- func (s *ObjectStoreGRPCServer) GetObject(req *proto.GetObjectRequest, stream proto.ObjectStore_GetObjectServer) (err error)
- func (s *ObjectStoreGRPCServer) Init(ctx context.Context, req *proto.ObjectStoreInitRequest) (response *proto.Empty, err error)
- func (s *ObjectStoreGRPCServer) ListCommonPrefixes(ctx context.Context, req *proto.ListCommonPrefixesRequest) (response *proto.ListCommonPrefixesResponse, err error)
- func (s *ObjectStoreGRPCServer) ListObjects(ctx context.Context, req *proto.ListObjectsRequest) (response *proto.ListObjectsResponse, err error)
- func (s *ObjectStoreGRPCServer) ObjectExists(ctx context.Context, req *proto.ObjectExistsRequest) (response *proto.ObjectExistsResponse, err error)
- func (s *ObjectStoreGRPCServer) PutObject(stream proto.ObjectStore_PutObjectServer) (err error)
- type ObjectStorePlugin
- type PluginIdentifier
- type PluginKind
- type PluginLister
- type PluginListerGRPCClient
- type PluginListerGRPCServer
- type PluginListerPlugin
- type PluginOption
- type ReceiveFunc
- type RestoreItemActionGRPCClient
- type RestoreItemActionGRPCServer
- func (s *RestoreItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.RestoreItemActionAppliesToRequest) (response *proto.RestoreItemActionAppliesToResponse, err error)
- func (s *RestoreItemActionGRPCServer) Execute(ctx context.Context, req *proto.RestoreItemActionExecuteRequest) (response *proto.RestoreItemActionExecuteResponse, err error)
- type RestoreItemActionPlugin
- type Server
- type StreamReadCloser
- type VolumeSnapshotterGRPCClient
- func (c *VolumeSnapshotterGRPCClient) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (string, error)
- func (c *VolumeSnapshotterGRPCClient) CreateVolumeFromSnapshot(snapshotID, volumeType, volumeAZ string, iops *int64) (string, error)
- func (c *VolumeSnapshotterGRPCClient) DeleteSnapshot(snapshotID string) error
- func (c *VolumeSnapshotterGRPCClient) GetVolumeID(pv runtime.Unstructured) (string, error)
- func (c *VolumeSnapshotterGRPCClient) GetVolumeInfo(volumeID, volumeAZ string) (string, *int64, error)
- func (c *VolumeSnapshotterGRPCClient) Init(config map[string]string) error
- func (c *VolumeSnapshotterGRPCClient) SetVolumeID(pv runtime.Unstructured, volumeID string) (runtime.Unstructured, error)
- type VolumeSnapshotterGRPCServer
- func (s *VolumeSnapshotterGRPCServer) CreateSnapshot(ctx context.Context, req *proto.CreateSnapshotRequest) (response *proto.CreateSnapshotResponse, err error)
- func (s *VolumeSnapshotterGRPCServer) CreateVolumeFromSnapshot(ctx context.Context, req *proto.CreateVolumeRequest) (response *proto.CreateVolumeResponse, err error)
- func (s *VolumeSnapshotterGRPCServer) DeleteSnapshot(ctx context.Context, req *proto.DeleteSnapshotRequest) (response *proto.Empty, err error)
- func (s *VolumeSnapshotterGRPCServer) GetVolumeID(ctx context.Context, req *proto.GetVolumeIDRequest) (response *proto.GetVolumeIDResponse, err error)
- func (s *VolumeSnapshotterGRPCServer) GetVolumeInfo(ctx context.Context, req *proto.GetVolumeInfoRequest) (response *proto.GetVolumeInfoResponse, err error)
- func (s *VolumeSnapshotterGRPCServer) Init(ctx context.Context, req *proto.VolumeSnapshotterInitRequest) (response *proto.Empty, err error)
- func (s *VolumeSnapshotterGRPCServer) SetVolumeID(ctx context.Context, req *proto.SetVolumeIDRequest) (response *proto.SetVolumeIDResponse, err error)
- type VolumeSnapshotterPlugin
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 ValidatePluginName ¶
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)
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 (c *BackupItemActionGRPCClient) AppliesTo() (velero.ResourceSelector, error)
func (*BackupItemActionGRPCClient) Execute ¶
func (c *BackupItemActionGRPCClient) Execute(item runtime.Unstructured, backup *api.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error)
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 (s *BackupItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.BackupItemActionAppliesToRequest) (response *proto.BackupItemActionAppliesToResponse, err error)
func (*BackupItemActionGRPCServer) Execute ¶
func (s *BackupItemActionGRPCServer) Execute(ctx context.Context, req *proto.ExecuteRequest) (response *proto.ExecuteResponse, err error)
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 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 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.
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 ¶
func (s *ObjectStoreGRPCServer) CreateSignedURL(ctx context.Context, req *proto.CreateSignedURLRequest) (response *proto.CreateSignedURLResponse, err error)
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 ¶
func (s *ObjectStoreGRPCServer) GetObject(req *proto.GetObjectRequest, stream proto.ObjectStore_GetObjectServer) (err error)
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 ¶
func (s *ObjectStoreGRPCServer) ListCommonPrefixes(ctx context.Context, req *proto.ListCommonPrefixesRequest) (response *proto.ListCommonPrefixesResponse, err error)
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" // PluginKindPluginLister represents a plugin lister plugin. PluginKindPluginLister PluginKind = "PluginLister" )
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 ¶
func (s *PluginListerGRPCServer) ListPlugins(ctx context.Context, req *proto.Empty) (*proto.ListPluginsResponse, error)
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 ¶
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 (c *RestoreItemActionGRPCClient) AppliesTo() (velero.ResourceSelector, error)
func (*RestoreItemActionGRPCClient) Execute ¶
func (c *RestoreItemActionGRPCClient) Execute(input *velero.RestoreItemActionExecuteInput) (*velero.RestoreItemActionExecuteOutput, error)
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 (s *RestoreItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.RestoreItemActionAppliesToRequest) (response *proto.RestoreItemActionAppliesToResponse, err error)
func (*RestoreItemActionGRPCServer) Execute ¶
func (s *RestoreItemActionGRPCServer) Execute(ctx context.Context, req *proto.RestoreItemActionExecuteRequest) (response *proto.RestoreItemActionExecuteResponse, err error)
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 // 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" ) func main() { NewServer(). // call the server RegisterVolumeSnapshotter("example.io/volumesnapshotter", newVolumeSnapshotter). // register the plugin with a valid name 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 }
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
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 (c *VolumeSnapshotterGRPCClient) GetVolumeID(pv runtime.Unstructured) (string, error)
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 ¶
func (c *VolumeSnapshotterGRPCClient) SetVolumeID(pv runtime.Unstructured, volumeID string) (runtime.Unstructured, error)
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 ¶
func (s *VolumeSnapshotterGRPCServer) CreateSnapshot(ctx context.Context, req *proto.CreateSnapshotRequest) (response *proto.CreateSnapshotResponse, err error)
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 (s *VolumeSnapshotterGRPCServer) GetVolumeID(ctx context.Context, req *proto.GetVolumeIDRequest) (response *proto.GetVolumeIDResponse, err error)
func (*VolumeSnapshotterGRPCServer) GetVolumeInfo ¶
func (s *VolumeSnapshotterGRPCServer) GetVolumeInfo(ctx context.Context, req *proto.GetVolumeInfoRequest) (response *proto.GetVolumeInfoResponse, err error)
GetVolumeInfo returns the type and IOPS (if using provisioned IOPS) for a specified block volume.
func (*VolumeSnapshotterGRPCServer) Init ¶
func (s *VolumeSnapshotterGRPCServer) Init(ctx context.Context, req *proto.VolumeSnapshotterInitRequest) (response *proto.Empty, err 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 (*VolumeSnapshotterGRPCServer) SetVolumeID ¶
func (s *VolumeSnapshotterGRPCServer) SetVolumeID(ctx context.Context, req *proto.SetVolumeIDRequest) (response *proto.SetVolumeIDResponse, err error)
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.
Source Files ¶
- backup_item_action.go
- backup_item_action_client.go
- backup_item_action_server.go
- client_dispenser.go
- client_errors.go
- doc.go
- handle_panic.go
- handshake.go
- interface.go
- logger.go
- object_store.go
- object_store_client.go
- object_store_server.go
- plugin_base.go
- plugin_kinds.go
- plugin_lister.go
- restore_item_action.go
- restore_item_action_client.go
- restore_item_action_server.go
- server.go
- server_errors.go
- server_mux.go
- stream_reader.go
- volume_snapshotter.go
- volume_snapshotter_client.go
- volume_snapshotter_server.go