mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 12:02:27 +08:00
纯宿主侧改动,向后兼容。 - 契约(pkg/pluginapi/v1/plugin.proto,已重新生成):ListAccounts 增补 repeated AccountInfo accounts(保留 account_ids 向后兼容),新增 metadata_json 只读快照字段。HostServiceAPIVersion 1→2(InitHostServices 运行时协商,加法式, 旧调用方忽略新字段即可)。 - 权限边界:可见范围由清单能力经 pluginCapabilityAccountScopeGrants 推导, ListAccounts 与 ResolveOutboundIdentity 均以该范围为权威边界。 - metadata_json 采用 denylist:剥离 Credentials 与含反向引用的关联对象 Groups/AccountGroups(避免 encoding/json 循环引用),其余字段自动透传, 数据模型新增非机密字段无需改宿主。 测试:范围/元数据/无凭据泄漏用例、denylist 反射护栏 + 循环引用安全断言、纵深过滤用例; build/vet/gofmt、-tags unit 与 -race 全绿。
669 lines
28 KiB
Go
669 lines
28 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.2
|
|
// - protoc v3.12.4
|
|
// source: plugin.proto
|
|
|
|
package pluginv1
|
|
|
|
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.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
TransportPlugin_GetInfo_FullMethodName = "/sub2api.plugin.v1.TransportPlugin/GetInfo"
|
|
TransportPlugin_Health_FullMethodName = "/sub2api.plugin.v1.TransportPlugin/Health"
|
|
TransportPlugin_ValidateConfig_FullMethodName = "/sub2api.plugin.v1.TransportPlugin/ValidateConfig"
|
|
TransportPlugin_ApplyConfig_FullMethodName = "/sub2api.plugin.v1.TransportPlugin/ApplyConfig"
|
|
TransportPlugin_TestConfig_FullMethodName = "/sub2api.plugin.v1.TransportPlugin/TestConfig"
|
|
TransportPlugin_Forward_FullMethodName = "/sub2api.plugin.v1.TransportPlugin/Forward"
|
|
TransportPlugin_InitHostServices_FullMethodName = "/sub2api.plugin.v1.TransportPlugin/InitHostServices"
|
|
)
|
|
|
|
// TransportPluginClient is the client API for TransportPlugin 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 TransportPluginClient interface {
|
|
GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error)
|
|
Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error)
|
|
ValidateConfig(ctx context.Context, in *ValidateConfigRequest, opts ...grpc.CallOption) (*ValidateConfigResponse, error)
|
|
ApplyConfig(ctx context.Context, in *ApplyConfigRequest, opts ...grpc.CallOption) (*ApplyConfigResponse, error)
|
|
TestConfig(ctx context.Context, in *TestConfigRequest, opts ...grpc.CallOption) (*TestConfigResponse, error)
|
|
Forward(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ForwardRequest, ForwardResponse], error)
|
|
// InitHostServices hands the plugin a go-plugin broker stream id it can dial
|
|
// back to reach the host-provided HostService. It is an optional, generic
|
|
// lifecycle hook: plugins built against an older contract leave it
|
|
// Unimplemented and the host simply runs without offering host services.
|
|
InitHostServices(ctx context.Context, in *InitHostServicesRequest, opts ...grpc.CallOption) (*InitHostServicesResponse, error)
|
|
}
|
|
|
|
type transportPluginClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewTransportPluginClient(cc grpc.ClientConnInterface) TransportPluginClient {
|
|
return &transportPluginClient{cc}
|
|
}
|
|
|
|
func (c *transportPluginClient) GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(GetInfoResponse)
|
|
err := c.cc.Invoke(ctx, TransportPlugin_GetInfo_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *transportPluginClient) Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(HealthResponse)
|
|
err := c.cc.Invoke(ctx, TransportPlugin_Health_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *transportPluginClient) ValidateConfig(ctx context.Context, in *ValidateConfigRequest, opts ...grpc.CallOption) (*ValidateConfigResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ValidateConfigResponse)
|
|
err := c.cc.Invoke(ctx, TransportPlugin_ValidateConfig_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *transportPluginClient) ApplyConfig(ctx context.Context, in *ApplyConfigRequest, opts ...grpc.CallOption) (*ApplyConfigResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ApplyConfigResponse)
|
|
err := c.cc.Invoke(ctx, TransportPlugin_ApplyConfig_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *transportPluginClient) TestConfig(ctx context.Context, in *TestConfigRequest, opts ...grpc.CallOption) (*TestConfigResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(TestConfigResponse)
|
|
err := c.cc.Invoke(ctx, TransportPlugin_TestConfig_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *transportPluginClient) Forward(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ForwardRequest, ForwardResponse], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &TransportPlugin_ServiceDesc.Streams[0], TransportPlugin_Forward_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[ForwardRequest, ForwardResponse]{ClientStream: stream}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type TransportPlugin_ForwardClient = grpc.BidiStreamingClient[ForwardRequest, ForwardResponse]
|
|
|
|
func (c *transportPluginClient) InitHostServices(ctx context.Context, in *InitHostServicesRequest, opts ...grpc.CallOption) (*InitHostServicesResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(InitHostServicesResponse)
|
|
err := c.cc.Invoke(ctx, TransportPlugin_InitHostServices_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// TransportPluginServer is the server API for TransportPlugin service.
|
|
// All implementations must embed UnimplementedTransportPluginServer
|
|
// for forward compatibility.
|
|
type TransportPluginServer interface {
|
|
GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error)
|
|
Health(context.Context, *HealthRequest) (*HealthResponse, error)
|
|
ValidateConfig(context.Context, *ValidateConfigRequest) (*ValidateConfigResponse, error)
|
|
ApplyConfig(context.Context, *ApplyConfigRequest) (*ApplyConfigResponse, error)
|
|
TestConfig(context.Context, *TestConfigRequest) (*TestConfigResponse, error)
|
|
Forward(grpc.BidiStreamingServer[ForwardRequest, ForwardResponse]) error
|
|
// InitHostServices hands the plugin a go-plugin broker stream id it can dial
|
|
// back to reach the host-provided HostService. It is an optional, generic
|
|
// lifecycle hook: plugins built against an older contract leave it
|
|
// Unimplemented and the host simply runs without offering host services.
|
|
InitHostServices(context.Context, *InitHostServicesRequest) (*InitHostServicesResponse, error)
|
|
mustEmbedUnimplementedTransportPluginServer()
|
|
}
|
|
|
|
// UnimplementedTransportPluginServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedTransportPluginServer struct{}
|
|
|
|
func (UnimplementedTransportPluginServer) GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method GetInfo not implemented")
|
|
}
|
|
func (UnimplementedTransportPluginServer) Health(context.Context, *HealthRequest) (*HealthResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Health not implemented")
|
|
}
|
|
func (UnimplementedTransportPluginServer) ValidateConfig(context.Context, *ValidateConfigRequest) (*ValidateConfigResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ValidateConfig not implemented")
|
|
}
|
|
func (UnimplementedTransportPluginServer) ApplyConfig(context.Context, *ApplyConfigRequest) (*ApplyConfigResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ApplyConfig not implemented")
|
|
}
|
|
func (UnimplementedTransportPluginServer) TestConfig(context.Context, *TestConfigRequest) (*TestConfigResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method TestConfig not implemented")
|
|
}
|
|
func (UnimplementedTransportPluginServer) Forward(grpc.BidiStreamingServer[ForwardRequest, ForwardResponse]) error {
|
|
return status.Error(codes.Unimplemented, "method Forward not implemented")
|
|
}
|
|
func (UnimplementedTransportPluginServer) InitHostServices(context.Context, *InitHostServicesRequest) (*InitHostServicesResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method InitHostServices not implemented")
|
|
}
|
|
func (UnimplementedTransportPluginServer) mustEmbedUnimplementedTransportPluginServer() {}
|
|
func (UnimplementedTransportPluginServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeTransportPluginServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to TransportPluginServer will
|
|
// result in compilation errors.
|
|
type UnsafeTransportPluginServer interface {
|
|
mustEmbedUnimplementedTransportPluginServer()
|
|
}
|
|
|
|
func RegisterTransportPluginServer(s grpc.ServiceRegistrar, srv TransportPluginServer) {
|
|
// If the following call panics, it indicates UnimplementedTransportPluginServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&TransportPlugin_ServiceDesc, srv)
|
|
}
|
|
|
|
func _TransportPlugin_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetInfoRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(TransportPluginServer).GetInfo(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: TransportPlugin_GetInfo_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(TransportPluginServer).GetInfo(ctx, req.(*GetInfoRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _TransportPlugin_Health_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(HealthRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(TransportPluginServer).Health(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: TransportPlugin_Health_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(TransportPluginServer).Health(ctx, req.(*HealthRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _TransportPlugin_ValidateConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ValidateConfigRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(TransportPluginServer).ValidateConfig(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: TransportPlugin_ValidateConfig_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(TransportPluginServer).ValidateConfig(ctx, req.(*ValidateConfigRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _TransportPlugin_ApplyConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ApplyConfigRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(TransportPluginServer).ApplyConfig(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: TransportPlugin_ApplyConfig_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(TransportPluginServer).ApplyConfig(ctx, req.(*ApplyConfigRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _TransportPlugin_TestConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(TestConfigRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(TransportPluginServer).TestConfig(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: TransportPlugin_TestConfig_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(TransportPluginServer).TestConfig(ctx, req.(*TestConfigRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _TransportPlugin_Forward_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
return srv.(TransportPluginServer).Forward(&grpc.GenericServerStream[ForwardRequest, ForwardResponse]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type TransportPlugin_ForwardServer = grpc.BidiStreamingServer[ForwardRequest, ForwardResponse]
|
|
|
|
func _TransportPlugin_InitHostServices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(InitHostServicesRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(TransportPluginServer).InitHostServices(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: TransportPlugin_InitHostServices_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(TransportPluginServer).InitHostServices(ctx, req.(*InitHostServicesRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// TransportPlugin_ServiceDesc is the grpc.ServiceDesc for TransportPlugin service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var TransportPlugin_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "sub2api.plugin.v1.TransportPlugin",
|
|
HandlerType: (*TransportPluginServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "GetInfo",
|
|
Handler: _TransportPlugin_GetInfo_Handler,
|
|
},
|
|
{
|
|
MethodName: "Health",
|
|
Handler: _TransportPlugin_Health_Handler,
|
|
},
|
|
{
|
|
MethodName: "ValidateConfig",
|
|
Handler: _TransportPlugin_ValidateConfig_Handler,
|
|
},
|
|
{
|
|
MethodName: "ApplyConfig",
|
|
Handler: _TransportPlugin_ApplyConfig_Handler,
|
|
},
|
|
{
|
|
MethodName: "TestConfig",
|
|
Handler: _TransportPlugin_TestConfig_Handler,
|
|
},
|
|
{
|
|
MethodName: "InitHostServices",
|
|
Handler: _TransportPlugin_InitHostServices_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "Forward",
|
|
Handler: _TransportPlugin_Forward_Handler,
|
|
ServerStreams: true,
|
|
ClientStreams: true,
|
|
},
|
|
},
|
|
Metadata: "plugin.proto",
|
|
}
|
|
|
|
const (
|
|
HostService_KVGet_FullMethodName = "/sub2api.plugin.v1.HostService/KVGet"
|
|
HostService_KVSet_FullMethodName = "/sub2api.plugin.v1.HostService/KVSet"
|
|
HostService_KVDelete_FullMethodName = "/sub2api.plugin.v1.HostService/KVDelete"
|
|
HostService_KVList_FullMethodName = "/sub2api.plugin.v1.HostService/KVList"
|
|
HostService_ListAccounts_FullMethodName = "/sub2api.plugin.v1.HostService/ListAccounts"
|
|
HostService_ResolveOutboundIdentity_FullMethodName = "/sub2api.plugin.v1.HostService/ResolveOutboundIdentity"
|
|
)
|
|
|
|
// HostServiceClient is the client API for HostService 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.
|
|
//
|
|
// HostService is implemented by the host and dialed by the plugin over the
|
|
// go-plugin broker id delivered via InitHostServices. It exposes generic,
|
|
// capability-neutral facilities that any plugin may use; new facilities are
|
|
// added here as new RPCs without changing the transport contract version.
|
|
type HostServiceClient interface {
|
|
KVGet(ctx context.Context, in *KVGetRequest, opts ...grpc.CallOption) (*KVGetResponse, error)
|
|
KVSet(ctx context.Context, in *KVSetRequest, opts ...grpc.CallOption) (*KVSetResponse, error)
|
|
KVDelete(ctx context.Context, in *KVDeleteRequest, opts ...grpc.CallOption) (*KVDeleteResponse, error)
|
|
KVList(ctx context.Context, in *KVListRequest, opts ...grpc.CallOption) (*KVListResponse, error)
|
|
// Account directory: enumerate the accounts the plugin is bound to act on
|
|
// (with full readable metadata) and resolve the outbound identity
|
|
// (credentials/headers/proxy) the host would attach to a live request. The
|
|
// host restricts both calls to the account scope the requesting plugin's
|
|
// declared capabilities cover; a plugin can never widen that scope. Metadata
|
|
// never carries raw credentials — those are only handed out by
|
|
// ResolveOutboundIdentity, the dedicated (equally sensitive) credential channel.
|
|
ListAccounts(ctx context.Context, in *ListAccountsRequest, opts ...grpc.CallOption) (*ListAccountsResponse, error)
|
|
ResolveOutboundIdentity(ctx context.Context, in *ResolveOutboundIdentityRequest, opts ...grpc.CallOption) (*ResolveOutboundIdentityResponse, error)
|
|
}
|
|
|
|
type hostServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewHostServiceClient(cc grpc.ClientConnInterface) HostServiceClient {
|
|
return &hostServiceClient{cc}
|
|
}
|
|
|
|
func (c *hostServiceClient) KVGet(ctx context.Context, in *KVGetRequest, opts ...grpc.CallOption) (*KVGetResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(KVGetResponse)
|
|
err := c.cc.Invoke(ctx, HostService_KVGet_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *hostServiceClient) KVSet(ctx context.Context, in *KVSetRequest, opts ...grpc.CallOption) (*KVSetResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(KVSetResponse)
|
|
err := c.cc.Invoke(ctx, HostService_KVSet_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *hostServiceClient) KVDelete(ctx context.Context, in *KVDeleteRequest, opts ...grpc.CallOption) (*KVDeleteResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(KVDeleteResponse)
|
|
err := c.cc.Invoke(ctx, HostService_KVDelete_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *hostServiceClient) KVList(ctx context.Context, in *KVListRequest, opts ...grpc.CallOption) (*KVListResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(KVListResponse)
|
|
err := c.cc.Invoke(ctx, HostService_KVList_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *hostServiceClient) ListAccounts(ctx context.Context, in *ListAccountsRequest, opts ...grpc.CallOption) (*ListAccountsResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ListAccountsResponse)
|
|
err := c.cc.Invoke(ctx, HostService_ListAccounts_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *hostServiceClient) ResolveOutboundIdentity(ctx context.Context, in *ResolveOutboundIdentityRequest, opts ...grpc.CallOption) (*ResolveOutboundIdentityResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ResolveOutboundIdentityResponse)
|
|
err := c.cc.Invoke(ctx, HostService_ResolveOutboundIdentity_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// HostServiceServer is the server API for HostService service.
|
|
// All implementations must embed UnimplementedHostServiceServer
|
|
// for forward compatibility.
|
|
//
|
|
// HostService is implemented by the host and dialed by the plugin over the
|
|
// go-plugin broker id delivered via InitHostServices. It exposes generic,
|
|
// capability-neutral facilities that any plugin may use; new facilities are
|
|
// added here as new RPCs without changing the transport contract version.
|
|
type HostServiceServer interface {
|
|
KVGet(context.Context, *KVGetRequest) (*KVGetResponse, error)
|
|
KVSet(context.Context, *KVSetRequest) (*KVSetResponse, error)
|
|
KVDelete(context.Context, *KVDeleteRequest) (*KVDeleteResponse, error)
|
|
KVList(context.Context, *KVListRequest) (*KVListResponse, error)
|
|
// Account directory: enumerate the accounts the plugin is bound to act on
|
|
// (with full readable metadata) and resolve the outbound identity
|
|
// (credentials/headers/proxy) the host would attach to a live request. The
|
|
// host restricts both calls to the account scope the requesting plugin's
|
|
// declared capabilities cover; a plugin can never widen that scope. Metadata
|
|
// never carries raw credentials — those are only handed out by
|
|
// ResolveOutboundIdentity, the dedicated (equally sensitive) credential channel.
|
|
ListAccounts(context.Context, *ListAccountsRequest) (*ListAccountsResponse, error)
|
|
ResolveOutboundIdentity(context.Context, *ResolveOutboundIdentityRequest) (*ResolveOutboundIdentityResponse, error)
|
|
mustEmbedUnimplementedHostServiceServer()
|
|
}
|
|
|
|
// UnimplementedHostServiceServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedHostServiceServer struct{}
|
|
|
|
func (UnimplementedHostServiceServer) KVGet(context.Context, *KVGetRequest) (*KVGetResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method KVGet not implemented")
|
|
}
|
|
func (UnimplementedHostServiceServer) KVSet(context.Context, *KVSetRequest) (*KVSetResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method KVSet not implemented")
|
|
}
|
|
func (UnimplementedHostServiceServer) KVDelete(context.Context, *KVDeleteRequest) (*KVDeleteResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method KVDelete not implemented")
|
|
}
|
|
func (UnimplementedHostServiceServer) KVList(context.Context, *KVListRequest) (*KVListResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method KVList not implemented")
|
|
}
|
|
func (UnimplementedHostServiceServer) ListAccounts(context.Context, *ListAccountsRequest) (*ListAccountsResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ListAccounts not implemented")
|
|
}
|
|
func (UnimplementedHostServiceServer) ResolveOutboundIdentity(context.Context, *ResolveOutboundIdentityRequest) (*ResolveOutboundIdentityResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ResolveOutboundIdentity not implemented")
|
|
}
|
|
func (UnimplementedHostServiceServer) mustEmbedUnimplementedHostServiceServer() {}
|
|
func (UnimplementedHostServiceServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeHostServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to HostServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafeHostServiceServer interface {
|
|
mustEmbedUnimplementedHostServiceServer()
|
|
}
|
|
|
|
func RegisterHostServiceServer(s grpc.ServiceRegistrar, srv HostServiceServer) {
|
|
// If the following call panics, it indicates UnimplementedHostServiceServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&HostService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _HostService_KVGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(KVGetRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(HostServiceServer).KVGet(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: HostService_KVGet_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(HostServiceServer).KVGet(ctx, req.(*KVGetRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _HostService_KVSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(KVSetRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(HostServiceServer).KVSet(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: HostService_KVSet_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(HostServiceServer).KVSet(ctx, req.(*KVSetRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _HostService_KVDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(KVDeleteRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(HostServiceServer).KVDelete(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: HostService_KVDelete_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(HostServiceServer).KVDelete(ctx, req.(*KVDeleteRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _HostService_KVList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(KVListRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(HostServiceServer).KVList(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: HostService_KVList_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(HostServiceServer).KVList(ctx, req.(*KVListRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _HostService_ListAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ListAccountsRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(HostServiceServer).ListAccounts(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: HostService_ListAccounts_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(HostServiceServer).ListAccounts(ctx, req.(*ListAccountsRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _HostService_ResolveOutboundIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ResolveOutboundIdentityRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(HostServiceServer).ResolveOutboundIdentity(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: HostService_ResolveOutboundIdentity_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(HostServiceServer).ResolveOutboundIdentity(ctx, req.(*ResolveOutboundIdentityRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// HostService_ServiceDesc is the grpc.ServiceDesc for HostService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var HostService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "sub2api.plugin.v1.HostService",
|
|
HandlerType: (*HostServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "KVGet",
|
|
Handler: _HostService_KVGet_Handler,
|
|
},
|
|
{
|
|
MethodName: "KVSet",
|
|
Handler: _HostService_KVSet_Handler,
|
|
},
|
|
{
|
|
MethodName: "KVDelete",
|
|
Handler: _HostService_KVDelete_Handler,
|
|
},
|
|
{
|
|
MethodName: "KVList",
|
|
Handler: _HostService_KVList_Handler,
|
|
},
|
|
{
|
|
MethodName: "ListAccounts",
|
|
Handler: _HostService_ListAccounts_Handler,
|
|
},
|
|
{
|
|
MethodName: "ResolveOutboundIdentity",
|
|
Handler: _HostService_ResolveOutboundIdentity_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "plugin.proto",
|
|
}
|