mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-06 05:25:40 +00:00
Refactor protobuf (#1354)
* Update protobuffs Signed-off-by: Carlisia <carlisiac@vmware.com>
This commit is contained in:
committed by
Nolan Brubaker
parent
956152d6e1
commit
13eaad0e64
@@ -53,7 +53,7 @@ func newBackupItemActionGRPCClient(base *clientBase, clientConn *grpc.ClientConn
|
||||
}
|
||||
|
||||
func (c *BackupItemActionGRPCClient) AppliesTo() (velero.ResourceSelector, error) {
|
||||
req := &proto.AppliesToRequest{
|
||||
req := &proto.BackupItemActionAppliesToRequest{
|
||||
Plugin: c.plugin,
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ func (c *BackupItemActionGRPCClient) AppliesTo() (velero.ResourceSelector, error
|
||||
}
|
||||
|
||||
return velero.ResourceSelector{
|
||||
IncludedNamespaces: res.IncludedNamespaces,
|
||||
ExcludedNamespaces: res.ExcludedNamespaces,
|
||||
IncludedResources: res.IncludedResources,
|
||||
ExcludedResources: res.ExcludedResources,
|
||||
LabelSelector: res.Selector,
|
||||
IncludedNamespaces: res.ResourceSelector.IncludedNamespaces,
|
||||
ExcludedNamespaces: res.ResourceSelector.ExcludedNamespaces,
|
||||
IncludedResources: res.ResourceSelector.IncludedResources,
|
||||
ExcludedResources: res.ResourceSelector.ExcludedResources,
|
||||
LabelSelector: res.ResourceSelector.Selector,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func (s *BackupItemActionGRPCServer) getImpl(name string) (velero.BackupItemActi
|
||||
return itemAction, nil
|
||||
}
|
||||
|
||||
func (s *BackupItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.AppliesToRequest) (response *proto.AppliesToResponse, err error) {
|
||||
func (s *BackupItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.BackupItemActionAppliesToRequest) (response *proto.BackupItemActionAppliesToResponse, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
@@ -65,12 +65,14 @@ func (s *BackupItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.A
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
return &proto.AppliesToResponse{
|
||||
IncludedNamespaces: resourceSelector.IncludedNamespaces,
|
||||
ExcludedNamespaces: resourceSelector.ExcludedNamespaces,
|
||||
IncludedResources: resourceSelector.IncludedResources,
|
||||
ExcludedResources: resourceSelector.ExcludedResources,
|
||||
Selector: resourceSelector.LabelSelector,
|
||||
return &proto.BackupItemActionAppliesToResponse{
|
||||
&proto.ResourceSelector{
|
||||
IncludedNamespaces: resourceSelector.IncludedNamespaces,
|
||||
ExcludedNamespaces: resourceSelector.ExcludedNamespaces,
|
||||
IncludedResources: resourceSelector.IncludedResources,
|
||||
ExcludedResources: resourceSelector.ExcludedResources,
|
||||
Selector: resourceSelector.LabelSelector,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ func newObjectStoreGRPCClient(base *clientBase, clientConn *grpc.ClientConn) int
|
||||
// configuration key-value pairs. It returns an error if the ObjectStore
|
||||
// cannot be initialized from the provided config.
|
||||
func (c *ObjectStoreGRPCClient) Init(config map[string]string) error {
|
||||
req := &proto.InitRequest{
|
||||
req := &proto.ObjectStoreInitRequest{
|
||||
Plugin: c.plugin,
|
||||
Config: config,
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func (s *ObjectStoreGRPCServer) getImpl(name string) (velero.ObjectStore, error)
|
||||
// Init prepares the ObjectStore for usage using the provided map of
|
||||
// configuration key-value pairs. It returns an error if the ObjectStore
|
||||
// cannot be initialized from the provided config.
|
||||
func (s *ObjectStoreGRPCServer) Init(ctx context.Context, req *proto.InitRequest) (response *proto.Empty, err error) {
|
||||
func (s *ObjectStoreGRPCServer) Init(ctx context.Context, req *proto.ObjectStoreInitRequest) (response *proto.Empty, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
|
||||
@@ -53,17 +53,17 @@ func newRestoreItemActionGRPCClient(base *clientBase, clientConn *grpc.ClientCon
|
||||
}
|
||||
|
||||
func (c *RestoreItemActionGRPCClient) AppliesTo() (velero.ResourceSelector, error) {
|
||||
res, err := c.grpcClient.AppliesTo(context.Background(), &proto.AppliesToRequest{Plugin: c.plugin})
|
||||
res, err := c.grpcClient.AppliesTo(context.Background(), &proto.RestoreItemActionAppliesToRequest{Plugin: c.plugin})
|
||||
if err != nil {
|
||||
return velero.ResourceSelector{}, fromGRPCError(err)
|
||||
}
|
||||
|
||||
return velero.ResourceSelector{
|
||||
IncludedNamespaces: res.IncludedNamespaces,
|
||||
ExcludedNamespaces: res.ExcludedNamespaces,
|
||||
IncludedResources: res.IncludedResources,
|
||||
ExcludedResources: res.ExcludedResources,
|
||||
LabelSelector: res.Selector,
|
||||
IncludedNamespaces: res.ResourceSelector.IncludedNamespaces,
|
||||
ExcludedNamespaces: res.ResourceSelector.ExcludedNamespaces,
|
||||
IncludedResources: res.ResourceSelector.IncludedResources,
|
||||
ExcludedResources: res.ResourceSelector.ExcludedResources,
|
||||
LabelSelector: res.ResourceSelector.Selector,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func (s *RestoreItemActionGRPCServer) getImpl(name string) (velero.RestoreItemAc
|
||||
return itemAction, nil
|
||||
}
|
||||
|
||||
func (s *RestoreItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.AppliesToRequest) (response *proto.AppliesToResponse, err error) {
|
||||
func (s *RestoreItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.RestoreItemActionAppliesToRequest) (response *proto.RestoreItemActionAppliesToResponse, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
@@ -60,17 +60,19 @@ func (s *RestoreItemActionGRPCServer) AppliesTo(ctx context.Context, req *proto.
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
appliesTo, err := impl.AppliesTo()
|
||||
resourceSelector, err := impl.AppliesTo()
|
||||
if err != nil {
|
||||
return nil, newGRPCError(err)
|
||||
}
|
||||
|
||||
return &proto.AppliesToResponse{
|
||||
IncludedNamespaces: appliesTo.IncludedNamespaces,
|
||||
ExcludedNamespaces: appliesTo.ExcludedNamespaces,
|
||||
IncludedResources: appliesTo.IncludedResources,
|
||||
ExcludedResources: appliesTo.ExcludedResources,
|
||||
Selector: appliesTo.LabelSelector,
|
||||
return &proto.RestoreItemActionAppliesToResponse{
|
||||
&proto.ResourceSelector{
|
||||
IncludedNamespaces: resourceSelector.IncludedNamespaces,
|
||||
ExcludedNamespaces: resourceSelector.ExcludedNamespaces,
|
||||
IncludedResources: resourceSelector.IncludedResources,
|
||||
ExcludedResources: resourceSelector.ExcludedResources,
|
||||
Selector: resourceSelector.LabelSelector,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ func newVolumeSnapshotterGRPCClient(base *clientBase, clientConn *grpc.ClientCon
|
||||
// configuration key-value pairs. It returns an error if the VolumeSnapshotter
|
||||
// cannot be initialized from the provided config.
|
||||
func (c *VolumeSnapshotterGRPCClient) Init(config map[string]string) error {
|
||||
req := &proto.InitRequest{
|
||||
req := &proto.VolumeSnapshotterInitRequest{
|
||||
Plugin: c.plugin,
|
||||
Config: config,
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func (s *VolumeSnapshotterGRPCServer) getImpl(name string) (velero.VolumeSnapsho
|
||||
// Init prepares the VolumeSnapshotter for usage using the provided map of
|
||||
// configuration key-value pairs. It returns an error if the VolumeSnapshotter
|
||||
// cannot be initialized from the provided config.
|
||||
func (s *VolumeSnapshotterGRPCServer) Init(ctx context.Context, req *proto.InitRequest) (response *proto.Empty, err error) {
|
||||
func (s *VolumeSnapshotterGRPCServer) Init(ctx context.Context, req *proto.VolumeSnapshotterInitRequest) (response *proto.Empty, err error) {
|
||||
defer func() {
|
||||
if recoveredErr := handlePanic(recover()); recoveredErr != nil {
|
||||
err = recoveredErr
|
||||
|
||||
Reference in New Issue
Block a user