serve

package
v0.2.0-rc2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MPL-2.0 Imports: 17 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	MagicCookieKey:   "CQ_PLUGIN_COOKIE",
	MagicCookieValue: "6753812e-79c2-4af5-ad01-e6083c374e1f",
}

Functions

func Debug

func Debug(ctx context.Context, providerName string, opts *Options) error

Debug starts a debug server and controls its lifecycle, printing the information needed for CloudQuery to connect to the provider via stdout. os.Interrupt will be captured and used to stop the server.

func ParseReattachProviders

func ParseReattachProviders(reattachPath string) (map[string]*plugin.ReattachConfig, error)

parse information on reattaching to unmanaged providers out of a JSON-encoded environment variable.

func Serve

func Serve(opts *Options)

Types

type Options

type Options struct {
	// Required: Name of provider.
	Name string

	// Required: Provider is the actual provider that will be served.
	Provider cqproto.CQProviderServer

	// Optional: Logger is the logger that go-plugin will use.
	Logger hclog.Logger

	// Optional: Set NoLogOutputOverride to not override the log output with an hclog
	// adapter. This should only be used when running the plugin in
	// acceptance tests.
	NoLogOutputOverride bool

	// TestConfig should only be set when the provider is being tested; it
	// will opt out of go-plugin's lifecycle management and other features,
	// and will use the supplied configuration options to control the
	// plugin's lifecycle and communicate connection information. See the
	// go-plugin GoDoc for more information.
	TestConfig *plugin.ServeTestConfig
}

type ReattachConfig

type ReattachConfig struct {
	Protocol string
	Pid      int
	Test     bool
	Addr     ReattachConfigAddr
}

ReattachConfig holds the information needed to be able to attach itself to a provider process, so it can drive the process.

func DebugServe

func DebugServe(ctx context.Context, opts *Options) (ReattachConfig, <-chan struct{}, error)

DebugServe starts a plugin server in debug mode; this should only be used when the provider will manage its own lifecycle. It is not recommended for normal usage; Serve is the correct function for that.

type ReattachConfigAddr

type ReattachConfigAddr struct {
	Network string
	String  string
}

ReattachConfigAddr is a JSON-encoding friendly version of net.Addr.

Jump to

Keyboard shortcuts

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