feat(connectors): the connector contract and its confined extension host (#1979)
This commit is contained in:
15 files changed
+3147
-1
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,343 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc (unknown)
|
||||
// source: connector/v1/connector.proto
|
||||
|
||||
package connectorv1
|
||||
|
||||
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 (
|
||||
ConnectorService_Configure_FullMethodName = "/connector.v1.ConnectorService/Configure"
|
||||
ConnectorService_Describe_FullMethodName = "/connector.v1.ConnectorService/Describe"
|
||||
ConnectorService_Parse_FullMethodName = "/connector.v1.ConnectorService/Parse"
|
||||
ConnectorService_Resolve_FullMethodName = "/connector.v1.ConnectorService/Resolve"
|
||||
ConnectorService_Invoke_FullMethodName = "/connector.v1.ConnectorService/Invoke"
|
||||
ConnectorService_Lookup_FullMethodName = "/connector.v1.ConnectorService/Lookup"
|
||||
)
|
||||
|
||||
// ConnectorServiceClient is the client API for ConnectorService 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.
|
||||
//
|
||||
// ConnectorService is the surface every connector extension serves: it
|
||||
// declares what it hears and does, turns verified payloads into typed events,
|
||||
// resolves and runs actions, and answers lookups. The host invokes everything
|
||||
// by name; payloads are JSON validated against the declared schemas.
|
||||
type ConnectorServiceClient interface {
|
||||
// Configure hands the connector its operator settings and resolved secrets.
|
||||
// The host calls it once after launch and again when settings change.
|
||||
Configure(ctx context.Context, in *ConfigureRequest, opts ...grpc.CallOption) (*ConfigureResponse, error)
|
||||
// Describe declares the connector's event types, actions and lookups.
|
||||
Describe(ctx context.Context, in *DescribeRequest, opts ...grpc.CallOption) (*DescribeResponse, error)
|
||||
// Parse turns a payload the host has already verified into typed events.
|
||||
Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error)
|
||||
// Resolve works out the structured target and the effect of one concrete
|
||||
// action before it is judged. The same action can have different effects on
|
||||
// different targets.
|
||||
Resolve(ctx context.Context, in *ResolveRequest, opts ...grpc.CallOption) (*ResolveResponse, error)
|
||||
// Invoke runs one judged action. The connector honours the idempotency key
|
||||
// and returns the digest of what it actually executed.
|
||||
Invoke(ctx context.Context, in *InvokeRequest, opts ...grpc.CallOption) (*InvokeResponse, error)
|
||||
// Lookup answers a read-only question. Lookups change nothing and run no
|
||||
// guards; a lookup that finds nothing says so.
|
||||
Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error)
|
||||
}
|
||||
|
||||
type connectorServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewConnectorServiceClient(cc grpc.ClientConnInterface) ConnectorServiceClient {
|
||||
return &connectorServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *connectorServiceClient) Configure(ctx context.Context, in *ConfigureRequest, opts ...grpc.CallOption) (*ConfigureResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ConfigureResponse)
|
||||
err := c.cc.Invoke(ctx, ConnectorService_Configure_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *connectorServiceClient) Describe(ctx context.Context, in *DescribeRequest, opts ...grpc.CallOption) (*DescribeResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DescribeResponse)
|
||||
err := c.cc.Invoke(ctx, ConnectorService_Describe_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *connectorServiceClient) Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ParseResponse)
|
||||
err := c.cc.Invoke(ctx, ConnectorService_Parse_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *connectorServiceClient) Resolve(ctx context.Context, in *ResolveRequest, opts ...grpc.CallOption) (*ResolveResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ResolveResponse)
|
||||
err := c.cc.Invoke(ctx, ConnectorService_Resolve_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *connectorServiceClient) Invoke(ctx context.Context, in *InvokeRequest, opts ...grpc.CallOption) (*InvokeResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(InvokeResponse)
|
||||
err := c.cc.Invoke(ctx, ConnectorService_Invoke_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *connectorServiceClient) Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(LookupResponse)
|
||||
err := c.cc.Invoke(ctx, ConnectorService_Lookup_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ConnectorServiceServer is the server API for ConnectorService service.
|
||||
// All implementations must embed UnimplementedConnectorServiceServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// ConnectorService is the surface every connector extension serves: it
|
||||
// declares what it hears and does, turns verified payloads into typed events,
|
||||
// resolves and runs actions, and answers lookups. The host invokes everything
|
||||
// by name; payloads are JSON validated against the declared schemas.
|
||||
type ConnectorServiceServer interface {
|
||||
// Configure hands the connector its operator settings and resolved secrets.
|
||||
// The host calls it once after launch and again when settings change.
|
||||
Configure(context.Context, *ConfigureRequest) (*ConfigureResponse, error)
|
||||
// Describe declares the connector's event types, actions and lookups.
|
||||
Describe(context.Context, *DescribeRequest) (*DescribeResponse, error)
|
||||
// Parse turns a payload the host has already verified into typed events.
|
||||
Parse(context.Context, *ParseRequest) (*ParseResponse, error)
|
||||
// Resolve works out the structured target and the effect of one concrete
|
||||
// action before it is judged. The same action can have different effects on
|
||||
// different targets.
|
||||
Resolve(context.Context, *ResolveRequest) (*ResolveResponse, error)
|
||||
// Invoke runs one judged action. The connector honours the idempotency key
|
||||
// and returns the digest of what it actually executed.
|
||||
Invoke(context.Context, *InvokeRequest) (*InvokeResponse, error)
|
||||
// Lookup answers a read-only question. Lookups change nothing and run no
|
||||
// guards; a lookup that finds nothing says so.
|
||||
Lookup(context.Context, *LookupRequest) (*LookupResponse, error)
|
||||
mustEmbedUnimplementedConnectorServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedConnectorServiceServer 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 UnimplementedConnectorServiceServer struct{}
|
||||
|
||||
func (UnimplementedConnectorServiceServer) Configure(context.Context, *ConfigureRequest) (*ConfigureResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Configure not implemented")
|
||||
}
|
||||
func (UnimplementedConnectorServiceServer) Describe(context.Context, *DescribeRequest) (*DescribeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Describe not implemented")
|
||||
}
|
||||
func (UnimplementedConnectorServiceServer) Parse(context.Context, *ParseRequest) (*ParseResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Parse not implemented")
|
||||
}
|
||||
func (UnimplementedConnectorServiceServer) Resolve(context.Context, *ResolveRequest) (*ResolveResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Resolve not implemented")
|
||||
}
|
||||
func (UnimplementedConnectorServiceServer) Invoke(context.Context, *InvokeRequest) (*InvokeResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Invoke not implemented")
|
||||
}
|
||||
func (UnimplementedConnectorServiceServer) Lookup(context.Context, *LookupRequest) (*LookupResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Lookup not implemented")
|
||||
}
|
||||
func (UnimplementedConnectorServiceServer) mustEmbedUnimplementedConnectorServiceServer() {}
|
||||
func (UnimplementedConnectorServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeConnectorServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ConnectorServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeConnectorServiceServer interface {
|
||||
mustEmbedUnimplementedConnectorServiceServer()
|
||||
}
|
||||
|
||||
func RegisterConnectorServiceServer(s grpc.ServiceRegistrar, srv ConnectorServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedConnectorServiceServer 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(&ConnectorService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ConnectorService_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ConfigureRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConnectorServiceServer).Configure(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ConnectorService_Configure_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConnectorServiceServer).Configure(ctx, req.(*ConfigureRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConnectorService_Describe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DescribeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConnectorServiceServer).Describe(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ConnectorService_Describe_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConnectorServiceServer).Describe(ctx, req.(*DescribeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConnectorService_Parse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ParseRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConnectorServiceServer).Parse(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ConnectorService_Parse_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConnectorServiceServer).Parse(ctx, req.(*ParseRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConnectorService_Resolve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ResolveRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConnectorServiceServer).Resolve(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ConnectorService_Resolve_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConnectorServiceServer).Resolve(ctx, req.(*ResolveRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConnectorService_Invoke_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(InvokeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConnectorServiceServer).Invoke(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ConnectorService_Invoke_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConnectorServiceServer).Invoke(ctx, req.(*InvokeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ConnectorService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(LookupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConnectorServiceServer).Lookup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ConnectorService_Lookup_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConnectorServiceServer).Lookup(ctx, req.(*LookupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ConnectorService_ServiceDesc is the grpc.ServiceDesc for ConnectorService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ConnectorService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "connector.v1.ConnectorService",
|
||||
HandlerType: (*ConnectorServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Configure",
|
||||
Handler: _ConnectorService_Configure_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Describe",
|
||||
Handler: _ConnectorService_Describe_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Parse",
|
||||
Handler: _ConnectorService_Parse_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Resolve",
|
||||
Handler: _ConnectorService_Resolve_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Invoke",
|
||||
Handler: _ConnectorService_Invoke_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Lookup",
|
||||
Handler: _ConnectorService_Lookup_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "connector/v1/connector.proto",
|
||||
}
|
||||
Reference in new issue
Block a user