Documentation ¶
Overview ¶
Package shared contains shared data between the host and plugins.
Index ¶
- Variables
- type GRPCClient
- func (c *GRPCClient) EstablishCacheConnection() (proto.WrapperPlugin_EstablishCacheConnectionClient, error)
- func (c *GRPCClient) Execute(req *proto.ExecuteRequest) (proto.WrapperPlugin_ExecuteClient, context.Context, context.CancelFunc, error)
- func (c *GRPCClient) GetSchema(req *proto.GetSchemaRequest) (*proto.GetSchemaResponse, error)
- func (c *GRPCClient) GetSupportedOperations(req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, error)
- func (c *GRPCClient) SetAllConnectionConfigs(req *proto.SetAllConnectionConfigsRequest) (*proto.SetConnectionConfigResponse, error)
- func (c *GRPCClient) SetConnectionConfig(req *proto.SetConnectionConfigRequest) (*proto.SetConnectionConfigResponse, error)
- type GRPCServer
- func (m *GRPCServer) EstablishCacheConnection(server proto.WrapperPlugin_EstablishCacheConnectionServer) error
- func (m *GRPCServer) Execute(req *proto.ExecuteRequest, server proto.WrapperPlugin_ExecuteServer) error
- func (m *GRPCServer) GetSchema(_ context.Context, req *proto.GetSchemaRequest) (*proto.GetSchemaResponse, error)
- func (m *GRPCServer) GetSupportedOperations(_ context.Context, req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, error)
- func (m *GRPCServer) SetAllConnectionConfigs(_ context.Context, req *proto.SetAllConnectionConfigsRequest) (*proto.SetConnectionConfigResponse, error)
- func (m *GRPCServer) SetConnectionConfig(_ context.Context, req *proto.SetConnectionConfigRequest) (*proto.SetConnectionConfigResponse, error)
- type WrapperPlugin
- type WrapperPluginClient
- type WrapperPluginServer
Constants ¶
This section is empty.
Variables ¶
var Handshake = plugin.HandshakeConfig{
MagicCookieKey: "MANTIX_PLUGIN_MAGIC_COOKIE",
MagicCookieValue: "really-complex-permanent-string-value",
}
Handshake is a common handshake that is shared by plugin and host. See https://github.com/hashicorp/terraform/blob/ba6e243bd97fda935f903da0d420e5ed94e35c9e/plugin/serve.go#L24
Functions ¶
This section is empty.
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is an implementation of WrapperPluginClient service that talks over RPC.
func (*GRPCClient) EstablishCacheConnection ¶
func (c *GRPCClient) EstablishCacheConnection() (proto.WrapperPlugin_EstablishCacheConnectionClient, error)
func (*GRPCClient) Execute ¶
func (c *GRPCClient) Execute(req *proto.ExecuteRequest) (proto.WrapperPlugin_ExecuteClient, context.Context, context.CancelFunc, error)
func (*GRPCClient) GetSchema ¶
func (c *GRPCClient) GetSchema(req *proto.GetSchemaRequest) (*proto.GetSchemaResponse, error)
func (*GRPCClient) GetSupportedOperations ¶
func (c *GRPCClient) GetSupportedOperations(req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, error)
func (*GRPCClient) SetAllConnectionConfigs ¶
func (c *GRPCClient) SetAllConnectionConfigs(req *proto.SetAllConnectionConfigsRequest) (*proto.SetConnectionConfigResponse, error)
func (*GRPCClient) SetConnectionConfig ¶
func (c *GRPCClient) SetConnectionConfig(req *proto.SetConnectionConfigRequest) (*proto.SetConnectionConfigResponse, error)
type GRPCServer ¶
type GRPCServer struct { proto.UnimplementedWrapperPluginServer // This is the real implementation Impl WrapperPluginServer }
GRPCServer is the gRPC server that GRPCClient talks to.
func (*GRPCServer) EstablishCacheConnection ¶
func (m *GRPCServer) EstablishCacheConnection(server proto.WrapperPlugin_EstablishCacheConnectionServer) error
func (*GRPCServer) Execute ¶
func (m *GRPCServer) Execute(req *proto.ExecuteRequest, server proto.WrapperPlugin_ExecuteServer) error
func (*GRPCServer) GetSchema ¶
func (m *GRPCServer) GetSchema(_ context.Context, req *proto.GetSchemaRequest) (*proto.GetSchemaResponse, error)
func (*GRPCServer) GetSupportedOperations ¶
func (m *GRPCServer) GetSupportedOperations(_ context.Context, req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, error)
func (*GRPCServer) SetAllConnectionConfigs ¶
func (m *GRPCServer) SetAllConnectionConfigs(_ context.Context, req *proto.SetAllConnectionConfigsRequest) (*proto.SetConnectionConfigResponse, error)
func (*GRPCServer) SetConnectionConfig ¶
func (m *GRPCServer) SetConnectionConfig(_ context.Context, req *proto.SetConnectionConfigRequest) (*proto.SetConnectionConfigResponse, error)
type WrapperPlugin ¶
type WrapperPlugin struct { // GRPCPlugin must still implement the Stub interface plugin.Plugin // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. Impl WrapperPluginServer }
This is the implementation of plugin.GRPCServer so we can serve/consume this.
func (*WrapperPlugin) GRPCClient ¶
func (p *WrapperPlugin) GRPCClient(ctx context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
return a GRPCClient, called by Dispense
func (*WrapperPlugin) GRPCServer ¶
func (p *WrapperPlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error
type WrapperPluginClient ¶
type WrapperPluginClient interface { GetSchema(request *proto.GetSchemaRequest) (*proto.GetSchemaResponse, error) Execute(req *proto.ExecuteRequest) (proto.WrapperPlugin_ExecuteClient, context.Context, context.CancelFunc, error) SetConnectionConfig(req *proto.SetConnectionConfigRequest) (*proto.SetConnectionConfigResponse, error) SetAllConnectionConfigs(req *proto.SetAllConnectionConfigsRequest) (*proto.SetConnectionConfigResponse, error) GetSupportedOperations(req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, error) EstablishCacheConnection() (proto.WrapperPlugin_EstablishCacheConnectionClient, error) }
type WrapperPluginServer ¶
type WrapperPluginServer interface { GetSchema(req *proto.GetSchemaRequest) (*proto.GetSchemaResponse, error) Execute(req *proto.ExecuteRequest, stream proto.WrapperPlugin_ExecuteServer) error SetConnectionConfig(req *proto.SetConnectionConfigRequest) (*proto.SetConnectionConfigResponse, error) SetAllConnectionConfigs(req *proto.SetAllConnectionConfigsRequest) (*proto.SetConnectionConfigResponse, error) GetSupportedOperations(req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, error) EstablishCacheConnection(server proto.WrapperPlugin_EstablishCacheConnectionServer) error }
this is the interface for the plugin service NOTE there are 2 versions - the server interface (implemented by the actual plugin) - the client interface (implemented by the client stub) this is because the signature of the client and server are difference when using grpc streaming