plugin

package
v3.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DelegatePluginName is the name of Delegates Plugins it could be used as a lookup key in Client.Dispense
	DelegatePluginName = "delegate"
	// DefinitionsPluginName is the name of Delegates Plugins it could be used as a lookup key in Client.Dispense
	DefinitionsPluginName = "definitions"
	// ConfigManagerPluginName is the name of ConfigManager plugin it could be used as a lookup key in Client.Dispense
	ConfigManagerPluginName = "cfgManager"
	// OperationPluginName is the name of Operation Plugins it could be used as a lookup key in Client.Dispense
	OperationPluginName = "operation"
	// InfraUsageCollectorPluginName is the name of InfraUsageCollector Plugins it could be used as a lookup key in Client.Dispense
	InfraUsageCollectorPluginName = "infraUsageCollector"
)

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  3,
	MagicCookieKey:   "YORC_PLUG_API",
	MagicCookieValue: "a3292e718f7c96578aae47e92b7475394e72e6da3de3455554462ba15dde56d1b3187ad0e5f809f50767e0d10ca6944fdf4c6c412380d3aa083b9e8951f7101e",
}

HandshakeConfig are used to just do a basic handshake between a plugin and host. If the handshake fails, a user friendly error is shown. This prevents users from executing bad plugins or executing a plugin directory. It is a UX feature, not a security feature.

Functions

func NewClient

func NewClient(pluginPath string) *gplugin.Client

NewClient returns a properly configured plugin client for a given plugin path

func Serve

func Serve(opts *ServeOpts)

Serve serves a plugin. This function never returns and should be the final function called in the main function of the plugin.

func SetupPluginCommunication

func SetupPluginCommunication()

SetupPluginCommunication makes mandatory actions to allow RPC calls btw server and plugins This must be called both by serve and each plugin

Types

type CancelContextResponse

type CancelContextResponse struct{}

CancelContextResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigManager

type ConfigManager interface {
	SetupConfig(cfg config.Configuration) error
}

ConfigManager allows to send configuration to the plugin

This is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigManagerClient

type ConfigManagerClient struct {
	Client *rpc.Client
	Broker *plugin.MuxBroker
}

ConfigManagerClient is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*ConfigManagerClient) SetupConfig

func (c *ConfigManagerClient) SetupConfig(cfg config.Configuration) error

SetupConfig is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigManagerPlugin

type ConfigManagerPlugin struct {
	PluginConfigManager ConfigManager
}

ConfigManagerPlugin is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*ConfigManagerPlugin) Client

func (p *ConfigManagerPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*ConfigManagerPlugin) Server

func (p *ConfigManagerPlugin) Server(b *plugin.MuxBroker) (interface{}, error)

Server is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigManagerServer

type ConfigManagerServer struct {
	PluginConfigManager ConfigManager
	Broker              *plugin.MuxBroker
}

ConfigManagerServer is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*ConfigManagerServer) SetupConfig

SetupConfig is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigManagerSetupConfigArgs

type ConfigManagerSetupConfigArgs struct {
	Cfg config.Configuration
	ID  uint32
}

ConfigManagerSetupConfigArgs is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigManagerSetupConfigResponse

type ConfigManagerSetupConfigResponse struct {
	Error *RPCError
}

ConfigManagerSetupConfigResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigTemplateResolverClient

type ConfigTemplateResolverClient struct {
	Client *rpc.Client
}

ConfigTemplateResolverClient is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*ConfigTemplateResolverClient) ResolveValueWithTemplates

func (c *ConfigTemplateResolverClient) ResolveValueWithTemplates(key string, value interface{}) interface{}

ResolveValueWithTemplates is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*ConfigTemplateResolverClient) SetTemplatesFunctions

func (c *ConfigTemplateResolverClient) SetTemplatesFunctions(fm template.FuncMap)

SetTemplatesFunctions is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigTemplateResolverResolveValueWithTemplatesArgs

