Added ItemSnapshotter.proto Added item_snapshotter Go interface Added framework components for item_snapshotter Updated plugins doc with ItemSnapshotter info Added SnapshotPhase to item_snapshotter.go ProgressOutputOutput now includes a phase as well as an error string for problems that occured Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>pull/4372/head
parent
0a19b394e2
commit
5150ce4891
|
@ -0,0 +1,2 @@
|
|||
Added ItemSnapshotter plugin definition and plugin framework - addresses #3533.
|
||||
Part of the Upload Progress enhancement (#3533)
|
|
@ -73,6 +73,7 @@ func (b *clientBuilder) clientConfig() *hcplugin.ClientConfig {
|
|||
string(framework.PluginKindPluginLister): &framework.PluginListerPlugin{},
|
||||
string(framework.PluginKindRestoreItemAction): framework.NewRestoreItemActionPlugin(framework.ClientLogger(b.clientLogger)),
|
||||
string(framework.PluginKindDeleteItemAction): framework.NewDeleteItemActionPlugin(framework.ClientLogger(b.clientLogger)),
|
||||
string(framework.PluginKindItemSnapshotter): framework.NewItemSnapshotterPlugin(framework.ClientLogger(b.clientLogger)),
|
||||
},
|
||||
Logger: b.pluginLogger,
|
||||
Cmd: exec.Command(b.commandName, b.commandArgs...),
|
||||
|
|
|
@ -66,6 +66,7 @@ func TestClientConfig(t *testing.T) {
|
|||
string(framework.PluginKindPluginLister): &framework.PluginListerPlugin{},
|
||||
string(framework.PluginKindRestoreItemAction): framework.NewRestoreItemActionPlugin(framework.ClientLogger(logger)),
|
||||
string(framework.PluginKindDeleteItemAction): framework.NewDeleteItemActionPlugin(framework.ClientLogger(logger)),
|
||||
string(framework.PluginKindItemSnapshotter): framework.NewItemSnapshotterPlugin(framework.ClientLogger(logger)),
|
||||
},
|
||||
Logger: cb.pluginLogger,
|
||||
Cmd: exec.Command(cb.commandName, cb.commandArgs...),
|
||||
|
|
|
@ -20,6 +20,8 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
v1 "github.com/vmware-tanzu/velero/pkg/plugin/velero/item_snapshotter/v1"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/framework"
|
||||
|
@ -52,6 +54,12 @@ type Manager interface {
|
|||
// GetDeleteItemAction returns the delete item action plugin for name.
|
||||
GetDeleteItemAction(name string) (velero.DeleteItemAction, error)
|
||||
|
||||
// GetItemSnapshotter returns the item snapshotter plugin for name
|
||||
GetItemSnapshotter(name string) (v1.ItemSnapshotter, error)
|
||||
|
||||
// GetItemSnapshotters returns all item snapshotter plugins
|
||||
GetItemSnapshotters() ([]v1.ItemSnapshotter, error)
|
||||
|
||||
// CleanupClients terminates all of the Manager's running plugin processes.
|
||||
CleanupClients()
|
||||
}
|
||||
|
@ -256,6 +264,37 @@ func (m *manager) GetDeleteItemAction(name string) (velero.DeleteItemAction, err
|
|||
return r, nil
|
||||
}
|
||||
|
||||
func (m *manager) GetItemSnapshotter(name string) (v1.ItemSnapshotter, error) {
|
||||
name = sanitizeName(name)
|
||||
|
||||
restartableProcess, err := m.getRestartableProcess(framework.PluginKindItemSnapshotter, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
r := newRestartableItemSnapshotter(name, restartableProcess)
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (m *manager) GetItemSnapshotters() ([]v1.ItemSnapshotter, error) {
|
||||
list := m.registry.List(framework.PluginKindItemSnapshotter)
|
||||
|
||||
actions := make([]v1.ItemSnapshotter, 0, len(list))
|
||||
|
||||
for i := range list {
|
||||
id := list[i]
|
||||
|
||||
r, err := m.GetItemSnapshotter(id.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
actions = append(actions, r)
|
||||
}
|
||||
|
||||
return actions, nil
|
||||
}
|
||||
|
||||
// sanitizeName adds "velero.io" to legacy plugins that weren't namespaced.
|
||||
func sanitizeName(name string) string {
|
||||
// Backwards compatibility with non-namespaced Velero plugins, following principle of least surprise
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package clientmgmt
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
isv1 "github.com/vmware-tanzu/velero/pkg/plugin/velero/item_snapshotter/v1"
|
||||
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/framework"
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
|
||||
)
|
||||
|
||||
type restartableItemSnapshotter struct {
|
||||
key kindAndName
|
||||
sharedPluginProcess RestartableProcess
|
||||
}
|
||||
|
||||
// newRestartableItemSnapshotter returns a new newRestartableItemSnapshotter.
|
||||
func newRestartableItemSnapshotter(name string, sharedPluginProcess RestartableProcess) *restartableItemSnapshotter {
|
||||
r := &restartableItemSnapshotter{
|
||||
key: kindAndName{kind: framework.PluginKindItemSnapshotter, name: name},
|
||||
sharedPluginProcess: sharedPluginProcess,
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// getItemSnapshotter returns the item snapshotter for this restartableItemSnapshotter. It does *not* restart the
|
||||
// plugin process.
|
||||
func (r *restartableItemSnapshotter) getItemSnapshotter() (isv1.ItemSnapshotter, error) {
|
||||
plugin, err := r.sharedPluginProcess.getByKindAndName(r.key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
itemSnapshotter, ok := plugin.(isv1.ItemSnapshotter)
|
||||
if !ok {
|
||||
return nil, errors.Errorf("%T is not an ItemSnapshotter!", plugin)
|
||||
}
|
||||
|
||||
return itemSnapshotter, nil
|
||||
}
|
||||
|
||||
// getDelegate restarts the plugin process (if needed) and returns the item snapshotter for this restartableItemSnapshotter.
|
||||
func (r *restartableItemSnapshotter) getDelegate() (isv1.ItemSnapshotter, error) {
|
||||
if err := r.sharedPluginProcess.resetIfNeeded(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return r.getItemSnapshotter()
|
||||
}
|
||||
|
||||
func (r *restartableItemSnapshotter) Init(config map[string]string) error {
|
||||
delegate, err := r.getDelegate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return delegate.Init(config)
|
||||
}
|
||||
|
||||
// AppliesTo restarts the plugin's process if needed, then delegates the call.
|
||||
func (r *restartableItemSnapshotter) AppliesTo() (velero.ResourceSelector, error) {
|
||||
delegate, err := r.getDelegate()
|
||||
if err != nil {
|
||||
return velero.ResourceSelector{}, err
|
||||
}
|
||||
|
||||
return delegate.AppliesTo()
|
||||
}
|
||||
|
||||
func (r *restartableItemSnapshotter) AlsoHandles(input *isv1.AlsoHandlesInput) ([]velero.ResourceIdentifier, error) {
|
||||
delegate, err := r.getDelegate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return delegate.AlsoHandles(input)
|
||||
}
|
||||
|
||||
func (r *restartableItemSnapshotter) SnapshotItem(ctx context.Context, input *isv1.SnapshotItemInput) (*isv1.SnapshotItemOutput, error) {
|
||||
delegate, err := r.getDelegate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return delegate.SnapshotItem(ctx, input)
|
||||
}
|
||||
|
||||
func (r *restartableItemSnapshotter) Progress(input *isv1.ProgressInput) (*isv1.ProgressOutput, error) {
|
||||
delegate, err := r.getDelegate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return delegate.Progress(input)
|
||||
}
|
||||
|
||||
func (r *restartableItemSnapshotter) DeleteSnapshot(ctx context.Context, input *isv1.DeleteSnapshotInput) error {
|
||||
delegate, err := r.getDelegate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return delegate.DeleteSnapshot(ctx, input)
|
||||
}
|
||||
|
||||
func (r *restartableItemSnapshotter) CreateItemFromSnapshot(ctx context.Context, input *isv1.CreateItemInput) (*isv1.CreateItemOutput, error) {
|
||||
delegate, err := r.getDelegate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return delegate.CreateItemFromSnapshot(ctx, input)
|
||||
}
|
|
@ -0,0 +1,233 @@
|
|||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package clientmgmt
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
isv1 "github.com/vmware-tanzu/velero/pkg/plugin/velero/item_snapshotter/v1"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
v1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/velero/item_snapshotter/v1/mocks"
|
||||
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/framework"
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
|
||||
)
|
||||
|
||||
func TestRestartableGetItemSnapshotter(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
plugin interface{}
|
||||
getError error
|
||||
expectedError string
|
||||
}{
|
||||
{
|
||||
name: "error getting by kind and name",
|
||||
getError: errors.Errorf("get error"),
|
||||
expectedError: "get error",
|
||||
},
|
||||
{
|
||||
name: "wrong type",
|
||||
plugin: 3,
|
||||
expectedError: "int is not an ItemSnapshotter!",
|
||||
},
|
||||
{
|
||||
name: "happy path",
|
||||
plugin: new(mocks.ItemSnapshotter),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
p := new(mockRestartableProcess)
|
||||
defer p.AssertExpectations(t)
|
||||
|
||||
name := "pvc"
|
||||
key := kindAndName{kind: framework.PluginKindItemSnapshotter, name: name}
|
||||
p.On("getByKindAndName", key).Return(tc.plugin, tc.getError)
|
||||
|
||||
r := newRestartableItemSnapshotter(name, p)
|
||||
a, err := r.getItemSnapshotter()
|
||||
if tc.expectedError != "" {
|
||||
assert.EqualError(t, err, tc.expectedError)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, tc.plugin, a)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRestartableItemSnapshotterGetDelegate(t *testing.T) {
|
||||
p := new(mockRestartableProcess)
|
||||
defer p.AssertExpectations(t)
|
||||
|
||||
// Reset error
|
||||
p.On("resetIfNeeded").Return(errors.Errorf("reset error")).Once()
|
||||
name := "pvc"
|
||||
r := newRestartableItemSnapshotter(name, p)
|
||||
a, err := r.getDelegate()
|
||||
assert.Nil(t, a)
|
||||
assert.EqualError(t, err, "reset error")
|
||||
|
||||
// Happy path
|
||||
p.On("resetIfNeeded").Return(nil)
|
||||
expected := new(mocks.ItemSnapshotter)
|
||||
key := kindAndName{kind: framework.PluginKindItemSnapshotter, name: name}
|
||||
p.On("getByKindAndName", key).Return(expected, nil)
|
||||
|
||||
a, err = r.getDelegate()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expected, a)
|
||||
}
|
||||
|
||||
func TestRestartableItemSnasphotterDelegatedFunctions(t *testing.T) {
|
||||
b := new(v1.Backup)
|
||||
|
||||
pv := &unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
"color": "blue",
|
||||
},
|
||||
}
|
||||
|
||||
sii := &isv1.SnapshotItemInput{
|
||||
Item: pv,
|
||||
Params: nil,
|
||||
Backup: b,
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
pvToReturn := &unstructured.Unstructured{
|
||||
Object: map[string]interface{}{
|
||||
"color": "green",
|
||||
},
|
||||
}
|
||||
|
||||
additionalItems := []velero.ResourceIdentifier{
|
||||
{
|
||||
GroupResource: schema.GroupResource{Group: "velero.io", Resource: "backups"},
|
||||
},
|
||||
}
|
||||
|
||||
sio := &isv1.SnapshotItemOutput{
|
||||
UpdatedItem: pvToReturn,
|
||||
SnapshotID: "",
|
||||
SnapshotMetadata: nil,
|
||||
AdditionalItems: additionalItems,
|
||||
HandledItems: nil,
|
||||
}
|
||||
|
||||
cii := &isv1.CreateItemInput{
|
||||
SnapshottedItem: nil,
|
||||
SnapshotID: "",
|
||||
ItemFromBackup: nil,
|
||||
SnapshotMetadata: nil,
|
||||
Params: nil,
|
||||
Restore: nil,
|
||||
}
|
||||
|
||||
cio := &isv1.CreateItemOutput{
|
||||
UpdatedItem: nil,
|
||||
AdditionalItems: nil,
|
||||
SkipRestore: false,
|
||||
}
|
||||
|
||||
pi := &isv1.ProgressInput{
|
||||
ItemID: velero.ResourceIdentifier{},
|
||||
SnapshotID: "",
|
||||
Backup: nil,
|
||||
}
|
||||
po := &isv1.ProgressOutput{
|
||||
Phase: isv1.SnapshotPhaseInProgress,
|
||||
Err: "",
|
||||
ItemsCompleted: 0,
|
||||
ItemsToComplete: 0,
|
||||
Started: time.Time{},
|
||||
Updated: time.Time{},
|
||||
}
|
||||
dsi := &isv1.DeleteSnapshotInput{
|
||||
SnapshotID: "",
|
||||
ItemFromBackup: nil,
|
||||
SnapshotMetadata: nil,
|
||||
Params: nil,
|
||||
}
|
||||
runRestartableDelegateTests(
|
||||
t,
|
||||
framework.PluginKindItemSnapshotter,
|
||||
func(key kindAndName, p RestartableProcess) interface{} {
|
||||
return &restartableItemSnapshotter{
|
||||
key: key,
|
||||
sharedPluginProcess: p,
|
||||
}
|
||||
},
|
||||
func() mockable {
|
||||
return new(mocks.ItemSnapshotter)
|
||||
},
|
||||
restartableDelegateTest{
|
||||
function: "Init",
|
||||
inputs: []interface{}{map[string]string{}},
|
||||
expectedErrorOutputs: []interface{}{errors.Errorf("reset error")},
|
||||
expectedDelegateOutputs: []interface{}{errors.Errorf("delegate error")},
|
||||
},
|
||||
restartableDelegateTest{
|
||||
function: "AppliesTo",
|
||||
inputs: []interface{}{},
|
||||
expectedErrorOutputs: []interface{}{velero.ResourceSelector{}, errors.Errorf("reset error")},
|
||||
expectedDelegateOutputs: []interface{}{velero.ResourceSelector{IncludedNamespaces: []string{"a"}}, errors.Errorf("delegate error")},
|
||||
},
|
||||
restartableDelegateTest{
|
||||
function: "AlsoHandles",
|
||||
inputs: []interface{}{&isv1.AlsoHandlesInput{}},
|
||||
expectedErrorOutputs: []interface{}{[]velero.ResourceIdentifier([]velero.ResourceIdentifier(nil)), errors.Errorf("reset error")},
|
||||
expectedDelegateOutputs: []interface{}{[]velero.ResourceIdentifier([]velero.ResourceIdentifier(nil)), errors.Errorf("delegate error")},
|
||||
},
|
||||
restartableDelegateTest{
|
||||
function: "SnapshotItem",
|
||||
inputs: []interface{}{ctx, sii},
|
||||
expectedErrorOutputs: []interface{}{nil, errors.Errorf("reset error")},
|
||||
expectedDelegateOutputs: []interface{}{sio, errors.Errorf("delegate error")},
|
||||
},
|
||||
restartableDelegateTest{
|
||||
function: "CreateItemFromSnapshot",
|
||||
inputs: []interface{}{ctx, cii},
|
||||
expectedErrorOutputs: []interface{}{nil, errors.Errorf("reset error")},
|
||||
expectedDelegateOutputs: []interface{}{cio, errors.Errorf("delegate error")},
|
||||
},
|
||||
restartableDelegateTest{
|
||||
function: "Progress",
|
||||
inputs: []interface{}{pi},
|
||||
expectedErrorOutputs: []interface{}{nil, errors.Errorf("reset error")},
|
||||
expectedDelegateOutputs: []interface{}{po, errors.Errorf("delegate error")},
|
||||
},
|
||||
restartableDelegateTest{
|
||||
function: "DeleteSnapshot",
|
||||
inputs: []interface{}{ctx, dsi},
|
||||
expectedErrorOutputs: []interface{}{errors.Errorf("reset error")},
|
||||
expectedDelegateOutputs: []interface{}{errors.Errorf("delegate error")},
|
||||
},
|
||||
)
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package framework
|
||||
|
||||
import (
|
||||
plugin "github.com/hashicorp/go-plugin"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
proto "github.com/vmware-tanzu/velero/pkg/plugin/generated"
|
||||
)
|
||||
|
||||
// ItemSnapshotterPlugin is an implementation of go-plugin's Plugin
|
||||
// interface with support for gRPC for the ItemSnapshotter
|
||||
// interface.
|
||||
type ItemSnapshotterPlugin struct {
|
||||
plugin.NetRPCUnsupportedPlugin
|
||||
*pluginBase
|
||||
}
|
||||
|
||||
// GRPCClient returns a clientDispenser for ItemSnapshotter gRPC clients.
|
||||
func (p *ItemSnapshotterPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error) {
|
||||
return newClientDispenser(p.clientLogger, clientConn, newItemSnapshotterGRPCClient), nil
|
||||
}
|
||||
|
||||
// GRPCServer registers an ItemSnapshotter gRPC server.
|
||||
func (p *ItemSnapshotterPlugin) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error {
|
||||
proto.RegisterItemSnapshotterServer(server, &ItemSnapshotterGRPCServer{mux: p.serverMux})
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package framework
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
isv1 "github.com/vmware-tanzu/velero/pkg/plugin/velero/item_snapshotter/v1"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/grpc"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
proto "github.com/vmware-tanzu/velero/pkg/plugin/generated"
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
|
||||
)
|
||||
|
||||
// NewItemSnapshotterPlugin constructs a ItemSnapshotterPlugin.
|
||||
func NewItemSnapshotterPlugin(options ...PluginOption) *ItemSnapshotterPlugin {
|
||||
return &ItemSnapshotterPlugin{
|
||||
pluginBase: newPluginBase(options...),
|
||||
}
|
||||
}
|
||||
|
||||
func newItemSnapshotterGRPCClient(base *clientBase, clientConn *grpc.ClientConn) interface{} {
|
||||
return &ItemSnapshotterGRPCClient{
|
||||
clientBase: base,
|
||||
grpcClient: proto.NewItemSnapshotterClient(clientConn),
|
||||
}
|
||||
}
|
||||
|
||||
// ItemSnapshotterGRPCClient implements the ItemSnapshotter interface and uses a
|
||||
// gRPC client to make calls to the plugin server.
|
||||
type ItemSnapshotterGRPCClient struct {
|
||||
*clientBase
|
||||
grpcClient proto.ItemSnapshotterClient
|
||||
}
|
||||
|
||||
func (recv ItemSnapshotterGRPCClient) Init(config map[string]string) error {
|
||||
req := &proto.ItemSnapshotterInitRequest{
|
||||
Plugin: recv.plugin,
|
||||
Config: config,
|
||||
}
|
||||
|
||||
_, err := recv.grpcClient.Init(context.Background(), req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (recv ItemSnapshotterGRPCClient) AppliesTo() (velero.ResourceSelector, error) {
|
||||
req := &proto.ItemSnapshotterAppliesToRequest{
|
||||
Plugin: recv.plugin,
|
||||
}
|
||||
|
||||
res, err := recv.grpcClient.AppliesTo(context.Background(), req)
|
||||
if err != nil {
|
||||
return velero.ResourceSelector{}, fromGRPCError(err)
|
||||
}
|
||||
|
||||
if res.ResourceSelector == nil {
|
||||
return velero.ResourceSelector{}, nil
|
||||
}
|
||||
|
||||
return velero.ResourceSelector{
|
||||
IncludedNamespaces: res.ResourceSelector.IncludedNamespaces,
|
||||
ExcludedNamespaces: res.ResourceSelector.ExcludedNamespaces,
|
||||
IncludedResources: res.ResourceSelector.IncludedResources,
|
||||
ExcludedResources: res.ResourceSelector.ExcludedResources,
|
||||
LabelSelector: res.ResourceSelector.Selector,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (recv ItemSnapshotterGRPCClient) AlsoHandles(input *isv1.AlsoHandlesInput) ([]velero.ResourceIdentifier, error) {
|
||||
itemJSON, err := json.Marshal(input.Item.UnstructuredContent())
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
backupJSON, err := json.Marshal(input.Backup)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
req := &proto.AlsoHandlesRequest{
|
||||
Plugin: recv.plugin,
|
||||
Item: itemJSON,
|
||||
Backup: backupJSON,
|
||||
}
|
||||
res, err := recv.grpcClient.AlsoHandles(context.Background(), req)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
handledItems := unpackResourceIdentifiers(res.HandledItems)
|
||||
|
||||
return handledItems, nil
|
||||
}
|
||||
|
||||
func (recv ItemSnapshotterGRPCClient) SnapshotItem(ctx context.Context, input *isv1.SnapshotItemInput) (*isv1.SnapshotItemOutput, error) {
|
||||
itemJSON, err := json.Marshal(input.Item.UnstructuredContent())
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
backupJSON, err := json.Marshal(input.Backup)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
req := &proto.SnapshotItemRequest{
|
||||
Plugin: recv.plugin,
|
||||
Item: itemJSON,
|
||||
Backup: backupJSON,
|
||||
}
|
||||
res, err := recv.grpcClient.SnapshotItem(ctx, req)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
var updatedItem unstructured.Unstructured
|
||||
if err := json.Unmarshal(res.Item, &updatedItem); err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
additionalItems := unpackResourceIdentifiers(res.AdditionalItems)
|
||||
handledItems := unpackResourceIdentifiers(res.HandledItems)
|
||||
|
||||
sio := isv1.SnapshotItemOutput{
|
||||
UpdatedItem: &updatedItem,
|
||||
SnapshotID: res.SnapshotID,
|
||||
SnapshotMetadata: res.SnapshotMetadata,
|
||||
AdditionalItems: additionalItems,
|
||||
HandledItems: handledItems,
|
||||
}
|
||||
return &sio, nil
|
||||
}
|
||||
|
||||
func (recv ItemSnapshotterGRPCClient) Progress(input *isv1.ProgressInput) (*isv1.ProgressOutput, error) {
|
||||
backupJSON, err := json.Marshal(input.Backup)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
req := &proto.ProgressRequest{
|
||||
Plugin: recv.plugin,
|
||||
ItemID: resourceIdentifierToProto(input.ItemID),
|
||||
SnapshotID: input.SnapshotID,
|
||||
Backup: backupJSON,
|
||||
}
|
||||
|
||||
res, err := recv.grpcClient.Progress(context.Background(), req)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
// Validate phase
|
||||
|
||||
phase, err := isv1.SnapshotPhaseFromString(res.Phase)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
up := isv1.ProgressOutput{
|
||||
Phase: phase,
|
||||
Err: res.Err,
|
||||
ItemsCompleted: res.ItemsCompleted,
|
||||
ItemsToComplete: res.ItemsToComplete,
|
||||
Started: time.Unix(res.Started, res.StartedNano),
|
||||
Updated: time.Unix(res.Updated, res.UpdatedNano),
|
||||
}
|
||||
return &up, nil
|
||||
}
|
||||
|
||||
func (recv ItemSnapshotterGRPCClient) DeleteSnapshot(ctx context.Context, input *isv1.DeleteSnapshotInput) error {
|
||||
req := &proto.DeleteItemSnapshotRequest{
|
||||
Plugin: recv.plugin,
|
||||
Params: input.Params,
|
||||
SnapshotID: input.SnapshotID,
|
||||
}
|
||||
_, err := recv.grpcClient.DeleteSnapshot(ctx, req) // Returns Empty as first arg so just ignore
|
||||
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (recv ItemSnapshotterGRPCClient) CreateItemFromSnapshot(ctx context.Context, input *isv1.CreateItemInput) (*isv1.CreateItemOutput, error) {
|
||||
itemJSON, err := json.Marshal(input.SnapshottedItem.UnstructuredContent())
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
itemFromBackupJSON, err := json.Marshal(input.ItemFromBackup.UnstructuredContent())
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
restoreJSON, err := json.Marshal(input.Restore)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
req := &proto.CreateItemFromSnapshotRequest{
|
||||
Plugin: recv.plugin,
|
||||
Item: itemJSON,
|
||||
SnapshotID: input.SnapshotID,
|
||||
ItemFromBackup: itemFromBackupJSON,
|
||||
SnapshotMetadata: input.SnapshotMetadata,
|
||||
Params: input.Params,
|
||||
Restore: restoreJSON,
|
||||
}
|
||||
|
||||
res, err := recv.grpcClient.CreateItemFromSnapshot(ctx, req)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
var updatedItem unstructured.Unstructured
|
||||
if err := json.Unmarshal(res.Item, &updatedItem); err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
additionalItems := unpackResourceIdentifiers(res.AdditionalItems)
|
||||
|
||||
cio := isv1.CreateItemOutput{
|
||||
UpdatedItem: &updatedItem,
|
||||
AdditionalItems: additionalItems,
|
||||
SkipRestore: res.SkipRestore,
|
||||
}
|
||||
return &cio, nil
|
||||
}
|
|
@ -0,0 +1,311 @@
|
|||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
package framework
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
isv1 "github.com/vmware-tanzu/velero/pkg/plugin/velero/item_snapshotter/v1"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
proto "github.com/vmware-tanzu/velero/pkg/plugin/generated"
|
||||
)
|
||||
|
||||
// ItemSnapshotterGRPCServer implements the proto-generated ItemSnapshotterServer interface, and accepts
|
||||
// gRPC calls and forwards them to an implementation of the pluggable interface.
|
||||
type ItemSnapshotterGRPCServer struct {
|
||||
mux *serverMux
|
||||
}
|
||||
|
||||
func (recv *ItemSnapshotterGRPCServer) getImpl(name string) (isv1.ItemSnapshotter, error) {
|
||||
impl, err := recv.mux.getHandler(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
itemAction, ok := impl.(isv1.ItemSnapshotter)
|
||||
if !ok {
|
||||
return nil, errors.Errorf("%T is not an item snapshotter", impl)
|
||||
}
|
||||
|
||||
return itemAction, nil
|
||||
}
|
||||
|
||||
func (recv *ItemSnapshotterGRPCServer) Init(c context.Context, req *proto.ItemSnapshotterInitRequest) (response *proto.Empty, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
}
|
||||
}()
|
||||
|
||||
impl, err := recv.getImpl(req.Plugin)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
err = impl.Init(req.Config)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
return &proto.Empty{}, nil
|
||||
}
|
||||
|
||||
func (recv *ItemSnapshotterGRPCServer) AppliesTo(ctx context.Context, req *proto.ItemSnapshotterAppliesToRequest) (response *proto.ItemSnapshotterAppliesToResponse, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
}
|
||||
}()
|
||||
|
||||
impl, err := recv.getImpl(req.Plugin)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
resourceSelector, err := impl.AppliesTo()
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
return &proto.ItemSnapshotterAppliesToResponse{
|
||||
&proto.ResourceSelector{
|
||||
IncludedNamespaces: resourceSelector.IncludedNamespaces,
|
||||
ExcludedNamespaces: resourceSelector.ExcludedNamespaces,
|
||||
IncludedResources: resourceSelector.IncludedResources,
|
||||
ExcludedResources: resourceSelector.ExcludedResources,
|
||||
Selector: resourceSelector.LabelSelector,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (recv *ItemSnapshotterGRPCServer) AlsoHandles(ctx context.Context, req *proto.AlsoHandlesRequest) (res *proto.AlsoHandlesResponse, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
}
|
||||
}()
|
||||
|
||||
impl, err := recv.getImpl(req.Plugin)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
var item unstructured.Unstructured
|
||||
var backup api.Backup
|
||||
|
||||
if err := json.Unmarshal(req.Item, &item); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
if err := json.Unmarshal(req.Backup, &backup); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
ahi := isv1.AlsoHandlesInput{
|
||||
Item: &item,
|
||||
Backup: &backup,
|
||||
}
|
||||
alsoHandles, err := impl.AlsoHandles(&ahi)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
res = &proto.AlsoHandlesResponse{}
|
||||
|
||||
for _, item := range alsoHandles {
|
||||
res.HandledItems = append(res.HandledItems, resourceIdentifierToProto(item))
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (recv *ItemSnapshotterGRPCServer) SnapshotItem(ctx context.Context, req *proto.SnapshotItemRequest) (res *proto.SnapshotItemResponse, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
}
|
||||
}()
|
||||
|
||||
impl, err := recv.getImpl(req.Plugin)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
var item unstructured.Unstructured
|
||||
var backup api.Backup
|
||||
|
||||
if err := json.Unmarshal(req.Item, &item); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
if err := json.Unmarshal(req.Backup, &backup); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
sii := isv1.SnapshotItemInput{
|
||||
Item: &item,
|
||||
Params: req.Params,
|
||||
Backup: &backup,
|
||||
}
|
||||
sio, err := impl.SnapshotItem(ctx, &sii)
|
||||
|
||||
// If the plugin implementation returned a nil updatedItem (meaning no modifications), reset updatedItem to the
|
||||
// original item.
|
||||
var updatedItemJSON []byte
|
||||
if sio.UpdatedItem == nil {
|
||||
updatedItemJSON = req.Item
|
||||
} else {
|
||||
updatedItemJSON, err = json.Marshal(sio.UpdatedItem.UnstructuredContent())
|
||||
if err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
}
|
||||
res = &proto.SnapshotItemResponse{
|
||||
Item: updatedItemJSON,
|
||||
SnapshotID: sio.SnapshotID,
|
||||
SnapshotMetadata: sio.SnapshotMetadata,
|
||||
}
|
||||
res.AdditionalItems = packResourceIdentifiers(sio.AdditionalItems)
|
||||
res.HandledItems = packResourceIdentifiers(sio.HandledItems)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (recv *ItemSnapshotterGRPCServer) Progress(ctx context.Context, req *proto.ProgressRequest) (res *proto.ProgressResponse, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
}
|
||||
}()
|
||||
impl, err := recv.getImpl(req.Plugin)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
var backup api.Backup
|
||||
|
||||
if err := json.Unmarshal(req.Backup, &backup); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
sipi := &isv1.ProgressInput{
|
||||
ItemID: protoToResourceIdentifier(req.ItemID),
|
||||
SnapshotID: req.SnapshotID,
|
||||
Backup: &backup,
|
||||
}
|
||||
|
||||
sipo, err := impl.Progress(sipi)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
res = &proto.ProgressResponse{
|
||||
Phase: string(sipo.Phase),
|
||||
ItemsCompleted: sipo.ItemsCompleted,
|
||||
ItemsToComplete: sipo.ItemsToComplete,
|
||||
Started: sipo.Started.Unix(),
|
||||
StartedNano: sipo.Started.UnixNano(),
|
||||
Updated: sipo.Updated.Unix(),
|
||||
UpdatedNano: sipo.Updated.UnixNano(),
|
||||
Err: sipo.Err,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (recv *ItemSnapshotterGRPCServer) DeleteSnapshot(ctx context.Context, req *proto.DeleteItemSnapshotRequest) (empty *proto.Empty, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
}
|
||||
}()
|
||||
impl, err := recv.getImpl(req.Plugin)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
var itemFromBackup unstructured.Unstructured
|
||||
if err := json.Unmarshal(req.ItemFromBackup, &itemFromBackup); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
|
||||
disi := isv1.DeleteSnapshotInput{
|
||||
SnapshotID: req.SnapshotID,
|
||||
ItemFromBackup: &itemFromBackup,
|
||||
SnapshotMetadata: req.Metadata,
|
||||
Params: req.Params,
|
||||
}
|
||||
|
||||
err = impl.DeleteSnapshot(ctx, &disi)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (recv *ItemSnapshotterGRPCServer) CreateItemFromSnapshot(ctx context.Context, req *proto.CreateItemFromSnapshotRequest) (res *proto.CreateItemFromSnapshotResponse, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
}
|
||||
}()
|
||||
impl, err := recv.getImpl(req.Plugin)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
var snapshottedItem unstructured.Unstructured
|
||||
if err := json.Unmarshal(req.Item, &snapshottedItem); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
|
||||
var itemFromBackup unstructured.Unstructured
|
||||
if err := json.Unmarshal(req.Item, &itemFromBackup); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
|
||||
var restore api.Restore
|
||||
|
||||
if err := json.Unmarshal(req.Restore, &restore); err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
|
||||
cii := isv1.CreateItemInput{
|
||||
SnapshottedItem: &snapshottedItem,
|
||||
SnapshotID: req.SnapshotID,
|
||||
ItemFromBackup: &itemFromBackup,
|
||||
SnapshotMetadata: req.SnapshotMetadata,
|
||||
Params: req.Params,
|
||||
Restore: &restore,
|
||||
}
|
||||
|
||||
cio, err := impl.CreateItemFromSnapshot(ctx, &cii)
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
var updatedItemJSON []byte
|
||||
if cio.UpdatedItem == nil {
|
||||
updatedItemJSON = req.Item
|
||||
} else {
|
||||
updatedItemJSON, err = json.Marshal(cio.UpdatedItem.UnstructuredContent())
|
||||
if err != nil {
|
||||
return nil, newGRPCError(errors.WithStack(err))
|
||||
}
|
||||
}
|
||||
res = &proto.CreateItemFromSnapshotResponse{
|
||||
Item: updatedItemJSON,
|
||||
SkipRestore: cio.SkipRestore,
|
||||
}
|
||||
res.AdditionalItems = packResourceIdentifiers(cio.AdditionalItems)
|
||||
|
||||
return
|
||||
}
|
|
@ -41,6 +41,9 @@ const (
|
|||
// PluginKindDeleteItemAction represents a delete item action plugin.
|
||||
PluginKindDeleteItemAction PluginKind = "DeleteItemAction"
|
||||
|
||||
// PluginKindItemSnapshotter represents an item snapshotter plugin
|
||||
PluginKindItemSnapshotter PluginKind = "ItemSnapshotter"
|
||||
|
||||
// PluginKindPluginLister represents a plugin lister plugin.
|
||||
PluginKindPluginLister PluginKind = "PluginLister"
|
||||
)
|
||||
|
@ -54,5 +57,6 @@ func AllPluginKinds() map[string]PluginKind {
|
|||
allPluginKinds[PluginKindBackupItemAction.String()] = PluginKindBackupItemAction
|
||||
allPluginKinds[PluginKindRestoreItemAction.String()] = PluginKindRestoreItemAction
|
||||
allPluginKinds[PluginKindDeleteItemAction.String()] = PluginKindDeleteItemAction
|
||||
allPluginKinds[PluginKindItemSnapshotter.String()] = PluginKindItemSnapshotter
|
||||
return allPluginKinds
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ func TestPluginImplementationsAreGRPCPlugins(t *testing.T) {
|
|||
new(ObjectStorePlugin),
|
||||
new(PluginListerPlugin),
|
||||
new(RestoreItemActionPlugin),
|
||||
new(ItemSnapshotterPlugin),
|
||||
}
|
||||
|
||||
for _, impl := range pluginImpls {
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package framework
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
proto "github.com/vmware-tanzu/velero/pkg/plugin/generated"
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
|
||||
)
|
||||
|
||||
func packResourceIdentifiers(resourcesIDs []velero.ResourceIdentifier) (protoIDs []*proto.ResourceIdentifier) {
|
||||
for _, item := range resourcesIDs {
|
||||
protoIDs = append(protoIDs, resourceIdentifierToProto(item))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func unpackResourceIdentifiers(protoIDs []*proto.ResourceIdentifier) (resourceIDs []velero.ResourceIdentifier) {
|
||||
for _, itm := range protoIDs {
|
||||
resourceIDs = append(resourceIDs, protoToResourceIdentifier(itm))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func protoToResourceIdentifier(proto *proto.ResourceIdentifier) velero.ResourceIdentifier {
|
||||
return velero.ResourceIdentifier{
|
||||
GroupResource: schema.GroupResource{
|
||||
Group: proto.Group,
|
||||
Resource: proto.Resource,
|
||||
},
|
||||
Namespace: proto.Namespace,
|
||||
Name: proto.Name,
|
||||
}
|
||||
}
|
||||
|
||||
func resourceIdentifierToProto(id velero.ResourceIdentifier) *proto.ResourceIdentifier {
|
||||
return &proto.ResourceIdentifier{
|
||||
Group: id.Group,
|
||||
Resource: id.Resource,
|
||||
Namespace: id.Namespace,
|
||||
Name: id.Name,
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ Package generated is a generated protocol buffer package.
|
|||
It is generated from these files:
|
||||
BackupItemAction.proto
|
||||
DeleteItemAction.proto
|
||||
ItemSnapshotter.proto
|
||||
ObjectStore.proto
|
||||
PluginLister.proto
|
||||
RestoreItemAction.proto
|
||||
|
@ -21,6 +22,18 @@ It has these top-level messages:
|
|||
DeleteItemActionExecuteRequest
|
||||
DeleteItemActionAppliesToRequest
|
||||
DeleteItemActionAppliesToResponse
|
||||
ItemSnapshotterAppliesToRequest
|
||||
ItemSnapshotterAppliesToResponse
|
||||
AlsoHandlesRequest
|
||||
AlsoHandlesResponse
|
||||
SnapshotItemRequest
|
||||
SnapshotItemResponse
|
||||
ProgressRequest
|
||||
ProgressResponse
|
||||
DeleteItemSnapshotRequest
|
||||
CreateItemFromSnapshotRequest
|
||||
CreateItemFromSnapshotResponse
|
||||
ItemSnapshotterInitRequest
|
||||
PutObjectRequest
|
||||
ObjectExistsRequest
|
||||
ObjectExistsResponse
|
||||
|
|
|
@ -0,0 +1,819 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: ItemSnapshotter.proto
|
||||
|
||||
package generated
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
type ItemSnapshotterAppliesToRequest struct {
|
||||
Plugin string `protobuf:"bytes,1,opt,name=plugin" json:"plugin,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ItemSnapshotterAppliesToRequest) Reset() { *m = ItemSnapshotterAppliesToRequest{} }
|
||||
func (m *ItemSnapshotterAppliesToRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ItemSnapshotterAppliesToRequest) ProtoMessage() {}
|
||||
func (*ItemSnapshotterAppliesToRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor2, []int{0}
|
||||
}
|
||||
|
||||
func (m *ItemSnapshotterAppliesToRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
return m.Plugin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ItemSnapshotterAppliesToResponse struct {
|
||||
ResourceSelector *ResourceSelector `protobuf:"bytes,1,opt,name=ResourceSelector" json:"ResourceSelector,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ItemSnapshotterAppliesToResponse) Reset() { *m = ItemSnapshotterAppliesToResponse{} }
|
||||
func (m *ItemSnapshotterAppliesToResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ItemSnapshotterAppliesToResponse) ProtoMessage() {}
|
||||
func (*ItemSnapshotterAppliesToResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor2, []int{1}
|
||||
}
|
||||
|
||||
func (m *ItemSnapshotterAppliesToResponse) GetResourceSelector() *ResourceSelector {
|
||||
if m != nil {
|
||||
return m.ResourceSelector
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AlsoHandlesRequest struct {
|
||||
Plugin string `protobuf:"bytes,1,opt,name=plugin" json:"plugin,omitempty"`
|
||||
Item []byte `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"`
|
||||
Backup []byte `protobuf:"bytes,3,opt,name=backup,proto3" json:"backup,omitempty"`
|
||||
}
|
||||
|
||||
func (m *AlsoHandlesRequest) Reset() { *m = AlsoHandlesRequest{} }
|
||||
func (m *AlsoHandlesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*AlsoHandlesRequest) ProtoMessage() {}
|
||||
func (*AlsoHandlesRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} }
|
||||
|
||||
func (m *AlsoHandlesRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
return m.Plugin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AlsoHandlesRequest) GetItem() []byte {
|
||||
if m != nil {
|
||||
return m.Item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AlsoHandlesRequest) GetBackup() []byte {
|
||||
if m != nil {
|
||||
return m.Backup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AlsoHandlesResponse struct {
|
||||
HandledItems []*ResourceIdentifier `protobuf:"bytes,1,rep,name=handledItems" json:"handledItems,omitempty"`
|
||||
}
|
||||
|
||||
func (m *AlsoHandlesResponse) Reset() { *m = AlsoHandlesResponse{} }
|
||||
func (m *AlsoHandlesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*AlsoHandlesResponse) ProtoMessage() {}
|
||||
func (*AlsoHandlesResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} }
|
||||
|
||||
func (m *AlsoHandlesResponse) GetHandledItems() []*ResourceIdentifier {
|
||||
if m != nil {
|
||||
return m.HandledItems
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SnapshotItemRequest struct {
|
||||
Plugin string `protobuf:"bytes,1,opt,name=plugin" json:"plugin,omitempty"`
|
||||
Item []byte `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"`
|
||||
Params map[string]string `protobuf:"bytes,3,rep,name=params" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Backup []byte `protobuf:"bytes,4,opt,name=backup,proto3" json:"backup,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SnapshotItemRequest) Reset() { *m = SnapshotItemRequest{} }
|
||||
func (m *SnapshotItemRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SnapshotItemRequest) ProtoMessage() {}
|
||||
func (*SnapshotItemRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{4} }
|
||||
|
||||
func (m *SnapshotItemRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
return m.Plugin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *SnapshotItemRequest) GetItem() []byte {
|
||||
if m != nil {
|
||||
return m.Item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotItemRequest) GetParams() map[string]string {
|
||||
if m != nil {
|
||||
return m.Params
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotItemRequest) GetBackup() []byte {
|
||||
if m != nil {
|
||||
return m.Backup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SnapshotItemResponse struct {
|
||||
Item []byte `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"`
|
||||
SnapshotID string `protobuf:"bytes,2,opt,name=snapshotID" json:"snapshotID,omitempty"`
|
||||
SnapshotMetadata map[string]string `protobuf:"bytes,3,rep,name=snapshotMetadata" json:"snapshotMetadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
AdditionalItems []*ResourceIdentifier `protobuf:"bytes,4,rep,name=additionalItems" json:"additionalItems,omitempty"`
|
||||
HandledItems []*ResourceIdentifier `protobuf:"bytes,5,rep,name=handledItems" json:"handledItems,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SnapshotItemResponse) Reset() { *m = SnapshotItemResponse{} }
|
||||
func (m *SnapshotItemResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SnapshotItemResponse) ProtoMessage() {}
|
||||
func (*SnapshotItemResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{5} }
|
||||
|
||||
func (m *SnapshotItemResponse) GetItem() []byte {
|
||||
if m != nil {
|
||||
return m.Item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotItemResponse) GetSnapshotID() string {
|
||||
if m != nil {
|
||||
return m.SnapshotID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *SnapshotItemResponse) GetSnapshotMetadata() map[string]string {
|
||||
if m != nil {
|
||||
return m.SnapshotMetadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotItemResponse) GetAdditionalItems() []*ResourceIdentifier {
|
||||
if m != nil {
|
||||
return m.AdditionalItems
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SnapshotItemResponse) GetHandledItems() []*ResourceIdentifier {
|
||||
if m != nil {
|
||||
return m.HandledItems
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ProgressRequest struct {
|
||||
Plugin string `protobuf:"bytes,1,opt,name=plugin" json:"plugin,omitempty"`
|
||||
ItemID *ResourceIdentifier `protobuf:"bytes,2,opt,name=itemID" json:"itemID,omitempty"`
|
||||
SnapshotID string `protobuf:"bytes,3,opt,name=snapshotID" json:"snapshotID,omitempty"`
|
||||
Backup []byte `protobuf:"bytes,4,opt,name=backup,proto3" json:"backup,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ProgressRequest) Reset() { *m = ProgressRequest{} }
|
||||
func (m *ProgressRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ProgressRequest) ProtoMessage() {}
|
||||
func (*ProgressRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{6} }
|
||||
|
||||
func (m *ProgressRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
return m.Plugin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ProgressRequest) GetItemID() *ResourceIdentifier {
|
||||
if m != nil {
|
||||
return m.ItemID
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ProgressRequest) GetSnapshotID() string {
|
||||
if m != nil {
|
||||
return m.SnapshotID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ProgressRequest) GetBackup() []byte {
|
||||
if m != nil {
|
||||
return m.Backup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ProgressResponse struct {
|
||||
Phase string `protobuf:"bytes,1,opt,name=phase" json:"phase,omitempty"`
|
||||
ItemsCompleted int64 `protobuf:"varint,2,opt,name=itemsCompleted" json:"itemsCompleted,omitempty"`
|
||||
ItemsToComplete int64 `protobuf:"varint,3,opt,name=itemsToComplete" json:"itemsToComplete,omitempty"`
|
||||
Started int64 `protobuf:"varint,4,opt,name=started" json:"started,omitempty"`
|
||||
StartedNano int64 `protobuf:"varint,5,opt,name=startedNano" json:"startedNano,omitempty"`
|
||||
Updated int64 `protobuf:"varint,6,opt,name=updated" json:"updated,omitempty"`
|
||||
UpdatedNano int64 `protobuf:"varint,7,opt,name=updatedNano" json:"updatedNano,omitempty"`
|
||||
Err string `protobuf:"bytes,8,opt,name=err" json:"err,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ProgressResponse) Reset() { *m = ProgressResponse{} }
|
||||
func (m *ProgressResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ProgressResponse) ProtoMessage() {}
|
||||
func (*ProgressResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{7} }
|
||||
|
||||
func (m *ProgressResponse) GetPhase() string {
|
||||
if m != nil {
|
||||
return m.Phase
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ProgressResponse) GetItemsCompleted() int64 {
|
||||
if m != nil {
|
||||
return m.ItemsCompleted
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ProgressResponse) GetItemsToComplete() int64 {
|
||||
if m != nil {
|
||||
return m.ItemsToComplete
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ProgressResponse) GetStarted() int64 {
|
||||
if m != nil {
|
||||
return m.Started
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ProgressResponse) GetStartedNano() int64 {
|
||||
if m != nil {
|
||||
return m.StartedNano
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ProgressResponse) GetUpdated() int64 {
|
||||
if m != nil {
|
||||
return m.Updated
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ProgressResponse) GetUpdatedNano() int64 {
|
||||
if m != nil {
|
||||
return m.UpdatedNano
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ProgressResponse) GetErr() string {
|
||||
if m != nil {
|
||||
return m.Err
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type DeleteItemSnapshotRequest struct {
|
||||
Plugin string `protobuf:"bytes,1,opt,name=plugin" json:"plugin,omitempty"`
|
||||
SnapshotID string `protobuf:"bytes,2,opt,name=snapshotID" json:"snapshotID,omitempty"`
|
||||
ItemFromBackup []byte `protobuf:"bytes,3,opt,name=itemFromBackup,proto3" json:"itemFromBackup,omitempty"`
|
||||
Metadata map[string]string `protobuf:"bytes,4,rep,name=metadata" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Params map[string]string `protobuf:"bytes,5,rep,name=params" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
}
|
||||
|
||||
func (m *DeleteItemSnapshotRequest) Reset() { *m = DeleteItemSnapshotRequest{} }
|
||||
func (m *DeleteItemSnapshotRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteItemSnapshotRequest) ProtoMessage() {}
|
||||
func (*DeleteItemSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{8} }
|
||||
|
||||
func (m *DeleteItemSnapshotRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
return m.Plugin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *DeleteItemSnapshotRequest) GetSnapshotID() string {
|
||||
if m != nil {
|
||||
return m.SnapshotID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *DeleteItemSnapshotRequest) GetItemFromBackup() []byte {
|
||||
if m != nil {
|
||||
return m.ItemFromBackup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *DeleteItemSnapshotRequest) GetMetadata() map[string]string {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *DeleteItemSnapshotRequest) GetParams() map[string]string {
|
||||
if m != nil {
|
||||
return m.Params
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateItemFromSnapshotRequest struct {
|
||||
Plugin string `protobuf:"bytes,1,opt,name=plugin" json:"plugin,omitempty"`
|
||||
Item []byte `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"`
|
||||
SnapshotID string `protobuf:"bytes,3,opt,name=snapshotID" json:"snapshotID,omitempty"`
|
||||
ItemFromBackup []byte `protobuf:"bytes,4,opt,name=itemFromBackup,proto3" json:"itemFromBackup,omitempty"`
|
||||
SnapshotMetadata map[string]string `protobuf:"bytes,5,rep,name=snapshotMetadata" json:"snapshotMetadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Params map[string]string `protobuf:"bytes,6,rep,name=params" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Restore []byte `protobuf:"bytes,7,opt,name=restore,proto3" json:"restore,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotRequest) Reset() { *m = CreateItemFromSnapshotRequest{} }
|
||||
func (m *CreateItemFromSnapshotRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateItemFromSnapshotRequest) ProtoMessage() {}
|
||||
func (*CreateItemFromSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{9} }
|
||||
|
||||
func (m *CreateItemFromSnapshotRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
return m.Plugin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotRequest) GetItem() []byte {
|
||||
if m != nil {
|
||||
return m.Item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotRequest) GetSnapshotID() string {
|
||||
if m != nil {
|
||||
return m.SnapshotID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotRequest) GetItemFromBackup() []byte {
|
||||
if m != nil {
|
||||
return m.ItemFromBackup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotRequest) GetSnapshotMetadata() map[string]string {
|
||||
if m != nil {
|
||||
return m.SnapshotMetadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotRequest) GetParams() map[string]string {
|
||||
if m != nil {
|
||||
return m.Params
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotRequest) GetRestore() []byte {
|
||||
if m != nil {
|
||||
return m.Restore
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateItemFromSnapshotResponse struct {
|
||||
Item []byte `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"`
|
||||
AdditionalItems []*ResourceIdentifier `protobuf:"bytes,2,rep,name=additionalItems" json:"additionalItems,omitempty"`
|
||||
SkipRestore bool `protobuf:"varint,3,opt,name=skipRestore" json:"skipRestore,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotResponse) Reset() { *m = CreateItemFromSnapshotResponse{} }
|
||||
func (m *CreateItemFromSnapshotResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateItemFromSnapshotResponse) ProtoMessage() {}
|
||||
func (*CreateItemFromSnapshotResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor2, []int{10}
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotResponse) GetItem() []byte {
|
||||
if m != nil {
|
||||
return m.Item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotResponse) GetAdditionalItems() []*ResourceIdentifier {
|
||||
if m != nil {
|
||||
return m.AdditionalItems
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateItemFromSnapshotResponse) GetSkipRestore() bool {
|
||||
if m != nil {
|
||||
return m.SkipRestore
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ItemSnapshotterInitRequest struct {
|
||||
Plugin string `protobuf:"bytes,1,opt,name=plugin" json:"plugin,omitempty"`
|
||||
Config map[string]string `protobuf:"bytes,2,rep,name=config" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
}
|
||||
|
||||
func (m *ItemSnapshotterInitRequest) Reset() { *m = ItemSnapshotterInitRequest{} }
|
||||
func (m *ItemSnapshotterInitRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ItemSnapshotterInitRequest) ProtoMessage() {}
|
||||
func (*ItemSnapshotterInitRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{11} }
|
||||
|
||||
func (m *ItemSnapshotterInitRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
return m.Plugin
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ItemSnapshotterInitRequest) GetConfig() map[string]string {
|
||||
if m != nil {
|
||||
return m.Config
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ItemSnapshotterAppliesToRequest)(nil), "generated.ItemSnapshotterAppliesToRequest")
|
||||
proto.RegisterType((*ItemSnapshotterAppliesToResponse)(nil), "generated.ItemSnapshotterAppliesToResponse")
|
||||
proto.RegisterType((*AlsoHandlesRequest)(nil), "generated.AlsoHandlesRequest")
|
||||
proto.RegisterType((*AlsoHandlesResponse)(nil), "generated.AlsoHandlesResponse")
|
||||
proto.RegisterType((*SnapshotItemRequest)(nil), "generated.SnapshotItemRequest")
|
||||
proto.RegisterType((*SnapshotItemResponse)(nil), "generated.SnapshotItemResponse")
|
||||
proto.RegisterType((*ProgressRequest)(nil), "generated.ProgressRequest")
|
||||
proto.RegisterType((*ProgressResponse)(nil), "generated.ProgressResponse")
|
||||
proto.RegisterType((*DeleteItemSnapshotRequest)(nil), "generated.DeleteItemSnapshotRequest")
|
||||
proto.RegisterType((*CreateItemFromSnapshotRequest)(nil), "generated.CreateItemFromSnapshotRequest")
|
||||
proto.RegisterType((*CreateItemFromSnapshotResponse)(nil), "generated.CreateItemFromSnapshotResponse")
|
||||
proto.RegisterType((*ItemSnapshotterInitRequest)(nil), "generated.ItemSnapshotterInitRequest")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for ItemSnapshotter service
|
||||
|
||||
type ItemSnapshotterClient interface {
|
||||
Init(ctx context.Context, in *ItemSnapshotterInitRequest, opts ...grpc.CallOption) (*Empty, error)
|
||||
AppliesTo(ctx context.Context, in *ItemSnapshotterAppliesToRequest, opts ...grpc.CallOption) (*ItemSnapshotterAppliesToResponse, error)
|
||||
AlsoHandles(ctx context.Context, in *AlsoHandlesRequest, opts ...grpc.CallOption) (*AlsoHandlesResponse, error)
|
||||
SnapshotItem(ctx context.Context, in *SnapshotItemRequest, opts ...grpc.CallOption) (*SnapshotItemResponse, error)
|
||||
Progress(ctx context.Context, in *ProgressRequest, opts ...grpc.CallOption) (*ProgressResponse, error)
|
||||
DeleteSnapshot(ctx context.Context, in *DeleteItemSnapshotRequest, opts ...grpc.CallOption) (*Empty, error)
|
||||
CreateItemFromSnapshot(ctx context.Context, in *CreateItemFromSnapshotRequest, opts ...grpc.CallOption) (*CreateItemFromSnapshotResponse, error)
|
||||
}
|
||||
|
||||
type itemSnapshotterClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewItemSnapshotterClient(cc *grpc.ClientConn) ItemSnapshotterClient {
|
||||
return &itemSnapshotterClient{cc}
|
||||
}
|
||||
|
||||
func (c *itemSnapshotterClient) Init(ctx context.Context, in *ItemSnapshotterInitRequest, opts ...grpc.CallOption) (*Empty, error) {
|
||||
out := new(Empty)
|
||||
err := grpc.Invoke(ctx, "/generated.ItemSnapshotter/Init", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *itemSnapshotterClient) AppliesTo(ctx context.Context, in *ItemSnapshotterAppliesToRequest, opts ...grpc.CallOption) (*ItemSnapshotterAppliesToResponse, error) {
|
||||
out := new(ItemSnapshotterAppliesToResponse)
|
||||
err := grpc.Invoke(ctx, "/generated.ItemSnapshotter/AppliesTo", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *itemSnapshotterClient) AlsoHandles(ctx context.Context, in *AlsoHandlesRequest, opts ...grpc.CallOption) (*AlsoHandlesResponse, error) {
|
||||
out := new(AlsoHandlesResponse)
|
||||
err := grpc.Invoke(ctx, "/generated.ItemSnapshotter/AlsoHandles", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *itemSnapshotterClient) SnapshotItem(ctx context.Context, in *SnapshotItemRequest, opts ...grpc.CallOption) (*SnapshotItemResponse, error) {
|
||||
out := new(SnapshotItemResponse)
|
||||
err := grpc.Invoke(ctx, "/generated.ItemSnapshotter/SnapshotItem", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *itemSnapshotterClient) Progress(ctx context.Context, in *ProgressRequest, opts ...grpc.CallOption) (*ProgressResponse, error) {
|
||||
out := new(ProgressResponse)
|
||||
err := grpc.Invoke(ctx, "/generated.ItemSnapshotter/Progress", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *itemSnapshotterClient) DeleteSnapshot(ctx context.Context, in *DeleteItemSnapshotRequest, opts ...grpc.CallOption) (*Empty, error) {
|
||||
out := new(Empty)
|
||||
err := grpc.Invoke(ctx, "/generated.ItemSnapshotter/DeleteSnapshot", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *itemSnapshotterClient) CreateItemFromSnapshot(ctx context.Context, in *CreateItemFromSnapshotRequest, opts ...grpc.CallOption) (*CreateItemFromSnapshotResponse, error) {
|
||||
out := new(CreateItemFromSnapshotResponse)
|
||||
err := grpc.Invoke(ctx, "/generated.ItemSnapshotter/CreateItemFromSnapshot", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for ItemSnapshotter service
|
||||
|
||||
type ItemSnapshotterServer interface {
|
||||
Init(context.Context, *ItemSnapshotterInitRequest) (*Empty, error)
|
||||
AppliesTo(context.Context, *ItemSnapshotterAppliesToRequest) (*ItemSnapshotterAppliesToResponse, error)
|
||||
AlsoHandles(context.Context, *AlsoHandlesRequest) (*AlsoHandlesResponse, error)
|
||||
SnapshotItem(context.Context, *SnapshotItemRequest) (*SnapshotItemResponse, error)
|
||||
Progress(context.Context, *ProgressRequest) (*ProgressResponse, error)
|
||||
DeleteSnapshot(context.Context, *DeleteItemSnapshotRequest) (*Empty, error)
|
||||
CreateItemFromSnapshot(context.Context, *CreateItemFromSnapshotRequest) (*CreateItemFromSnapshotResponse, error)
|
||||
}
|
||||
|
||||
func RegisterItemSnapshotterServer(s *grpc.Server, srv ItemSnapshotterServer) {
|
||||
s.RegisterService(&_ItemSnapshotter_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _ItemSnapshotter_Init_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ItemSnapshotterInitRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ItemSnapshotterServer).Init(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/generated.ItemSnapshotter/Init",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ItemSnapshotterServer).Init(ctx, req.(*ItemSnapshotterInitRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ItemSnapshotter_AppliesTo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ItemSnapshotterAppliesToRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ItemSnapshotterServer).AppliesTo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/generated.ItemSnapshotter/AppliesTo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ItemSnapshotterServer).AppliesTo(ctx, req.(*ItemSnapshotterAppliesToRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ItemSnapshotter_AlsoHandles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AlsoHandlesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ItemSnapshotterServer).AlsoHandles(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/generated.ItemSnapshotter/AlsoHandles",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ItemSnapshotterServer).AlsoHandles(ctx, req.(*AlsoHandlesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ItemSnapshotter_SnapshotItem_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SnapshotItemRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ItemSnapshotterServer).SnapshotItem(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/generated.ItemSnapshotter/SnapshotItem",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ItemSnapshotterServer).SnapshotItem(ctx, req.(*SnapshotItemRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ItemSnapshotter_Progress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ProgressRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ItemSnapshotterServer).Progress(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/generated.ItemSnapshotter/Progress",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ItemSnapshotterServer).Progress(ctx, req.(*ProgressRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ItemSnapshotter_DeleteSnapshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteItemSnapshotRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ItemSnapshotterServer).DeleteSnapshot(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/generated.ItemSnapshotter/DeleteSnapshot",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ItemSnapshotterServer).DeleteSnapshot(ctx, req.(*DeleteItemSnapshotRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ItemSnapshotter_CreateItemFromSnapshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateItemFromSnapshotRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ItemSnapshotterServer).CreateItemFromSnapshot(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/generated.ItemSnapshotter/CreateItemFromSnapshot",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ItemSnapshotterServer).CreateItemFromSnapshot(ctx, req.(*CreateItemFromSnapshotRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _ItemSnapshotter_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "generated.ItemSnapshotter",
|
||||
HandlerType: (*ItemSnapshotterServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Init",
|
||||
Handler: _ItemSnapshotter_Init_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AppliesTo",
|
||||
Handler: _ItemSnapshotter_AppliesTo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AlsoHandles",
|
||||
Handler: _ItemSnapshotter_AlsoHandles_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SnapshotItem",
|
||||
Handler: _ItemSnapshotter_SnapshotItem_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Progress",
|
||||
Handler: _ItemSnapshotter_Progress_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteSnapshot",
|
||||
Handler: _ItemSnapshotter_DeleteSnapshot_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateItemFromSnapshot",
|
||||
Handler: _ItemSnapshotter_CreateItemFromSnapshot_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "ItemSnapshotter.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("ItemSnapshotter.proto", fileDescriptor2) }
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
// 887 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x5f, 0x8f, 0xdb, 0x44,
|
||||
0x10, 0x97, 0xe3, 0x5c, 0xee, 0x6e, 0x12, 0x7a, 0xd1, 0xf6, 0x5a, 0x19, 0x57, 0xbd, 0x46, 0x16,
|
||||
0xa0, 0x50, 0xa4, 0x08, 0x0e, 0x2a, 0x51, 0x90, 0x40, 0xd7, 0xb4, 0xf4, 0x4e, 0x2a, 0xa5, 0xf2,
|
||||
0xf5, 0xa1, 0xaf, 0xdb, 0x78, 0x9b, 0x98, 0xd8, 0x5e, 0xb3, 0xbb, 0x41, 0xba, 0x77, 0x5e, 0x79,
|
||||
0xe7, 0x8d, 0xef, 0xc1, 0xf7, 0x40, 0xe2, 0x1b, 0xf0, 0x2d, 0x10, 0xda, 0x3f, 0x0e, 0x1b, 0xc7,
|
||||
0x3e, 0xfb, 0xee, 0x78, 0xf3, 0xce, 0xce, 0xcc, 0xfe, 0x66, 0x7e, 0xb3, 0xb3, 0x63, 0xb8, 0x73,
|
||||
0x26, 0x48, 0x7a, 0x9e, 0xe1, 0x9c, 0x2f, 0xa8, 0x10, 0x84, 0x4d, 0x72, 0x46, 0x05, 0x45, 0xfb,
|
||||
0x73, 0x92, 0x11, 0x86, 0x05, 0x89, 0xfc, 0xc1, 0xf9, 0x02, 0x33, 0x12, 0xe9, 0x8d, 0xe0, 0x31,
|
||||
0x3c, 0x28, 0x59, 0x9c, 0xe4, 0x79, 0x12, 0x13, 0xfe, 0x9a, 0x86, 0xe4, 0xa7, 0x15, 0xe1, 0x02,
|
||||
0xdd, 0x85, 0x5e, 0x9e, 0xac, 0xe6, 0x71, 0xe6, 0x39, 0x23, 0x67, 0xbc, 0x1f, 0x9a, 0x55, 0xb0,
|
||||
0x84, 0x51, 0xbd, 0x29, 0xcf, 0x69, 0xc6, 0x09, 0x7a, 0x0e, 0xc3, 0x90, 0x70, 0xba, 0x62, 0x33,
|
||||
0x72, 0x4e, 0x12, 0x32, 0x13, 0x94, 0x29, 0x2f, 0xfd, 0xe3, 0x7b, 0x93, 0x35, 0xa4, 0x49, 0x59,
|
||||
0x25, 0xdc, 0x32, 0x0a, 0xde, 0x00, 0x3a, 0x49, 0x38, 0x3d, 0xc5, 0x59, 0x94, 0x10, 0xde, 0x00,
|
||||
0x0d, 0x21, 0xe8, 0xc6, 0x82, 0xa4, 0x5e, 0x67, 0xe4, 0x8c, 0x07, 0xa1, 0xfa, 0x96, 0xba, 0x6f,
|
||||
0xf1, 0x6c, 0xb9, 0xca, 0x3d, 0x57, 0x49, 0xcd, 0x2a, 0x78, 0x03, 0xb7, 0x37, 0x3c, 0x1b, 0xe4,
|
||||
0x27, 0x30, 0x58, 0x28, 0x51, 0x24, 0x83, 0xe4, 0x9e, 0x33, 0x72, 0xc7, 0xfd, 0xe3, 0xfb, 0x15,
|
||||
0xa8, 0xcf, 0x22, 0x92, 0x89, 0xf8, 0x5d, 0x4c, 0x58, 0xb8, 0x61, 0x12, 0xfc, 0xe5, 0xc0, 0xed,
|
||||
0x22, 0x3b, 0x52, 0x72, 0x1d, 0xd4, 0x4f, 0xa0, 0x97, 0x63, 0x86, 0x53, 0xee, 0xb9, 0x0a, 0xc0,
|
||||
0x43, 0x0b, 0x40, 0x85, 0xef, 0xc9, 0x2b, 0xa5, 0xfc, 0x2c, 0x13, 0xec, 0x22, 0x34, 0x96, 0x56,
|
||||
0xe4, 0x5d, 0x3b, 0x72, 0xff, 0x31, 0xf4, 0x2d, 0x75, 0x34, 0x04, 0x77, 0x49, 0x2e, 0x0c, 0x26,
|
||||
0xf9, 0x89, 0x0e, 0x61, 0xe7, 0x67, 0x9c, 0xac, 0x88, 0x42, 0xb4, 0x1f, 0xea, 0xc5, 0x57, 0x9d,
|
||||
0x2f, 0x9d, 0xe0, 0x9f, 0x0e, 0x1c, 0x6e, 0x1e, 0x6f, 0xd2, 0x56, 0xc4, 0xe0, 0x58, 0x31, 0x1c,
|
||||
0x01, 0xf0, 0x42, 0xf7, 0xa9, 0xf1, 0x65, 0x49, 0x10, 0x86, 0x61, 0xb1, 0xfa, 0x9e, 0x08, 0x1c,
|
||||
0x61, 0x81, 0x4d, 0xb4, 0x8f, 0x6a, 0xa3, 0xd5, 0xc7, 0xad, 0x85, 0x85, 0x9d, 0x0e, 0x7c, 0xcb,
|
||||
0x1d, 0x7a, 0x0e, 0x07, 0x38, 0x8a, 0x62, 0x11, 0xd3, 0x0c, 0x27, 0x9a, 0xd0, 0x6e, 0x1b, 0x42,
|
||||
0xcb, 0x56, 0x5b, 0x65, 0xb1, 0x73, 0xe5, 0xb2, 0xf0, 0xa7, 0x70, 0xa7, 0x12, 0xf6, 0x95, 0x08,
|
||||
0xf8, 0xcd, 0x81, 0x83, 0x57, 0x8c, 0xce, 0x19, 0xe1, 0x8d, 0xb7, 0xe1, 0x11, 0xf4, 0x24, 0x0f,
|
||||
0x26, 0xf7, 0x8d, 0x68, 0x8d, 0x72, 0x89, 0x36, 0x77, 0x8b, 0xb6, 0x9a, 0xb2, 0x0a, 0x7e, 0xe9,
|
||||
0xc0, 0xf0, 0x3f, 0x68, 0xa6, 0x2e, 0x0e, 0x61, 0x27, 0x5f, 0x60, 0x4e, 0x0c, 0x34, 0xbd, 0x40,
|
||||
0x1f, 0xc1, 0x2d, 0x79, 0x18, 0x9f, 0xd2, 0x34, 0x4f, 0x88, 0x20, 0x91, 0x42, 0xe8, 0x86, 0x25,
|
||||
0x29, 0x1a, 0xc3, 0x81, 0x92, 0xbc, 0xa6, 0x85, 0x4c, 0xe1, 0x71, 0xc3, 0xb2, 0x18, 0x79, 0xb0,
|
||||
0xcb, 0x05, 0x66, 0xd2, 0x55, 0x57, 0x69, 0x14, 0x4b, 0x34, 0x82, 0xbe, 0xf9, 0x7c, 0x89, 0x33,
|
||||
0xea, 0xed, 0xa8, 0x5d, 0x5b, 0x24, 0x6d, 0x57, 0x79, 0x24, 0xd3, 0xe2, 0xf5, 0xb4, 0xad, 0x59,
|
||||
0x4a, 0x5b, 0xf3, 0xa9, 0x6c, 0x77, 0xb5, 0xad, 0x25, 0x92, 0xdc, 0x11, 0xc6, 0xbc, 0x3d, 0xcd,
|
||||
0x1d, 0x61, 0x2c, 0xf8, 0xd5, 0x85, 0xf7, 0x9f, 0x12, 0x09, 0xca, 0xee, 0x92, 0x4d, 0x5c, 0x35,
|
||||
0xdd, 0x15, 0x93, 0xb1, 0xef, 0x18, 0x4d, 0x9f, 0xd8, 0xdd, 0xac, 0x24, 0x45, 0x2f, 0x61, 0x2f,
|
||||
0x2d, 0xee, 0x92, 0xae, 0xf4, 0x63, 0x8b, 0xf5, 0x5a, 0x5c, 0x93, 0xcd, 0x8b, 0xb4, 0xf6, 0x81,
|
||||
0x4e, 0xd7, 0x7d, 0x48, 0x57, 0xfc, 0xa7, 0xad, 0xbc, 0x55, 0x74, 0x23, 0xff, 0x6b, 0x78, 0xef,
|
||||
0xda, 0x65, 0x7f, 0x93, 0x96, 0xf5, 0xb7, 0x0b, 0xf7, 0xa7, 0x8c, 0x60, 0x8d, 0x54, 0xa6, 0xaa,
|
||||
0x2d, 0x27, 0x55, 0x7d, 0xb9, 0xe9, 0x72, 0x6c, 0xf3, 0xd4, 0xad, 0xe4, 0xe9, 0xc7, 0x8a, 0xde,
|
||||
0xa7, 0x33, 0xfc, 0x8d, 0x95, 0xe1, 0x4b, 0x71, 0xb7, 0x6e, 0x82, 0x2f, 0xd6, 0x1c, 0xf6, 0xd4,
|
||||
0x09, 0x5f, 0xb4, 0x3e, 0xa1, 0xea, 0x55, 0xf1, 0x60, 0x97, 0x11, 0x2e, 0x28, 0x23, 0xea, 0x3e,
|
||||
0x0c, 0xc2, 0x62, 0xf9, 0xbf, 0x34, 0xb8, 0x9b, 0x30, 0xfd, 0xbb, 0x03, 0x47, 0x75, 0xf1, 0x5c,
|
||||
0xf2, 0x4c, 0x55, 0xbc, 0x11, 0x9d, 0x6b, 0xbd, 0x11, 0xb2, 0xd3, 0x2c, 0xe3, 0x3c, 0x34, 0xd9,
|
||||
0x91, 0xc5, 0xb1, 0x17, 0xda, 0xa2, 0xe0, 0x0f, 0x07, 0xfc, 0xd2, 0xec, 0x74, 0x96, 0xc5, 0x8d,
|
||||
0x85, 0x78, 0x06, 0xbd, 0x19, 0xcd, 0xde, 0xc5, 0x73, 0x03, 0xec, 0x33, 0x0b, 0x58, 0xbd, 0xbb,
|
||||
0xc9, 0x54, 0xd9, 0x18, 0xf6, 0xb4, 0x03, 0x99, 0x5e, 0x4b, 0x7c, 0x95, 0xf4, 0x1e, 0xff, 0xd9,
|
||||
0x85, 0x83, 0xd2, 0x69, 0xe8, 0x5b, 0xe8, 0xca, 0x13, 0xd1, 0x87, 0xad, 0x10, 0xf9, 0x43, 0x4b,
|
||||
0xed, 0x59, 0x9a, 0x8b, 0x0b, 0x14, 0xc1, 0xfe, 0x7a, 0x7a, 0x44, 0x0f, 0xeb, 0xbd, 0x94, 0xa7,
|
||||
0x53, 0xff, 0x93, 0x56, 0xba, 0x86, 0xf6, 0x17, 0xd0, 0xb7, 0x66, 0x3d, 0x64, 0x13, 0xbb, 0x3d,
|
||||
0x5d, 0xfa, 0x47, 0x75, 0xdb, 0xc6, 0xdb, 0x0f, 0x30, 0xb0, 0x87, 0x12, 0x74, 0x74, 0xf9, 0x6c,
|
||||
0xe6, 0x3f, 0x68, 0x98, 0x66, 0xd0, 0x14, 0xf6, 0x8a, 0x87, 0x13, 0xf9, 0x96, 0x72, 0xe9, 0xa1,
|
||||
0xf7, 0xef, 0x55, 0xee, 0x19, 0x27, 0xa7, 0x70, 0x4b, 0x37, 0xe4, 0xe2, 0x08, 0xf4, 0x41, 0x9b,
|
||||
0x5e, 0x5d, 0xc1, 0x49, 0x0a, 0x77, 0xab, 0xaf, 0x11, 0x1a, 0xb7, 0xed, 0x1c, 0xfe, 0xc7, 0x2d,
|
||||
0x34, 0x35, 0xf0, 0xb7, 0x3d, 0xf5, 0x47, 0xf2, 0xf9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x51,
|
||||
0xd9, 0x74, 0xbb, 0xc3, 0x0c, 0x00, 0x00,
|
||||
}
|
|
@ -27,7 +27,7 @@ type PutObjectRequest struct {
|
|||
func (m *PutObjectRequest) Reset() { *m = PutObjectRequest{} }
|
||||
func (m *PutObjectRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*PutObjectRequest) ProtoMessage() {}
|
||||
func (*PutObjectRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
|
||||
func (*PutObjectRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
|
||||
|
||||
func (m *PutObjectRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -66,7 +66,7 @@ type ObjectExistsRequest struct {
|
|||
func (m *ObjectExistsRequest) Reset() { *m = ObjectExistsRequest{} }
|
||||
func (m *ObjectExistsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ObjectExistsRequest) ProtoMessage() {}
|
||||
func (*ObjectExistsRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} }
|
||||
func (*ObjectExistsRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} }
|
||||
|
||||
func (m *ObjectExistsRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -96,7 +96,7 @@ type ObjectExistsResponse struct {
|
|||
func (m *ObjectExistsResponse) Reset() { *m = ObjectExistsResponse{} }
|
||||
func (m *ObjectExistsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ObjectExistsResponse) ProtoMessage() {}
|
||||
func (*ObjectExistsResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} }
|
||||
func (*ObjectExistsResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{2} }
|
||||
|
||||
func (m *ObjectExistsResponse) GetExists() bool {
|
||||
if m != nil {
|
||||
|
@ -114,7 +114,7 @@ type GetObjectRequest struct {
|
|||
func (m *GetObjectRequest) Reset() { *m = GetObjectRequest{} }
|
||||
func (m *GetObjectRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetObjectRequest) ProtoMessage() {}
|
||||
func (*GetObjectRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} }
|
||||
func (*GetObjectRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{3} }
|
||||
|
||||
func (m *GetObjectRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -144,7 +144,7 @@ type Bytes struct {
|
|||
func (m *Bytes) Reset() { *m = Bytes{} }
|
||||
func (m *Bytes) String() string { return proto.CompactTextString(m) }
|
||||
func (*Bytes) ProtoMessage() {}
|
||||
func (*Bytes) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{4} }
|
||||
func (*Bytes) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{4} }
|
||||
|
||||
func (m *Bytes) GetData() []byte {
|
||||
if m != nil {
|
||||
|
@ -163,7 +163,7 @@ type ListCommonPrefixesRequest struct {
|
|||
func (m *ListCommonPrefixesRequest) Reset() { *m = ListCommonPrefixesRequest{} }
|
||||
func (m *ListCommonPrefixesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListCommonPrefixesRequest) ProtoMessage() {}
|
||||
func (*ListCommonPrefixesRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{5} }
|
||||
func (*ListCommonPrefixesRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{5} }
|
||||
|
||||
func (m *ListCommonPrefixesRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -200,7 +200,7 @@ type ListCommonPrefixesResponse struct {
|
|||
func (m *ListCommonPrefixesResponse) Reset() { *m = ListCommonPrefixesResponse{} }
|
||||
func (m *ListCommonPrefixesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListCommonPrefixesResponse) ProtoMessage() {}
|
||||
func (*ListCommonPrefixesResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{6} }
|
||||
func (*ListCommonPrefixesResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{6} }
|
||||
|
||||
func (m *ListCommonPrefixesResponse) GetPrefixes() []string {
|
||||
if m != nil {
|
||||
|
@ -218,7 +218,7 @@ type ListObjectsRequest struct {
|
|||
func (m *ListObjectsRequest) Reset() { *m = ListObjectsRequest{} }
|
||||
func (m *ListObjectsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListObjectsRequest) ProtoMessage() {}
|
||||
func (*ListObjectsRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{7} }
|
||||
func (*ListObjectsRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{7} }
|
||||
|
||||
func (m *ListObjectsRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -248,7 +248,7 @@ type ListObjectsResponse struct {
|
|||
func (m *ListObjectsResponse) Reset() { *m = ListObjectsResponse{} }
|
||||
func (m *ListObjectsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListObjectsResponse) ProtoMessage() {}
|
||||
func (*ListObjectsResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{8} }
|
||||
func (*ListObjectsResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{8} }
|
||||
|
||||
func (m *ListObjectsResponse) GetKeys() []string {
|
||||
if m != nil {
|
||||
|
@ -266,7 +266,7 @@ type DeleteObjectRequest struct {
|
|||
func (m *DeleteObjectRequest) Reset() { *m = DeleteObjectRequest{} }
|
||||
func (m *DeleteObjectRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteObjectRequest) ProtoMessage() {}
|
||||
func (*DeleteObjectRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{9} }
|
||||
func (*DeleteObjectRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{9} }
|
||||
|
||||
func (m *DeleteObjectRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -299,7 +299,7 @@ type CreateSignedURLRequest struct {
|
|||
func (m *CreateSignedURLRequest) Reset() { *m = CreateSignedURLRequest{} }
|
||||
func (m *CreateSignedURLRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateSignedURLRequest) ProtoMessage() {}
|
||||
func (*CreateSignedURLRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{10} }
|
||||
func (*CreateSignedURLRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{10} }
|
||||
|
||||
func (m *CreateSignedURLRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -336,7 +336,7 @@ type CreateSignedURLResponse struct {
|
|||
func (m *CreateSignedURLResponse) Reset() { *m = CreateSignedURLResponse{} }
|
||||
func (m *CreateSignedURLResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateSignedURLResponse) ProtoMessage() {}
|
||||
func (*CreateSignedURLResponse) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{11} }
|
||||
func (*CreateSignedURLResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{11} }
|
||||
|
||||
func (m *CreateSignedURLResponse) GetUrl() string {
|
||||
if m != nil {
|
||||
|
@ -353,7 +353,7 @@ type ObjectStoreInitRequest struct {
|
|||
func (m *ObjectStoreInitRequest) Reset() { *m = ObjectStoreInitRequest{} }
|
||||
func (m *ObjectStoreInitRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ObjectStoreInitRequest) ProtoMessage() {}
|
||||
func (*ObjectStoreInitRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{12} }
|
||||
func (*ObjectStoreInitRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{12} }
|
||||
|
||||
func (m *ObjectStoreInitRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -750,9 +750,9 @@ var _ObjectStore_serviceDesc = grpc.ServiceDesc{
|
|||
Metadata: "ObjectStore.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("ObjectStore.proto", fileDescriptor2) }
|
||||
func init() { proto.RegisterFile("ObjectStore.proto", fileDescriptor3) }
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
var fileDescriptor3 = []byte{
|
||||
// 577 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xd6, 0xc6, 0x69, 0x54, 0x4f, 0x22, 0x61, 0xb6, 0x55, 0x30, 0x2e, 0x94, 0xb0, 0x02, 0x29,
|
||||
|
|
|
@ -26,7 +26,7 @@ type PluginIdentifier struct {
|
|||
func (m *PluginIdentifier) Reset() { *m = PluginIdentifier{} }
|
||||
func (m *PluginIdentifier) String() string { return proto.CompactTextString(m) }
|
||||
func (*PluginIdentifier) ProtoMessage() {}
|
||||
func (*PluginIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
|
||||
func (*PluginIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} }
|
||||
|
||||
func (m *PluginIdentifier) GetCommand() string {
|
||||
if m != nil {
|
||||
|
@ -56,7 +56,7 @@ type ListPluginsResponse struct {
|
|||
func (m *ListPluginsResponse) Reset() { *m = ListPluginsResponse{} }
|
||||
func (m *ListPluginsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListPluginsResponse) ProtoMessage() {}
|
||||
func (*ListPluginsResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} }
|
||||
func (*ListPluginsResponse) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} }
|
||||
|
||||
func (m *ListPluginsResponse) GetPlugins() []*PluginIdentifier {
|
||||
if m != nil {
|
||||
|
@ -142,9 +142,9 @@ var _PluginLister_serviceDesc = grpc.ServiceDesc{
|
|||
Metadata: "PluginLister.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("PluginLister.proto", fileDescriptor3) }
|
||||
func init() { proto.RegisterFile("PluginLister.proto", fileDescriptor4) }
|
||||
|
||||
var fileDescriptor3 = []byte{
|
||||
var fileDescriptor4 = []byte{
|
||||
// 201 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x0a, 0xc8, 0x29, 0x4d,
|
||||
0xcf, 0xcc, 0xf3, 0xc9, 0x2c, 0x2e, 0x49, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2,
|
||||
|
|
|
@ -28,7 +28,7 @@ func (m *RestoreItemActionExecuteRequest) Reset() { *m = RestoreItemActi
|
|||
func (m *RestoreItemActionExecuteRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*RestoreItemActionExecuteRequest) ProtoMessage() {}
|
||||
func (*RestoreItemActionExecuteRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor4, []int{0}
|
||||
return fileDescriptor5, []int{0}
|
||||
}
|
||||
|
||||
func (m *RestoreItemActionExecuteRequest) GetPlugin() string {
|
||||
|
@ -69,7 +69,7 @@ func (m *RestoreItemActionExecuteResponse) Reset() { *m = RestoreItemAct
|
|||
func (m *RestoreItemActionExecuteResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*RestoreItemActionExecuteResponse) ProtoMessage() {}
|
||||
func (*RestoreItemActionExecuteResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor4, []int{1}
|
||||
return fileDescriptor5, []int{1}
|
||||
}
|
||||
|
||||
func (m *RestoreItemActionExecuteResponse) GetItem() []byte {
|
||||
|
@ -101,7 +101,7 @@ func (m *RestoreItemActionAppliesToRequest) Reset() { *m = RestoreItemAc
|
|||
func (m *RestoreItemActionAppliesToRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*RestoreItemActionAppliesToRequest) ProtoMessage() {}
|
||||
func (*RestoreItemActionAppliesToRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor4, []int{2}
|
||||
return fileDescriptor5, []int{2}
|
||||
}
|
||||
|
||||
func (m *RestoreItemActionAppliesToRequest) GetPlugin() string {
|
||||
|
@ -119,7 +119,7 @@ func (m *RestoreItemActionAppliesToResponse) Reset() { *m = RestoreItemA
|
|||
func (m *RestoreItemActionAppliesToResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*RestoreItemActionAppliesToResponse) ProtoMessage() {}
|
||||
func (*RestoreItemActionAppliesToResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor4, []int{3}
|
||||
return fileDescriptor5, []int{3}
|
||||
}
|
||||
|
||||
func (m *RestoreItemActionAppliesToResponse) GetResourceSelector() *ResourceSelector {
|
||||
|
@ -241,9 +241,9 @@ var _RestoreItemAction_serviceDesc = grpc.ServiceDesc{
|
|||
Metadata: "RestoreItemAction.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("RestoreItemAction.proto", fileDescriptor4) }
|
||||
func init() { proto.RegisterFile("RestoreItemAction.proto", fileDescriptor5) }
|
||||
|
||||
var fileDescriptor4 = []byte{
|
||||
var fileDescriptor5 = []byte{
|
||||
// 332 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xdd, 0x4e, 0xc2, 0x30,
|
||||
0x14, 0x4e, 0x81, 0x80, 0x1c, 0x88, 0x3f, 0xbd, 0xd0, 0x06, 0x63, 0x9c, 0xbb, 0x30, 0xc4, 0x1f,
|
||||
|
|
|
@ -18,7 +18,7 @@ type Empty struct {
|
|||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{0} }
|
||||
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{0} }
|
||||
|
||||
type Stack struct {
|
||||
Frames []*StackFrame `protobuf:"bytes,1,rep,name=frames" json:"frames,omitempty"`
|
||||
|
@ -27,7 +27,7 @@ type Stack struct {
|
|||
func (m *Stack) Reset() { *m = Stack{} }
|
||||
func (m *Stack) String() string { return proto.CompactTextString(m) }
|
||||
func (*Stack) ProtoMessage() {}
|
||||
func (*Stack) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{1} }
|
||||
func (*Stack) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{1} }
|
||||
|
||||
func (m *Stack) GetFrames() []*StackFrame {
|
||||
if m != nil {
|
||||
|
@ -45,7 +45,7 @@ type StackFrame struct {
|
|||
func (m *StackFrame) Reset() { *m = StackFrame{} }
|
||||
func (m *StackFrame) String() string { return proto.CompactTextString(m) }
|
||||
func (*StackFrame) ProtoMessage() {}
|
||||
func (*StackFrame) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{2} }
|
||||
func (*StackFrame) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{2} }
|
||||
|
||||
func (m *StackFrame) GetFile() string {
|
||||
if m != nil {
|
||||
|
@ -78,7 +78,7 @@ type ResourceIdentifier struct {
|
|||
func (m *ResourceIdentifier) Reset() { *m = ResourceIdentifier{} }
|
||||
func (m *ResourceIdentifier) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResourceIdentifier) ProtoMessage() {}
|
||||
func (*ResourceIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{3} }
|
||||
func (*ResourceIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{3} }
|
||||
|
||||
func (m *ResourceIdentifier) GetGroup() string {
|
||||
if m != nil {
|
||||
|
@ -119,7 +119,7 @@ type ResourceSelector struct {
|
|||
func (m *ResourceSelector) Reset() { *m = ResourceSelector{} }
|
||||
func (m *ResourceSelector) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResourceSelector) ProtoMessage() {}
|
||||
func (*ResourceSelector) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{4} }
|
||||
func (*ResourceSelector) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{4} }
|
||||
|
||||
func (m *ResourceSelector) GetIncludedNamespaces() []string {
|
||||
if m != nil {
|
||||
|
@ -164,9 +164,9 @@ func init() {
|
|||
proto.RegisterType((*ResourceSelector)(nil), "generated.ResourceSelector")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("Shared.proto", fileDescriptor5) }
|
||||
func init() { proto.RegisterFile("Shared.proto", fileDescriptor6) }
|
||||
|
||||
var fileDescriptor5 = []byte{
|
||||
var fileDescriptor6 = []byte{
|
||||
// 294 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x4e, 0xb5, 0x30,
|
||||
0x10, 0x85, 0xc3, 0x05, 0xee, 0xff, 0x33, 0xba, 0xd0, 0x46, 0x93, 0xc6, 0xb8, 0x20, 0xac, 0x58,
|
||||
|
|
|
@ -28,7 +28,7 @@ type CreateVolumeRequest struct {
|
|||
func (m *CreateVolumeRequest) Reset() { *m = CreateVolumeRequest{} }
|
||||
func (m *CreateVolumeRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateVolumeRequest) ProtoMessage() {}
|
||||
func (*CreateVolumeRequest) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{0} }
|
||||
func (*CreateVolumeRequest) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{0} }
|
||||
|
||||
func (m *CreateVolumeRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -72,7 +72,7 @@ type CreateVolumeResponse struct {
|
|||
func (m *CreateVolumeResponse) Reset() { *m = CreateVolumeResponse{} }
|
||||
func (m *CreateVolumeResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateVolumeResponse) ProtoMessage() {}
|
||||
func (*CreateVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{1} }
|
||||
func (*CreateVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{1} }
|
||||
|
||||
func (m *CreateVolumeResponse) GetVolumeID() string {
|
||||
if m != nil {
|
||||
|
@ -90,7 +90,7 @@ type GetVolumeInfoRequest struct {
|
|||
func (m *GetVolumeInfoRequest) Reset() { *m = GetVolumeInfoRequest{} }
|
||||
func (m *GetVolumeInfoRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetVolumeInfoRequest) ProtoMessage() {}
|
||||
func (*GetVolumeInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{2} }
|
||||
func (*GetVolumeInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{2} }
|
||||
|
||||
func (m *GetVolumeInfoRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -121,7 +121,7 @@ type GetVolumeInfoResponse struct {
|
|||
func (m *GetVolumeInfoResponse) Reset() { *m = GetVolumeInfoResponse{} }
|
||||
func (m *GetVolumeInfoResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetVolumeInfoResponse) ProtoMessage() {}
|
||||
func (*GetVolumeInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{3} }
|
||||
func (*GetVolumeInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{3} }
|
||||
|
||||
func (m *GetVolumeInfoResponse) GetVolumeType() string {
|
||||
if m != nil {
|
||||
|
@ -147,7 +147,7 @@ type CreateSnapshotRequest struct {
|
|||
func (m *CreateSnapshotRequest) Reset() { *m = CreateSnapshotRequest{} }
|
||||
func (m *CreateSnapshotRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateSnapshotRequest) ProtoMessage() {}
|
||||
func (*CreateSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{4} }
|
||||
func (*CreateSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{4} }
|
||||
|
||||
func (m *CreateSnapshotRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -184,7 +184,7 @@ type CreateSnapshotResponse struct {
|
|||
func (m *CreateSnapshotResponse) Reset() { *m = CreateSnapshotResponse{} }
|
||||
func (m *CreateSnapshotResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateSnapshotResponse) ProtoMessage() {}
|
||||
func (*CreateSnapshotResponse) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{5} }
|
||||
func (*CreateSnapshotResponse) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{5} }
|
||||
|
||||
func (m *CreateSnapshotResponse) GetSnapshotID() string {
|
||||
if m != nil {
|
||||
|
@ -201,7 +201,7 @@ type DeleteSnapshotRequest struct {
|
|||
func (m *DeleteSnapshotRequest) Reset() { *m = DeleteSnapshotRequest{} }
|
||||
func (m *DeleteSnapshotRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteSnapshotRequest) ProtoMessage() {}
|
||||
func (*DeleteSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{6} }
|
||||
func (*DeleteSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{6} }
|
||||
|
||||
func (m *DeleteSnapshotRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -225,7 +225,7 @@ type GetVolumeIDRequest struct {
|
|||
func (m *GetVolumeIDRequest) Reset() { *m = GetVolumeIDRequest{} }
|
||||
func (m *GetVolumeIDRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetVolumeIDRequest) ProtoMessage() {}
|
||||
func (*GetVolumeIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{7} }
|
||||
func (*GetVolumeIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{7} }
|
||||
|
||||
func (m *GetVolumeIDRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -248,7 +248,7 @@ type GetVolumeIDResponse struct {
|
|||
func (m *GetVolumeIDResponse) Reset() { *m = GetVolumeIDResponse{} }
|
||||
func (m *GetVolumeIDResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetVolumeIDResponse) ProtoMessage() {}
|
||||
func (*GetVolumeIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{8} }
|
||||
func (*GetVolumeIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{8} }
|
||||
|
||||
func (m *GetVolumeIDResponse) GetVolumeID() string {
|
||||
if m != nil {
|
||||
|
@ -266,7 +266,7 @@ type SetVolumeIDRequest struct {
|
|||
func (m *SetVolumeIDRequest) Reset() { *m = SetVolumeIDRequest{} }
|
||||
func (m *SetVolumeIDRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetVolumeIDRequest) ProtoMessage() {}
|
||||
func (*SetVolumeIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{9} }
|
||||
func (*SetVolumeIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{9} }
|
||||
|
||||
func (m *SetVolumeIDRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -296,7 +296,7 @@ type SetVolumeIDResponse struct {
|
|||
func (m *SetVolumeIDResponse) Reset() { *m = SetVolumeIDResponse{} }
|
||||
func (m *SetVolumeIDResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetVolumeIDResponse) ProtoMessage() {}
|
||||
func (*SetVolumeIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{10} }
|
||||
func (*SetVolumeIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{10} }
|
||||
|
||||
func (m *SetVolumeIDResponse) GetPersistentVolume() []byte {
|
||||
if m != nil {
|
||||
|
@ -313,7 +313,7 @@ type VolumeSnapshotterInitRequest struct {
|
|||
func (m *VolumeSnapshotterInitRequest) Reset() { *m = VolumeSnapshotterInitRequest{} }
|
||||
func (m *VolumeSnapshotterInitRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeSnapshotterInitRequest) ProtoMessage() {}
|
||||
func (*VolumeSnapshotterInitRequest) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{11} }
|
||||
func (*VolumeSnapshotterInitRequest) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{11} }
|
||||
|
||||
func (m *VolumeSnapshotterInitRequest) GetPlugin() string {
|
||||
if m != nil {
|
||||
|
@ -614,9 +614,9 @@ var _VolumeSnapshotter_serviceDesc = grpc.ServiceDesc{
|
|||
Metadata: "VolumeSnapshotter.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("VolumeSnapshotter.proto", fileDescriptor6) }
|
||||
func init() { proto.RegisterFile("VolumeSnapshotter.proto", fileDescriptor7) }
|
||||
|
||||
var fileDescriptor6 = []byte{
|
||||
var fileDescriptor7 = []byte{
|
||||
// 566 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xc1, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xd5, 0xda, 0x6e, 0x44, 0x26, 0xa5, 0x0a, 0x9b, 0xa4, 0x58, 0x16, 0x04, 0xe3, 0x0b, 0x51,
|
||||
|
|
|
@ -5,6 +5,7 @@ package mocks
|
|||
import (
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
velero "github.com/vmware-tanzu/velero/pkg/plugin/velero"
|
||||
isv1 "github.com/vmware-tanzu/velero/pkg/plugin/velero/item_snapshotter/v1"
|
||||
)
|
||||
|
||||
// Manager is an autogenerated mock type for the Manager type
|
||||
|
@ -200,3 +201,48 @@ func (_m *Manager) GetVolumeSnapshotter(name string) (velero.VolumeSnapshotter,
|
|||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetItemSnapshotter provides a mock function with given fields: name
|
||||
func (_m *Manager) GetItemSnapshotter(name string) (isv1.ItemSnapshotter, error) {
|
||||
ret := _m.Called(name)
|
||||
|
||||
var r0 isv1.ItemSnapshotter
|
||||
if rf, ok := ret.Get(0).(func(string) isv1.ItemSnapshotter); ok {
|
||||
r0 = rf(name)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(isv1.ItemSnapshotter)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(name)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
// GetItemSnapshotters provides a mock function with given fields:
|
||||
func (_m *Manager) GetItemSnapshotters() ([]isv1.ItemSnapshotter, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 []isv1.ItemSnapshotter
|
||||
if rf, ok := ret.Get(0).(func() []isv1.ItemSnapshotter); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]isv1.ItemSnapshotter)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
syntax = "proto3";
|
||||
package generated;
|
||||
|
||||
import "Shared.proto";
|
||||
|
||||
message ItemSnapshotterAppliesToRequest {
|
||||
string plugin = 1;
|
||||
}
|
||||
|
||||
message ItemSnapshotterAppliesToResponse {
|
||||
ResourceSelector ResourceSelector = 1;
|
||||
}
|
||||
|
||||
message AlsoHandlesRequest {
|
||||
string plugin = 1;
|
||||
bytes item = 2;
|
||||
bytes backup = 3;
|
||||
}
|
||||
|
||||
message AlsoHandlesResponse {
|
||||
repeated ResourceIdentifier handledItems = 1;
|
||||
}
|
||||
|
||||
message SnapshotItemRequest {
|
||||
string plugin = 1;
|
||||
bytes item = 2;
|
||||
map<string, string> params = 3;
|
||||
bytes backup = 4;
|
||||
}
|
||||
|
||||
message SnapshotItemResponse {
|
||||
bytes item = 1;
|
||||
string snapshotID = 2;
|
||||
map<string, string> snapshotMetadata = 3;
|
||||
repeated ResourceIdentifier additionalItems = 4;
|
||||
repeated ResourceIdentifier handledItems = 5;
|
||||
}
|
||||
|
||||
message ProgressRequest {
|
||||
string plugin = 1;
|
||||
ResourceIdentifier itemID = 2;
|
||||
string snapshotID = 3;
|
||||
bytes backup = 4;
|
||||
}
|
||||
|
||||
message ProgressResponse {
|
||||
string phase = 1;
|
||||
int64 itemsCompleted = 2;
|
||||
int64 itemsToComplete = 3;
|
||||
int64 started = 4;
|
||||
int64 startedNano = 5;
|
||||
int64 updated = 6;
|
||||
int64 updatedNano = 7;
|
||||
string err = 8;
|
||||
}
|
||||
|
||||
message DeleteItemSnapshotRequest {
|
||||
string plugin = 1;
|
||||
string snapshotID = 2;
|
||||
bytes itemFromBackup = 3;
|
||||
map<string, string> metadata = 4;
|
||||
map<string, string> params = 5;
|
||||
}
|
||||
|
||||
message CreateItemFromSnapshotRequest {
|
||||
string plugin = 1;
|
||||
bytes item = 2;
|
||||
string snapshotID = 3;
|
||||
bytes itemFromBackup = 4;
|
||||
map<string, string> snapshotMetadata = 5;
|
||||
map<string, string> params = 6;
|
||||
bytes restore = 7;
|
||||
}
|
||||
|
||||
message CreateItemFromSnapshotResponse {
|
||||
bytes item = 1;
|
||||
repeated ResourceIdentifier additionalItems = 2;
|
||||
bool skipRestore = 3;
|
||||
}
|
||||
|
||||
message ItemSnapshotterInitRequest {
|
||||
string plugin = 1;
|
||||
map<string, string> config = 2;
|
||||
}
|
||||
|
||||
service ItemSnapshotter {
|
||||
rpc Init(ItemSnapshotterInitRequest) returns (Empty);
|
||||
rpc AppliesTo(ItemSnapshotterAppliesToRequest) returns (ItemSnapshotterAppliesToResponse);
|
||||
rpc AlsoHandles(AlsoHandlesRequest) returns (AlsoHandlesResponse);
|
||||
rpc SnapshotItem(SnapshotItemRequest) returns (SnapshotItemResponse);
|
||||
rpc Progress(ProgressRequest) returns (ProgressResponse);
|
||||
rpc DeleteSnapshot(DeleteItemSnapshotRequest) returns (Empty);
|
||||
rpc CreateItemFromSnapshot(CreateItemFromSnapshotRequest) returns (CreateItemFromSnapshotResponse);
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
)
|
||||
|
||||
type AlsoHandlesInput struct {
|
||||
// Item is the item that will be snapshotted
|
||||
Item runtime.Unstructured
|
||||
// Backup is the representation of the backup resource being processed by Velero.
|
||||
Backup *api.Backup
|
||||
}
|
||||
|
||||
type SnapshotItemInput struct {
|
||||
// Item is the item to snapshot
|
||||
Item runtime.Unstructured
|
||||
// Params are parameters to the snapshot
|
||||
Params map[string]string
|
||||
// Backup is the representation of the backup resource being processed by Velero.
|
||||
Backup *api.Backup
|
||||
}
|
||||
|
||||
type SnapshotItemOutput struct {
|
||||
// UpdatedItem is the Item that should be included in the backup. It can optionally be modified during the Snapshot
|
||||
UpdatedItem runtime.Unstructured
|
||||
// SnapshotID identifies the snapshot that was taken
|
||||
SnapshotID string
|
||||
// SnapshotMetadata is information in addition to the SnapshotID that the
|
||||
// plugin wants to store in the backup. SnapshotMetadata will be passed
|
||||
// back in for DeleteSnapshot and CreateItemFromSnapshot
|
||||
SnapshotMetadata map[string]string
|
||||
// AdditionalItems are resources that need to be included in the backup to support this snapshhot
|
||||
AdditionalItems []velero.ResourceIdentifier
|
||||
// Items that were handled by this snapshot that should be excluded from the backup
|
||||
HandledItems []velero.ResourceIdentifier
|
||||
}
|
||||
|
||||
// ProgressInput contains the input parameters for the ItemSnapshotter's Progress function.
|
||||
type ProgressInput struct {
|
||||
// ItemID is the id of item that was stored in the backup
|
||||
ItemID velero.ResourceIdentifier
|
||||
// SnapshotID is the snapshot ID returned by ItemSnapshotter
|
||||
SnapshotID string
|
||||
// Backup is the representation of the backup resource being processed by Velero.
|
||||
Backup *api.Backup
|
||||
}
|
||||
|
||||
// SnapshotPhase is the lifecycle phase of a Velero item snapshot.
|
||||
type SnapshotPhase string
|
||||
|
||||
const (
|
||||
// SnapshotPhaseInProgress means the snapshot of the item has been taken and the point-in-time has been preserved,
|
||||
// but the snapshot is not ready for use yet
|
||||
SnapshotPhaseInProgress = SnapshotPhase("InProgress")
|
||||
|
||||
// SnapshotPhaseCompleted means the item snapshot was successfully created and can be restored from
|
||||
SnapshotPhaseCompleted = SnapshotPhase("Completed")
|
||||
|
||||
// SnapshotPhaseFailed means the item snapshot was unable to be completed
|
||||
SnapshotPhaseFailed = SnapshotPhase("Failed")
|
||||
)
|
||||
|
||||
func SnapshotPhaseFromString(phase string) (SnapshotPhase, error) {
|
||||
switch phase {
|
||||
case string(SnapshotPhaseInProgress):
|
||||
return SnapshotPhaseInProgress, nil
|
||||
case string(SnapshotPhaseCompleted):
|
||||
return SnapshotPhaseCompleted, nil
|
||||
case string(SnapshotPhaseFailed):
|
||||
return SnapshotPhaseFailed, nil
|
||||
default:
|
||||
return SnapshotPhase(""), fmt.Errorf("%s is not a valid SnapshotPhase", phase)
|
||||
}
|
||||
}
|
||||
|
||||
type ProgressOutput struct {
|
||||
// Phase of the snapshot. If the phase is SnapshotPhaseFailed, the error will be in the Err string
|
||||
Phase SnapshotPhase
|
||||
// Err is a message about the error(s) that occurred during the processing of the snapshot
|
||||
Err string
|
||||
// ItemsCompleted is the number of items that have been completed in processing of the snapshot
|
||||
// This is simply to show progress, when Phase goes to SnapshotPhaseCompleted ItemsCompleted and ItemsToComplete
|
||||
// should be the same. This could be blocks to copy, files to copy, or anything else.
|
||||
ItemsCompleted int64
|
||||
// ItemsToComplete is the number of items that need to be completed
|
||||
ItemsToComplete int64
|
||||
// Started indicates when processing on the snapshot began (usually the time the snapshot was taken)
|
||||
Started time.Time
|
||||
// Updated indicates the time the status was last updated. Time 0 (time.Unix(0, 0)) is returned if unknown.
|
||||
Updated time.Time
|
||||
}
|
||||
|
||||
type DeleteSnapshotInput struct {
|
||||
// SnapshotID is the snapshot to delete
|
||||
SnapshotID string
|
||||
// ItemFromBackup is the resource that was included in the backup
|
||||
ItemFromBackup runtime.Unstructured
|
||||
// SnapshotMetadata is the metadata that was returned when the snapshot was originally taken
|
||||
SnapshotMetadata map[string]string
|
||||
// Params are parameters to the deletion
|
||||
Params map[string]string
|
||||
}
|
||||
|
||||
type CreateItemInput struct {
|
||||
// The snapshotted item at this stage of the restore (RestoreItemActions may
|
||||
// have modified the item prior to CreateItemFromSnapshot being called)
|
||||
SnapshottedItem runtime.Unstructured
|
||||
// SnapshotID is the snapshot to create the item from
|
||||
SnapshotID string
|
||||
// ItemFromBackup is the snapshotted item that was stored in the backup
|
||||
ItemFromBackup runtime.Unstructured
|
||||
// SnapshotMetadata is the metadata that was returned when the snapshot was originally taken
|
||||
SnapshotMetadata map[string]string
|
||||
// Params are parameters to the deletion
|
||||
Params map[string]string
|
||||
// Restore is the representation of the restore resource being processed by Velero.
|
||||
Restore *api.Restore
|
||||
}
|
||||
|
||||
type CreateItemOutput struct {
|
||||
// UpdatedItem is the item being restored mutated by ItemAction.
|
||||
UpdatedItem runtime.Unstructured
|
||||
|
||||
// AdditionalItems is a list of additional related items that should
|
||||
// be restored.
|
||||
AdditionalItems []velero.ResourceIdentifier
|
||||
|
||||
// SkipRestore tells velero to stop executing further actions
|
||||
// on this item, and skip the restore step. When this field's
|
||||
// value is true, AdditionalItems will be ignored.
|
||||
SkipRestore bool
|
||||
}
|
||||
|
||||
// ItemSnapshotter handles snapshots on an individual item being backed up.
|
||||
type ItemSnapshotter interface {
|
||||
|
||||
// Init prepares the ItemSnapshotter for usage using the provided map of
|
||||
// configuration key-value pairs. It returns an error if the ItemSnapshotter
|
||||
// cannot be initialized from the provided config.
|
||||
Init(config map[string]string) error
|
||||
|
||||
// AppliesTo returns information about which resources this action should be invoked for.
|
||||
// An ItemSnapshotter's SnapshotItem method will only be invoked on items that match the returned
|
||||
// selector. A zero-valued ResourceSelector matches all resources.
|
||||
AppliesTo() (velero.ResourceSelector, error)
|
||||
|
||||
// AlsoHandles is called for each item this ItemSnapshotter should handle and returns any items
|
||||
// which will be handled by this plugin when snapshotting the item. These items will be excluded from the
|
||||
// items being backed up. AlsoHandles will be called before SnapshotItem is called. For example, a database may expose
|
||||
// a database resource that can be snapshotted. If the database uses a PVC that will be snapshotted/backed up as
|
||||
// part of the database snapshot, that PVC should be returned when AlsoHandles is invoked. This is different from
|
||||
// AdditionalItems (returned in SnapshotItemOutput and CreateItemOutput) which are specifying additional resources
|
||||
// that Velero should store in the backup or create.
|
||||
AlsoHandles(input *AlsoHandlesInput) ([]velero.ResourceIdentifier, error)
|
||||
|
||||
// SnapshotItem causes the ItemSnapshotter to snapshot the specified item. It may also
|
||||
// perform arbitrary logic with the item being backed up, including mutating the item itself prior to backup.
|
||||
// The item (unmodified or modified) should be returned, along with an optional slice of ResourceIdentifiers specifying
|
||||
// additional related items that should be backed up.
|
||||
// A caller can pass a context that includes a timeout. If the time to take the snapshot exceeds the
|
||||
// time in the context, the plugin may abort the snapshot. The context timeout does not apply to upload
|
||||
// time that occurs after SnapshotItem returns
|
||||
SnapshotItem(ctx context.Context, input *SnapshotItemInput) (*SnapshotItemOutput, error)
|
||||
|
||||
// Progress will return the progress of a snapshot that is being uploaded
|
||||
Progress(input *ProgressInput) (*ProgressOutput, error)
|
||||
|
||||
// DeleteSnapshot removes a snapshot
|
||||
DeleteSnapshot(ctx context.Context, input *DeleteSnapshotInput) error
|
||||
|
||||
// CreateItemFromSnapshot creates a new item from the snapshot
|
||||
CreateItemFromSnapshot(ctx context.Context, input *CreateItemInput) (*CreateItemOutput, error)
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
context "context"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
v1 "github.com/vmware-tanzu/velero/pkg/plugin/velero/item_snapshotter/v1"
|
||||
|
||||
velero "github.com/vmware-tanzu/velero/pkg/plugin/velero"
|
||||
)
|
||||
|
||||
// ItemSnapshotter is an autogenerated mock type for the ItemSnapshotter type
|
||||
type ItemSnapshotter struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// AlsoHandles provides a mock function with given fields: input
|
||||
func (_m *ItemSnapshotter) AlsoHandles(input *v1.AlsoHandlesInput) ([]velero.ResourceIdentifier, error) {
|
||||
ret := _m.Called(input)
|
||||
|
||||
var r0 []velero.ResourceIdentifier
|
||||
if rf, ok := ret.Get(0).(func(*v1.AlsoHandlesInput) []velero.ResourceIdentifier); ok {
|
||||
r0 = rf(input)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]velero.ResourceIdentifier)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(*v1.AlsoHandlesInput) error); ok {
|
||||
r1 = rf(input)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// AppliesTo provides a mock function with given fields:
|
||||
func (_m *ItemSnapshotter) AppliesTo() (velero.ResourceSelector, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 velero.ResourceSelector
|
||||
if rf, ok := ret.Get(0).(func() velero.ResourceSelector); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(velero.ResourceSelector)
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CreateItemFromSnapshot provides a mock function with given fields: ctx, input
|
||||
func (_m *ItemSnapshotter) CreateItemFromSnapshot(ctx context.Context, input *v1.CreateItemInput) (*v1.CreateItemOutput, error) {
|
||||
ret := _m.Called(ctx, input)
|
||||
|
||||
var r0 *v1.CreateItemOutput
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *v1.CreateItemInput) *v1.CreateItemOutput); ok {
|
||||
r0 = rf(ctx, input)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.CreateItemOutput)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, *v1.CreateItemInput) error); ok {
|
||||
r1 = rf(ctx, input)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// DeleteSnapshot provides a mock function with given fields: ctx, input
|
||||
func (_m *ItemSnapshotter) DeleteSnapshot(ctx context.Context, input *v1.DeleteSnapshotInput) error {
|
||||
ret := _m.Called(ctx, input)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteSnapshotInput) error); ok {
|
||||
r0 = rf(ctx, input)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Init provides a mock function with given fields: config
|
||||
func (_m *ItemSnapshotter) Init(config map[string]string) error {
|
||||
ret := _m.Called(config)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(map[string]string) error); ok {
|
||||
r0 = rf(config)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Progress provides a mock function with given fields: input
|
||||
func (_m *ItemSnapshotter) Progress(input *v1.ProgressInput) (*v1.ProgressOutput, error) {
|
||||
ret := _m.Called(input)
|
||||
|
||||
var r0 *v1.ProgressOutput
|
||||
if rf, ok := ret.Get(0).(func(*v1.ProgressInput) *v1.ProgressOutput); ok {
|
||||
r0 = rf(input)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.ProgressOutput)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(*v1.ProgressInput) error); ok {
|
||||
r1 = rf(input)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// SnapshotItem provides a mock function with given fields: ctx, input
|
||||
func (_m *ItemSnapshotter) SnapshotItem(ctx context.Context, input *v1.SnapshotItemInput) (*v1.SnapshotItemOutput, error) {
|
||||
ret := _m.Called(ctx, input)
|
||||
|
||||
var r0 *v1.SnapshotItemOutput
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *v1.SnapshotItemInput) *v1.SnapshotItemOutput); ok {
|
||||
r0 = rf(ctx, input)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.SnapshotItemOutput)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, *v1.SnapshotItemInput) error); ok {
|
||||
r1 = rf(ctx, input)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
|
@ -54,10 +54,14 @@ You will need to give your plugin(s) the full name when registering them by call
|
|||
Velero supports the following kinds of plugins:
|
||||
|
||||
- **Object Store** - persists and retrieves backups, backup logs and restore logs
|
||||
- **Volume Snapshotter** - creates volume snapshots (during backup) and restores volumes from snapshots (during restore)
|
||||
- **Item Snapshotter** - creates snapshots for Kubernetes objects during backup and restores the object from snapshots during restore. ItemSnapshotters
|
||||
are typically used with the [Astrolabe](https://github.com/vmware-tanzu/astrolabe) framework.
|
||||
- **Backup Item Action** - executes arbitrary logic for individual items prior to storing them in a backup file
|
||||
- **Restore Item Action** - executes arbitrary logic for individual items prior to restoring them into a cluster
|
||||
- **Delete Item Action** - executes arbitrary logic based on individual items within a backup prior to deleting the backup
|
||||
## Deprecated plugin kinds
|
||||
- **Volume Snapshotter** - creates volume snapshots (during backup) and restores volumes from snapshots (during restore) VolumeSnapshotters
|
||||
are deprecated and will be replaced with ItemSnapshotter/Astrolabe plugins.
|
||||
|
||||
## Plugin Logging
|
||||
|
||||
|
|
Loading…
Reference in New Issue