Documentation ¶
Index ¶
- Constants
- Variables
- func Serve(a Interface)
- func SetTrace(traceHandle io.Writer)
- type ApplyOptions
- type CDSTemplateExtension
- type Client
- type Common
- type IApplyOptions
- type Interface
- type MapVar
- type Parameters
- type RPCClient
- func (c *RPCClient) ActionsNeeded() []string
- func (c *RPCClient) Apply(opts IApplyOptions) (sdk.Application, error)
- func (c *RPCClient) Author() string
- func (c *RPCClient) Description() string
- func (c *RPCClient) Identifier() string
- func (c *RPCClient) Init(opts plugin.IOptions) string
- func (c *RPCClient) Name() string
- func (c *RPCClient) Parameters() []sdk.TemplateParam
- func (c *RPCClient) Type() string
- type RPCServer
- func (s *RPCServer) ActionsNeeded(args interface{}, resp *[]string) error
- func (s *RPCServer) Apply(args interface{}, resp *sdk.Application) error
- func (s *RPCServer) Author(args interface{}, resp *string) error
- func (s *RPCServer) Description(args interface{}, resp *string) error
- func (s *RPCServer) Identifier(args interface{}, resp *string) error
- func (s *RPCServer) Init(args interface{}, resp *string) error
- func (s *RPCServer) Name(args interface{}, resp *string) error
- func (s *RPCServer) Parameters(args interface{}, resp *[]sdk.TemplateParam) error
- func (s *RPCServer) Type(args interface{}, resp *string) error
Constants ¶
const ( MaxTries = 5 RequestTimeout = time.Minute AuthHeader = "X_AUTH_HEADER" RequestedWithValue = "X-CDS-SDK" RequestedWithHeader = "X-Requested-With" )
HTTP Constants
Variables ¶
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "CDS_TEMPLATE_MAGIC_COOKIE",
MagicCookieValue: "Q0RTX1RFTVBMQVRFX01BR0lDX0NPT0tJRQ==",
}
Handshake is the HandshakeConfig used to configure clients and servers.
var ( //Trace is a debug logger Trace *log.Logger )
Functions ¶
Types ¶
type ApplyOptions ¶
ApplyOptions represents struct for Apply func arg
func NewApplyOptions ¶
func NewApplyOptions(proj, app string, params Parameters) ApplyOptions
NewApplyOptions instanciate a ApplyOptions struct
func (ApplyOptions) ApplicationName ¶
func (o ApplyOptions) ApplicationName() string
ApplicationName returns the application name
func (ApplyOptions) Parameters ¶
func (o ApplyOptions) Parameters() MapVar
Parameters returns the list of parameters
func (ApplyOptions) ProjetKey ¶
func (o ApplyOptions) ProjetKey() string
ProjetKey returns the project key
type CDSTemplateExtension ¶
type CDSTemplateExtension struct {
Interface
}
CDSTemplateExtension is the implementation of plugin.Plugin so we can serve/consume this
func (CDSTemplateExtension) Client ¶
func (a CDSTemplateExtension) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
Client must return an implementation of our interface that communicates over an RPC client. We return CDSActionRPC for this.
func (CDSTemplateExtension) PluginName ¶
func (a CDSTemplateExtension) PluginName() string
PluginName is name for the plugin
func (CDSTemplateExtension) Server ¶
func (a CDSTemplateExtension) Server(*plugin.MuxBroker) (interface{}, error)
Server must return an RPC server for this plugin type. We construct a RPCServer for this.
type Client ¶
type Client struct { *plugin.Client // contains filtered or unexported fields }
Client must be used from client side to call the plugin. It's managing plugin instanciation and initializing
type Common ¶
type Common struct{}
Common is the base plugin struct every plugin should be composed by
type IApplyOptions ¶
IApplyOptions represents interface for Apply func arg
type Interface ¶
type Interface interface { Init(plugin.IOptions) string Name() string Description() string Identifier() string Author() string Type() string Parameters() []sdk.TemplateParam ActionsNeeded() []string Apply(opts IApplyOptions) (sdk.Application, error) }
Interface is the interface for template extensions
type Parameters ¶
Parameters represents the parameters map expected bu the template
func NewParameters ¶
func NewParameters(d map[string]string) *Parameters
NewParameters instanciates a parameters struct
func (Parameters) Get ¶
func (d Parameters) Get(k string) string
Get returns the value in the map for the key k
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient is the client for the template extension
func (*RPCClient) ActionsNeeded ¶
func (*RPCClient) Apply ¶
func (c *RPCClient) Apply(opts IApplyOptions) (sdk.Application, error)
Apply create a fresh new CDS application from the template extension
func (*RPCClient) Description ¶
Description returns the description of the template extension
func (*RPCClient) Identifier ¶
Identifier returns the identifier of the template extension
func (*RPCClient) Parameters ¶
func (c *RPCClient) Parameters() []sdk.TemplateParam
Parameters returns the list of template parameters
type RPCServer ¶
type RPCServer struct {
Impl Interface
}
RPCServer is the struct called to serve the plugin
func (*RPCServer) ActionsNeeded ¶
ActionsNeeded returns the list of needed action of the template
func (*RPCServer) Apply ¶
func (s *RPCServer) Apply(args interface{}, resp *sdk.Application) error
Apply returns an application instance ready to persist in database
func (*RPCServer) Description ¶
Description returns the description of the template
func (*RPCServer) Identifier ¶
Identifier returns the identifier of the template
func (*RPCServer) Parameters ¶
func (s *RPCServer) Parameters(args interface{}, resp *[]sdk.TemplateParam) error
Parameters returns parameters of the template