type ConfigTemplateResolverResolveValueWithTemplatesArgs struct {
	Key   string
	Value interface{}
}

ConfigTemplateResolverResolveValueWithTemplatesArgs is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigTemplateResolverResolveValueWithTemplatesResponse

type ConfigTemplateResolverResolveValueWithTemplatesResponse struct {
	Value interface{}
}

ConfigTemplateResolverResolveValueWithTemplatesResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type ConfigTemplateResolverServer

type ConfigTemplateResolverServer struct{}

ConfigTemplateResolverServer is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*ConfigTemplateResolverServer) ResolveValueWithTemplates

ResolveValueWithTemplates is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type Definitions

type Definitions interface {
	// GetDefinitions returns a map of definition names / definition content
	GetDefinitions() (map[string][]byte, error)
}

Definitions is the interface that allows a plugin to export TOSCA definitions

type DefinitionsClient

type DefinitionsClient struct {
	Client *rpc.Client
}

DefinitionsClient is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DefinitionsClient) GetDefinitions

func (c *DefinitionsClient) GetDefinitions() (map[string][]byte, error)

GetDefinitions is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DefinitionsPlugin

type DefinitionsPlugin struct {
	Definitions map[string][]byte
}

DefinitionsPlugin is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DefinitionsPlugin) Client

func (p *DefinitionsPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DefinitionsPlugin) Server

func (p *DefinitionsPlugin) Server(b *plugin.MuxBroker) (interface{}, error)

Server is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DefinitionsServer

type DefinitionsServer struct {
	Definitions map[string][]byte
}

DefinitionsServer is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DefinitionsServer) GetDefinitions

func (s *DefinitionsServer) GetDefinitions(_ interface{}, reply *DelegateExecutorGetDefinitionsResponse) error

GetDefinitions is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DelegateExecutor

type DelegateExecutor interface {
	prov.DelegateExecutor
	// Returns a list of regexp matches for node types
	GetSupportedTypes() ([]string, error)
}

DelegateExecutor is an extension of prov.DelegateExecutor that expose its supported node types

type DelegateExecutorClient

type DelegateExecutorClient struct {
	Broker *plugin.MuxBroker
	Client *rpc.Client
}

DelegateExecutorClient is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DelegateExecutorClient) ExecDelegate

func (c *DelegateExecutorClient) ExecDelegate(ctx context.Context, conf config.Configuration, taskID, deploymentID, nodeName, delegateOperation string) error

ExecDelegate is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DelegateExecutorClient) GetSupportedTypes

func (c *DelegateExecutorClient) GetSupportedTypes() ([]string, error)

GetSupportedTypes is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DelegateExecutorExecDelegateArgs

type DelegateExecutorExecDelegateArgs struct {
	ChannelID         uint32
	Conf              config.Configuration
	TaskID            string
	DeploymentID      string
	NodeName          string
	DelegateOperation string
	LogOptionalFields events.LogOptionalFields
}

DelegateExecutorExecDelegateArgs is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DelegateExecutorExecDelegateResponse

type DelegateExecutorExecDelegateResponse struct {
	Error *RPCError
}

DelegateExecutorExecDelegateResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DelegateExecutorGetDefinitionsResponse

type DelegateExecutorGetDefinitionsResponse struct {
	Definitions map[string][]byte
	Error       *RPCError
}

DelegateExecutorGetDefinitionsResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DelegateExecutorGetTypesResponse

type DelegateExecutorGetTypesResponse struct {
	SupportedTypes []string
	Error          *RPCError
}

DelegateExecutorGetTypesResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DelegateExecutorServer

type DelegateExecutorServer struct {
	Broker         *plugin.MuxBroker
	Delegate       prov.DelegateExecutor
	SupportedTypes []string
}

DelegateExecutorServer is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DelegateExecutorServer) ExecDelegate

ExecDelegate is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DelegateExecutorServer) GetSupportedTypes

