shared

package
v2.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package shared contains shared data between the host and plugins.

Index

Constants

This section is empty.

Variables

View Source
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) GetSchema

func (*GRPCClient) SetConnectionConfig

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) Execute

func (*GRPCServer) GetSchema

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 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)
	GetSupportedOperations(req *proto.GetSupportedOperationsRequest) (*proto.GetSupportedOperationsResponse, 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL