sdk

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect() (proto.GoferClient, context.Context, error)

Connect to Gofer's API

func NewExtension

func NewExtension(impl ExtensionServiceInterface)

NewExtension starts the provided extension service

func SendConfiguratorMessageToClient added in v0.6.0

func SendConfiguratorMessageToClient(stream proto.ExtensionService_RunPipelineConfiguratorServer, msg string) error

Convenience function for sending a message to the client without excessive bulk.

func SendConfiguratorParamSettingToClient added in v0.6.0

func SendConfiguratorParamSettingToClient(stream proto.ExtensionService_RunPipelineConfiguratorServer, param, value string) error

Convenience function for sending a message to the client without excessive bulk.

func SendConfiguratorQueryToClient added in v0.6.0

func SendConfiguratorQueryToClient(stream proto.ExtensionService_RunPipelineConfiguratorServer, query string) error

Convenience function for sending a query to the client without excessive bulk.

func SendInstallerConfigSettingToClient added in v0.6.0

func SendInstallerConfigSettingToClient(stream proto.ExtensionService_RunExtensionInstallerServer, config, value string) error

Convenience function for sending a message to the client without excessive bulk.

func SendInstallerMessageToClient added in v0.6.0

func SendInstallerMessageToClient(stream proto.ExtensionService_RunExtensionInstallerServer, msg string) error

Convenience function for sending a message to the client without excessive bulk.

func SendInstallerQueryToClient added in v0.6.0

func SendInstallerQueryToClient(stream proto.ExtensionService_RunExtensionInstallerServer, query string) error

Convenience function for sending a query to the client without excessive bulk.

Types

type ExtensionServiceInterface

type ExtensionServiceInterface interface {
	// Init tells the extension it should complete it's initialization phase and return when it is ready to serve requests.
	// This is useful because sometimes we'll want to start the extension, but not actually have it do anything
	// but serve only certain routes like the installation routes.
	Init(context.Context, *proto.ExtensionInitRequest) (*proto.ExtensionInitResponse, error)

	// Info returns information on the specific plugin
	Info(context.Context, *proto.ExtensionInfoRequest) (*proto.ExtensionInfoResponse, error)

	// Subscribe registers a pipeline with said extension to provide the extension's functionality.
	Subscribe(context.Context, *proto.ExtensionSubscribeRequest) (*proto.ExtensionSubscribeResponse, error)

	// Unsubscribe allows pipelines to remove their extension subscriptions.
	Unsubscribe(context.Context, *proto.ExtensionUnsubscribeRequest) (*proto.ExtensionUnsubscribeResponse, error)

	// Shutdown tells the extension to cleanup and gracefully shutdown. If a extension
	// does not shutdown in a time defined by the Gofer API the extension will
	// instead be Force shutdown(SIGKILL). This is to say that all extensions should
	// lean toward quick cleanups and shutdowns.
	Shutdown(context.Context, *proto.ExtensionShutdownRequest) (*proto.ExtensionShutdownResponse, error)

	// ExternalEvent are json blobs of Gofer's /events endpoint. Normally webhooks.
	ExternalEvent(context.Context, *proto.ExtensionExternalEventRequest) (*proto.ExtensionExternalEventResponse, error)

	// Run the installer that helps admin user install the extension.
	RunExtensionInstaller(stream proto.ExtensionService_RunExtensionInstallerServer) error

	// Run the installer that helps pipeline users with their pipeline extension
	// configuration.
	RunPipelineConfigurator(stream proto.ExtensionService_RunPipelineConfiguratorServer) error
}

ExtensionServiceInterface provides a light wrapper around the GRPC extension interface. This light wrapper provides the caller with a clear interface to implement and allows this package to bake in common functionality among all extensions.

type ExtensionSystemConfig

type ExtensionSystemConfig struct {
	// Key is the auth key passed by the main gofer application to prevent other
	// actors from attempting to communicate with the extensions.
	Key  string `required:"true" json:"-"`
	Name string `required:"true"`

	// Possible values "debug", "info", "warn", "error", "fatal", "panic"
	LogLevel string `split_words:"true" default:"info"`

	// Contains the raw bytes for a TLS cert used by the extension to authenticate clients.
	TLSCert string `split_words:"true" required:"true" json:"-"`
	TLSKey  string `split_words:"true" required:"true" json:"-"`

	// Skip verification of TLS cert; useful for development.
	SkipTLSVerify bool   `split_words:"true" default:"false"`
	Host          string `default:"0.0.0.0:8082"`
	GoferHost     string `split_words:"true" default:"localhost:8080"`
}

Used by the sdk to get environment variables that are required by all extensions.

func GetExtensionSystemConfig

func GetExtensionSystemConfig() (ExtensionSystemConfig, error)

GetExtensionSystemConfig returns environment variables that all extensions require. aka "System variables"

Jump to

Keyboard shortcuts

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