func (s *DelegateExecutorServer) GetSupportedTypes(_ interface{}, reply *DelegateExecutorGetTypesResponse) error

GetSupportedTypes is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type DelegateFunc

type DelegateFunc func() prov.DelegateExecutor

DelegateFunc is a function that is called when creating a plugin server

type DelegatePlugin

type DelegatePlugin struct {
	F              func() prov.DelegateExecutor
	SupportedTypes []string
}

DelegatePlugin is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DelegatePlugin) Client

func (p *DelegatePlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*DelegatePlugin) Server

func (p *DelegatePlugin) Server(b *plugin.MuxBroker) (interface{}, error)

Server is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type InfraUsageCollector

type InfraUsageCollector interface {
	prov.InfraUsageCollector
	GetSupportedInfras() ([]string, error)
}

InfraUsageCollector is an extension of prov.InfraStructureUsageCollector

type InfraUsageCollectorClient

type InfraUsageCollectorClient struct {
	Broker *plugin.MuxBroker
	Client *rpc.Client
}

InfraUsageCollectorClient is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*InfraUsageCollectorClient) GetSupportedInfras

func (c *InfraUsageCollectorClient) GetSupportedInfras() ([]string, error)

GetSupportedInfras is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*InfraUsageCollectorClient) GetUsageInfo

func (c *InfraUsageCollectorClient) GetUsageInfo(ctx context.Context, cfg config.Configuration, taskID, infraName string) (map[string]interface{}, error)

GetUsageInfo is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type InfraUsageCollectorFunc

type InfraUsageCollectorFunc func() prov.InfraUsageCollector

InfraUsageCollectorFunc is a function that is called when creating a plugin server

type InfraUsageCollectorGetSupportedInfrasResponse

type InfraUsageCollectorGetSupportedInfrasResponse struct {
	Infras []string
	Error  *RPCError
}

InfraUsageCollectorGetSupportedInfrasResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type InfraUsageCollectorGetUsageInfoArgs

type InfraUsageCollectorGetUsageInfoArgs struct {
	ChannelID         uint32
	Conf              config.Configuration
	TaskID            string
	InfraName         string
	LogOptionalFields events.LogOptionalFields
}

InfraUsageCollectorGetUsageInfoArgs is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type InfraUsageCollectorGetUsageInfoResponse

type InfraUsageCollectorGetUsageInfoResponse struct {
	UsageInfo map[string]interface{}
	Error     *RPCError
}

InfraUsageCollectorGetUsageInfoResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type InfraUsageCollectorPlugin

type InfraUsageCollectorPlugin struct {
	F               func() prov.InfraUsageCollector
	SupportedInfras []string
}

InfraUsageCollectorPlugin is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*InfraUsageCollectorPlugin) Client

func (p *InfraUsageCollectorPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*InfraUsageCollectorPlugin) Server

func (p *InfraUsageCollectorPlugin) Server(b *plugin.MuxBroker) (interface{}, error)

Server is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type InfraUsageCollectorServer

type InfraUsageCollectorServer struct {
	Broker              *plugin.MuxBroker
	InfraUsageCollector prov.InfraUsageCollector
	SupportedInfras     []string
}

InfraUsageCollectorServer is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*InfraUsageCollectorServer) GetSupportedInfras

func (s *InfraUsageCollectorServer) GetSupportedInfras(_ interface{}, reply *InfraUsageCollectorGetSupportedInfrasResponse) error

GetSupportedInfras is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*InfraUsageCollectorServer) GetUsageInfo

GetUsageInfo is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type OperationExecutor

type OperationExecutor interface {
	prov.OperationExecutor
	// Returns a list of regexp matches for node types
	GetSupportedArtifactTypes() ([]string, error)
}

OperationExecutor is an extension of prov.OperationExecutor that expose its supported node types

type OperationExecutorClient

type OperationExecutorClient struct {
	Broker *plugin.MuxBroker
	Client *rpc.Client
}

