Documentation ¶
Index ¶
- Constants
- Variables
- func NewClient(pluginPath string) *gplugin.Client
- func Serve(opts *ServeOpts)
- func SetupPluginCommunication()
- type CancelContextResponse
- type ConfigManager
- type ConfigManagerClient
- type ConfigManagerPlugin
- type ConfigManagerServer
- type ConfigManagerSetupConfigArgs
- type ConfigManagerSetupConfigResponse
- type ConfigTemplateResolverClient
- type ConfigTemplateResolverResolveValueWithTemplatesArgs
- type ConfigTemplateResolverResolveValueWithTemplatesResponse
- type ConfigTemplateResolverServer
- type Definitions
- type DefinitionsClient
- type DefinitionsPlugin
- type DefinitionsServer
- type DelegateExecutor
- type DelegateExecutorClient
- type DelegateExecutorExecDelegateArgs
- type DelegateExecutorExecDelegateResponse
- type DelegateExecutorGetDefinitionsResponse
- type DelegateExecutorGetTypesResponse
- type DelegateExecutorServer
- type DelegateFunc
- type DelegatePlugin
- type InfraUsageCollector
- type InfraUsageCollectorClient
- type InfraUsageCollectorFunc
- type InfraUsageCollectorGetSupportedInfrasResponse
- type InfraUsageCollectorGetUsageInfoArgs
- type InfraUsageCollectorGetUsageInfoResponse
- type InfraUsageCollectorPlugin
- type InfraUsageCollectorServer
- type OperationExecutor
- type OperationExecutorClient
- func (c *OperationExecutorClient) ExecAsyncOperation(ctx context.Context, conf config.Configuration, ...) (*prov.Action, time.Duration, error)
- func (c *OperationExecutorClient) ExecOperation(ctx context.Context, conf config.Configuration, ...) error
- func (c *OperationExecutorClient) GetSupportedArtifactTypes() ([]string, error)
- type OperationExecutorExecOperationArgs
- type OperationExecutorExecOperationResponse
- type OperationExecutorGetTypesResponse
- type OperationExecutorServer
- type OperationFunc
- type OperationPlugin
- type RPCContextCanceller
- type RPCError
- type ServeOpts
Constants ¶
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 ¶
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 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 ¶
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.
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 ¶
func (s *ConfigManagerServer) SetupConfig(args *ConfigManagerSetupConfigArgs, reply *ConfigManagerSetupConfigResponse) error
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 ¶
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 ¶
func (s *ConfigTemplateResolverServer) ResolveValueWithTemplates(args *ConfigTemplateResolverResolveValueWithTemplatesArgs, reply *ConfigTemplateResolverResolveValueWithTemplatesResponse) error
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 ¶
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 ¶
DefinitionsPlugin is public for use by reflexion and should be considered as private to this package. Please do not use it directly.
type DefinitionsServer ¶
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 ¶
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 ¶
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 ¶
func (s *DelegateExecutorServer) ExecDelegate(args *DelegateExecutorExecDelegateArgs, reply *DelegateExecutorExecDelegateResponse) error
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.
type InfraUsageCollector ¶
type InfraUsageCollector interface { prov.InfraUsageCollector GetSupportedInfras() ([]string, error) }
InfraUsageCollector is an extension of prov.InfraStructureUsageCollector
type InfraUsageCollectorClient ¶
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 ¶
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.
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 ¶
func (s *InfraUsageCollectorServer) GetUsageInfo(args *InfraUsageCollectorGetUsageInfoArgs, reply *InfraUsageCollectorGetUsageInfoResponse) error
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 ¶
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 ¶
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 ¶
func (s *OperationExecutorServer) ExecOperation(args *OperationExecutorExecOperationArgs, reply *OperationExecutorExecOperationResponse) error
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.
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 ¶
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 ¶
NewRPCError allows to instantiate a RPCError from an error builtin type
func NewRPCErrorFromMessage ¶
NewRPCErrorFromMessage allows to instantiate a RPCError from a message and variadic arguments
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.