feat(proto): storage bucket plugin grpc definitions (#252)

pull/3251/head
Damian Debkowski 3 years ago committed by Timothy Messier
parent 658bb27eeb
commit 79eea06dd7
No known key found for this signature in database
GPG Key ID: EFD2F184F7600572

@ -0,0 +1,29 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
package controller.api.resources.storagebuckets.v1;
import "controller/custom_options/v1/options.proto";
import "google/protobuf/struct.proto";
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/storagebuckets;storagebuckets";
// TODO: this definition is not complete and
// is empty because the message is being used in
// plugin/v1/storage_plugin_service.proto
// StorageBucket manages external object stores
message StorageBucket {
// The name of the resource that is managed by an external object store service.
string bucket_name = 10; // @gotags: `class:"public"`
// The prefix used to organize the data held within the external object store.
string bucket_prefix = 20; // @gotags: `class:"public"`
// Attributes specific to the storage bucket type.
google.protobuf.Struct attributes = 30 [(custom_options.v1.generate_sdk_option) = true]; // @gotags: `class:"public"`
// Secrets specific to the storage bucket type. These are never output.
google.protobuf.Struct secrets = 40 [(custom_options.v1.generate_sdk_option) = true];
}

@ -0,0 +1,122 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
package plugin.v1;
import "controller/api/resources/storagebuckets/v1/storage_bucket.proto";
import "google/protobuf/struct.proto";
option go_package = "github.com/hashicorp/boundary/sdk/pbs/plugin;plugin";
// StoragePluginService describes the service for storage bucket plugins.
service StoragePluginService {
// OnCreateStorageBucket is a hook that runs when a
// storage bucket is created.
rpc OnCreateStorageBucket(OnCreateStorageBucketRequest) returns (OnCreateStorageBucketResponse);
// OnUpdateStorageBucket is a hook that runs when a storage bucket is
// updated.
rpc OnUpdateStorageBucket(OnUpdateStorageBucketRequest) returns (OnUpdateStorageBucketResponse);
// OnDeleteStorageBucket is a hook that runs when a storage bucket is
// deleted.
rpc OnDeleteStorageBucket(OnDeleteStorageBucketRequest) returns (OnDeleteStorageBucketResponse);
// GetObject is a hook that retrieves objects.
rpc GetObject(GetObjectRequest) returns (stream GetObjectResponse);
// PutObject is a hook that streams chunks of a file to be stored
// in an external object store.
rpc PutObject(stream PutObjectRequest) returns (PutObjectResponse);
}
message OnCreateStorageBucketRequest {
// Required. The storage bucket to create. The request may contain optional
// secret data to help authenticate the request against a cloud
// API.
controller.api.resources.storagebuckets.v1.StorageBucket bucket = 10;
}
message OnCreateStorageBucketResponse {
// The persisted data represents state persisted between storage bucket calls.
StorageBucketPersisted persisted = 10;
}
message OnUpdateStorageBucketRequest {
// Required. The existing state of the storage bucket.
controller.api.resources.storagebuckets.v1.StorageBucket current_bucket = 10;
// Required. The requested new state of the storage bucket.
// This field may contain optional secret data that has been
// updated from the last returned persisted state.
controller.api.resources.storagebuckets.v1.StorageBucket new_bucket = 20;
// Required. The existing persisted secret data.
StorageBucketPersisted persisted = 30;
}
message OnUpdateStorageBucketResponse {
// The persisted data represents state persisted between storage bucket calls.
StorageBucketPersisted persisted = 10;
}
message OnDeleteStorageBucketRequest {
// Required. The existing state of the storage bucket to delete.
controller.api.resources.storagebuckets.v1.StorageBucket bucket = 10;
// Required. The existing persisted secret data.
StorageBucketPersisted persisted = 20;
}
message OnDeleteStorageBucketResponse {}
message GetObjectRequest {
// Required. The existing state of the storage bucket.
controller.api.resources.storagebuckets.v1.StorageBucket bucket = 10;
// Required. The path of the object.
string key = 20;
}
message GetObjectResponse {
// Object data.
bytes file_chunk = 10;
}
message PutObjectMetadata {
// Required. The existing state of the storage bucket.
controller.api.resources.storagebuckets.v1.StorageBucket bucket = 10;
// Required. The path of the object.
string key = 20;
}
message PutObjectRequest {
oneof data {
// Object data.
// Recommended chunk size should be between 16KiB to 64KiB.
bytes file_chunk = 10;
PutObjectMetadata request = 20;
}
}
message PutObjectResponse {
// 256-bit SHA-256 digest of the object.
bytes checksum_sha_256 = 10;
}
// StorageBucketPersisted is data that the plugin can read from and write
// to that will always be provided by the host.
message StorageBucketPersisted {
// Data has no explicit structure other than valid json.
// Data may contain sensitive information, such as
// credentials, rotated secrets, or configuration data.
// Data can be anything that may need to be provided to
// a series of different method calls.
// Data is encrypted at-rest by Boundary.
// Data is never returned to the end user.
google.protobuf.Struct data = 10;
}

@ -0,0 +1,207 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: controller/api/resources/storagebuckets/v1/storage_bucket.proto
package storagebuckets
import (
_ "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
structpb "google.golang.org/protobuf/types/known/structpb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// TODO: this definition is not complete and
// is empty because the message is being used in
// plugin/v1/storage_plugin_service.proto
// StorageBucket manages external object stores
type StorageBucket struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The name of the resource that is managed by an external object store service.
BucketName string `protobuf:"bytes,10,opt,name=bucket_name,json=bucketName,proto3" json:"bucket_name,omitempty"` // @gotags: `class:"public"`
// The prefix used to organize the data held within the external object store.
BucketPrefix string `protobuf:"bytes,20,opt,name=bucket_prefix,json=bucketPrefix,proto3" json:"bucket_prefix,omitempty"` // @gotags: `class:"public"`
// Attributes specific to the storage bucket type.
Attributes *structpb.Struct `protobuf:"bytes,30,opt,name=attributes,proto3" json:"attributes,omitempty"` // @gotags: `class:"public"`
// Secrets specific to the storage bucket type. These are never output.
Secrets *structpb.Struct `protobuf:"bytes,40,opt,name=secrets,proto3" json:"secrets,omitempty"`
}
func (x *StorageBucket) Reset() {
*x = StorageBucket{}
if protoimpl.UnsafeEnabled {
mi := &file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StorageBucket) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StorageBucket) ProtoMessage() {}
func (x *StorageBucket) ProtoReflect() protoreflect.Message {
mi := &file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StorageBucket.ProtoReflect.Descriptor instead.
func (*StorageBucket) Descriptor() ([]byte, []int) {
return file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDescGZIP(), []int{0}
}
func (x *StorageBucket) GetBucketName() string {
if x != nil {
return x.BucketName
}
return ""
}
func (x *StorageBucket) GetBucketPrefix() string {
if x != nil {
return x.BucketPrefix
}
return ""
}
func (x *StorageBucket) GetAttributes() *structpb.Struct {
if x != nil {
return x.Attributes
}
return nil
}
func (x *StorageBucket) GetSecrets() *structpb.Struct {
if x != nil {
return x.Secrets
}
return nil
}
var File_controller_api_resources_storagebuckets_v1_storage_bucket_proto protoreflect.FileDescriptor
var file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDesc = []byte{
0x0a, 0x3f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69,
0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61,
0x67, 0x65, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x6f,
0x72, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72,
0x61, 0x67, 0x65, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x2a, 0x63,
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d,
0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63,
0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x01, 0x0a, 0x0d, 0x53, 0x74, 0x6f, 0x72,
0x61, 0x67, 0x65, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x75, 0x63,
0x6b, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x75,
0x63, 0x6b, 0x65, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x14, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0c, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12,
0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x1e, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda,
0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x37,
0x0a, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07,
0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x42, 0x5e, 0x5a, 0x5c, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f,
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73,
0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67,
0x65, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65,
0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDescOnce sync.Once
file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDescData = file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDesc
)
func file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDescGZIP() []byte {
file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDescOnce.Do(func() {
file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDescData)
})
return file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDescData
}
var file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_goTypes = []interface{}{
(*StorageBucket)(nil), // 0: controller.api.resources.storagebuckets.v1.StorageBucket
(*structpb.Struct)(nil), // 1: google.protobuf.Struct
}
var file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_depIdxs = []int32{
1, // 0: controller.api.resources.storagebuckets.v1.StorageBucket.attributes:type_name -> google.protobuf.Struct
1, // 1: controller.api.resources.storagebuckets.v1.StorageBucket.secrets:type_name -> google.protobuf.Struct
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_init() }
func file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_init() {
if File_controller_api_resources_storagebuckets_v1_storage_bucket_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StorageBucket); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_goTypes,
DependencyIndexes: file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_depIdxs,
MessageInfos: file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_msgTypes,
}.Build()
File_controller_api_resources_storagebuckets_v1_storage_bucket_proto = out.File
file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_rawDesc = nil
file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_goTypes = nil
file_controller_api_resources_storagebuckets_v1_storage_bucket_proto_depIdxs = nil
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,325 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package plugin
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// StoragePluginServiceClient is the client API for StoragePluginService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type StoragePluginServiceClient interface {
// OnCreateStorageBucket is a hook that runs when a
// storage bucket is created.
OnCreateStorageBucket(ctx context.Context, in *OnCreateStorageBucketRequest, opts ...grpc.CallOption) (*OnCreateStorageBucketResponse, error)
// OnUpdateStorageBucket is a hook that runs when a storage bucket is
// updated.
OnUpdateStorageBucket(ctx context.Context, in *OnUpdateStorageBucketRequest, opts ...grpc.CallOption) (*OnUpdateStorageBucketResponse, error)
// OnDeleteStorageBucket is a hook that runs when a storage bucket is
// deleted.
OnDeleteStorageBucket(ctx context.Context, in *OnDeleteStorageBucketRequest, opts ...grpc.CallOption) (*OnDeleteStorageBucketResponse, error)
// GetObject is a hook that retrieves objects.
GetObject(ctx context.Context, in *GetObjectRequest, opts ...grpc.CallOption) (StoragePluginService_GetObjectClient, error)
// PutObject is a hook that streams chunks of a file to be stored
// in an external object store.
PutObject(ctx context.Context, opts ...grpc.CallOption) (StoragePluginService_PutObjectClient, error)
}
type storagePluginServiceClient struct {
cc grpc.ClientConnInterface
}
func NewStoragePluginServiceClient(cc grpc.ClientConnInterface) StoragePluginServiceClient {
return &storagePluginServiceClient{cc}
}
func (c *storagePluginServiceClient) OnCreateStorageBucket(ctx context.Context, in *OnCreateStorageBucketRequest, opts ...grpc.CallOption) (*OnCreateStorageBucketResponse, error) {
out := new(OnCreateStorageBucketResponse)
err := c.cc.Invoke(ctx, "/plugin.v1.StoragePluginService/OnCreateStorageBucket", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *storagePluginServiceClient) OnUpdateStorageBucket(ctx context.Context, in *OnUpdateStorageBucketRequest, opts ...grpc.CallOption) (*OnUpdateStorageBucketResponse, error) {
out := new(OnUpdateStorageBucketResponse)
err := c.cc.Invoke(ctx, "/plugin.v1.StoragePluginService/OnUpdateStorageBucket", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *storagePluginServiceClient) OnDeleteStorageBucket(ctx context.Context, in *OnDeleteStorageBucketRequest, opts ...grpc.CallOption) (*OnDeleteStorageBucketResponse, error) {
out := new(OnDeleteStorageBucketResponse)
err := c.cc.Invoke(ctx, "/plugin.v1.StoragePluginService/OnDeleteStorageBucket", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *storagePluginServiceClient) GetObject(ctx context.Context, in *GetObjectRequest, opts ...grpc.CallOption) (StoragePluginService_GetObjectClient, error) {
stream, err := c.cc.NewStream(ctx, &StoragePluginService_ServiceDesc.Streams[0], "/plugin.v1.StoragePluginService/GetObject", opts...)
if err != nil {
return nil, err
}
x := &storagePluginServiceGetObjectClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type StoragePluginService_GetObjectClient interface {
Recv() (*GetObjectResponse, error)
grpc.ClientStream
}
type storagePluginServiceGetObjectClient struct {
grpc.ClientStream
}
func (x *storagePluginServiceGetObjectClient) Recv() (*GetObjectResponse, error) {
m := new(GetObjectResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *storagePluginServiceClient) PutObject(ctx context.Context, opts ...grpc.CallOption) (StoragePluginService_PutObjectClient, error) {
stream, err := c.cc.NewStream(ctx, &StoragePluginService_ServiceDesc.Streams[1], "/plugin.v1.StoragePluginService/PutObject", opts...)
if err != nil {
return nil, err
}
x := &storagePluginServicePutObjectClient{stream}
return x, nil
}
type StoragePluginService_PutObjectClient interface {
Send(*PutObjectRequest) error
CloseAndRecv() (*PutObjectResponse, error)
grpc.ClientStream
}
type storagePluginServicePutObjectClient struct {
grpc.ClientStream
}
func (x *storagePluginServicePutObjectClient) Send(m *PutObjectRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *storagePluginServicePutObjectClient) CloseAndRecv() (*PutObjectResponse, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(PutObjectResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// StoragePluginServiceServer is the server API for StoragePluginService service.
// All implementations must embed UnimplementedStoragePluginServiceServer
// for forward compatibility
type StoragePluginServiceServer interface {
// OnCreateStorageBucket is a hook that runs when a
// storage bucket is created.
OnCreateStorageBucket(context.Context, *OnCreateStorageBucketRequest) (*OnCreateStorageBucketResponse, error)
// OnUpdateStorageBucket is a hook that runs when a storage bucket is
// updated.
OnUpdateStorageBucket(context.Context, *OnUpdateStorageBucketRequest) (*OnUpdateStorageBucketResponse, error)
// OnDeleteStorageBucket is a hook that runs when a storage bucket is
// deleted.
OnDeleteStorageBucket(context.Context, *OnDeleteStorageBucketRequest) (*OnDeleteStorageBucketResponse, error)
// GetObject is a hook that retrieves objects.
GetObject(*GetObjectRequest, StoragePluginService_GetObjectServer) error
// PutObject is a hook that streams chunks of a file to be stored
// in an external object store.
PutObject(StoragePluginService_PutObjectServer) error
mustEmbedUnimplementedStoragePluginServiceServer()
}
// UnimplementedStoragePluginServiceServer must be embedded to have forward compatible implementations.
type UnimplementedStoragePluginServiceServer struct {
}
func (UnimplementedStoragePluginServiceServer) OnCreateStorageBucket(context.Context, *OnCreateStorageBucketRequest) (*OnCreateStorageBucketResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OnCreateStorageBucket not implemented")
}
func (UnimplementedStoragePluginServiceServer) OnUpdateStorageBucket(context.Context, *OnUpdateStorageBucketRequest) (*OnUpdateStorageBucketResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OnUpdateStorageBucket not implemented")
}
func (UnimplementedStoragePluginServiceServer) OnDeleteStorageBucket(context.Context, *OnDeleteStorageBucketRequest) (*OnDeleteStorageBucketResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method OnDeleteStorageBucket not implemented")
}
func (UnimplementedStoragePluginServiceServer) GetObject(*GetObjectRequest, StoragePluginService_GetObjectServer) error {
return status.Errorf(codes.Unimplemented, "method GetObject not implemented")
}
func (UnimplementedStoragePluginServiceServer) PutObject(StoragePluginService_PutObjectServer) error {
return status.Errorf(codes.Unimplemented, "method PutObject not implemented")
}
func (UnimplementedStoragePluginServiceServer) mustEmbedUnimplementedStoragePluginServiceServer() {}
// UnsafeStoragePluginServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to StoragePluginServiceServer will
// result in compilation errors.
type UnsafeStoragePluginServiceServer interface {
mustEmbedUnimplementedStoragePluginServiceServer()
}
func RegisterStoragePluginServiceServer(s grpc.ServiceRegistrar, srv StoragePluginServiceServer) {
s.RegisterService(&StoragePluginService_ServiceDesc, srv)
}
func _StoragePluginService_OnCreateStorageBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(OnCreateStorageBucketRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StoragePluginServiceServer).OnCreateStorageBucket(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/plugin.v1.StoragePluginService/OnCreateStorageBucket",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StoragePluginServiceServer).OnCreateStorageBucket(ctx, req.(*OnCreateStorageBucketRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StoragePluginService_OnUpdateStorageBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(OnUpdateStorageBucketRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StoragePluginServiceServer).OnUpdateStorageBucket(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/plugin.v1.StoragePluginService/OnUpdateStorageBucket",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StoragePluginServiceServer).OnUpdateStorageBucket(ctx, req.(*OnUpdateStorageBucketRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StoragePluginService_OnDeleteStorageBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(OnDeleteStorageBucketRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StoragePluginServiceServer).OnDeleteStorageBucket(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/plugin.v1.StoragePluginService/OnDeleteStorageBucket",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StoragePluginServiceServer).OnDeleteStorageBucket(ctx, req.(*OnDeleteStorageBucketRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StoragePluginService_GetObject_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(GetObjectRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(StoragePluginServiceServer).GetObject(m, &storagePluginServiceGetObjectServer{stream})
}
type StoragePluginService_GetObjectServer interface {
Send(*GetObjectResponse) error
grpc.ServerStream
}
type storagePluginServiceGetObjectServer struct {
grpc.ServerStream
}
func (x *storagePluginServiceGetObjectServer) Send(m *GetObjectResponse) error {
return x.ServerStream.SendMsg(m)
}
func _StoragePluginService_PutObject_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(StoragePluginServiceServer).PutObject(&storagePluginServicePutObjectServer{stream})
}
type StoragePluginService_PutObjectServer interface {
SendAndClose(*PutObjectResponse) error
Recv() (*PutObjectRequest, error)
grpc.ServerStream
}
type storagePluginServicePutObjectServer struct {
grpc.ServerStream
}
func (x *storagePluginServicePutObjectServer) SendAndClose(m *PutObjectResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *storagePluginServicePutObjectServer) Recv() (*PutObjectRequest, error) {
m := new(PutObjectRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// StoragePluginService_ServiceDesc is the grpc.ServiceDesc for StoragePluginService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var StoragePluginService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "plugin.v1.StoragePluginService",
HandlerType: (*StoragePluginServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "OnCreateStorageBucket",
Handler: _StoragePluginService_OnCreateStorageBucket_Handler,
},
{
MethodName: "OnUpdateStorageBucket",
Handler: _StoragePluginService_OnUpdateStorageBucket_Handler,
},
{
MethodName: "OnDeleteStorageBucket",
Handler: _StoragePluginService_OnDeleteStorageBucket_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "GetObject",
Handler: _StoragePluginService_GetObject_Handler,
ServerStreams: true,
},
{
StreamName: "PutObject",
Handler: _StoragePluginService_PutObject_Handler,
ClientStreams: true,
},
},
Metadata: "plugin/v1/storage_plugin_service.proto",
}
Loading…
Cancel
Save