OperationExecutorClient is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*OperationExecutorClient) ExecAsyncOperation

func (c *OperationExecutorClient) ExecAsyncOperation(ctx context.Context, conf config.Configuration, taskID, deploymentID, nodeName string, operation prov.Operation, stepName string) (*prov.Action, time.Duration, error)

ExecAsyncOperation is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*OperationExecutorClient) ExecOperation

func (c *OperationExecutorClient) ExecOperation(ctx context.Context, conf config.Configuration, taskID, deploymentID, nodeName string, operation prov.Operation) error

ExecOperation is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*OperationExecutorClient) GetSupportedArtifactTypes

func (c *OperationExecutorClient) GetSupportedArtifactTypes() ([]string, error)

GetSupportedArtifactTypes is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type OperationExecutorExecOperationArgs

type OperationExecutorExecOperationArgs struct {
	ChannelID         uint32
	Conf              config.Configuration
	TaskID            string
	DeploymentID      string
	NodeName          string
	Operation         prov.Operation
	LogOptionalFields events.LogOptionalFields
}

OperationExecutorExecOperationArgs is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type OperationExecutorExecOperationResponse

type OperationExecutorExecOperationResponse struct {
	Error *RPCError
}

OperationExecutorExecOperationResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type OperationExecutorGetTypesResponse

type OperationExecutorGetTypesResponse struct {
	SupportedTypes []string
	Error          *RPCError
}

OperationExecutorGetTypesResponse is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type OperationExecutorServer

type OperationExecutorServer struct {
	Broker         *plugin.MuxBroker
	OpExecutor     prov.OperationExecutor
	SupportedTypes []string
}

OperationExecutorServer is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*OperationExecutorServer) ExecOperation

ExecOperation is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*OperationExecutorServer) GetSupportedArtifactTypes

func (s *OperationExecutorServer) GetSupportedArtifactTypes(_ interface{}, reply *OperationExecutorGetTypesResponse) error

GetSupportedArtifactTypes is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type OperationFunc

type OperationFunc func() prov.OperationExecutor

OperationFunc is a function that is called when creating a plugin server

type OperationPlugin

type OperationPlugin struct {
	F              func() prov.OperationExecutor
	SupportedTypes []string
}

OperationPlugin is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*OperationPlugin) Client

func (p *OperationPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*OperationPlugin) Server

func (p *OperationPlugin) Server(b *plugin.MuxBroker) (interface{}, error)

Server is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type RPCContextCanceller

type RPCContextCanceller struct {
	CancelFunc context.CancelFunc
}

RPCContextCanceller is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

func (*RPCContextCanceller) CancelContext

func (r *RPCContextCanceller) CancelContext(nothing interface{}, resp *CancelContextResponse) error

CancelContext is public for use by reflexion and should be considered as private to this package. Please do not use it directly.

type RPCError

type RPCError struct {
	Message string
	Stack   string
}

RPCError is a wrapper dedicated to allow passing errors via RPC encoding It must be used for RPC server side in the response call method (ie plugin side actually)

func NewRPCError

func NewRPCError(err error) *RPCError

NewRPCError allows to instantiate a RPCError from an error builtin type

func NewRPCErrorFromMessage

func NewRPCErrorFromMessage(m string, args ...interface{}) *RPCError

NewRPCErrorFromMessage allows to instantiate a RPCError from a message and variadic arguments

func (*RPCError) Error

func (pErr *RPCError) Error() string

This allows RPCError to implement error and display message plus stack

type ServeOpts

type ServeOpts struct {
	DelegateFunc                       DelegateFunc
	DelegateSupportedTypes             []string
	Definitions                        map[string][]byte
	OperationFunc                      OperationFunc
	OperationSupportedArtifactTypes    []string
	InfraUsageCollectorFunc            InfraUsageCollectorFunc
	InfraUsageCollectorSupportedInfras []string
}

ServeOpts are the configurations to serve a plugin.

Jump to

Keyboard shortcuts

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