expansions

package
v0.0.0-...-1d50e38 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExpansionsPluginName = "expansions"
	UpdateVarsCmdName    = "update"
)
View Source
const FetchVarsCmdname = "fetch"
View Source
const FetchVarsRoute = "fetch_vars"

Variables

This section is empty.

Functions

func FetchVarsHandler

func FetchVarsHandler(w http.ResponseWriter, r *http.Request)

FetchVarsHandler is an API hook for returning the project variables associated with a task's project.

Types

type ExpansionVars

type ExpansionVars map[string]string

type ExpansionsPlugin

type ExpansionsPlugin struct{}

ExpansionsPlugin handles updating expansions in a task at runtime.

func (*ExpansionsPlugin) Configure

func (self *ExpansionsPlugin) Configure(map[string]interface{}) error

func (*ExpansionsPlugin) GetAPIHandler

func (self *ExpansionsPlugin) GetAPIHandler() http.Handler

GetRoutes registers the API handler for fetching expansion variables from the API server.

func (*ExpansionsPlugin) Name

func (self *ExpansionsPlugin) Name() string

Name fulfills the Plugin interface.

func (*ExpansionsPlugin) NewCommand

func (self *ExpansionsPlugin) NewCommand(cmdName string) (plugin.Command, error)

NewCommand fulfills the Plugin interface.

type FetchCommandParams

type FetchCommandParams struct {
	// RemoteKey indicates which key in the projects vars map to use as the lvalue
	RemoteKey string `mapstructure:"remote_key" json:"remote_key"`

	// LocalKey indicates which key in the local expansions map to use as the rvalue
	LocalKey string `mapstructure:"local_key" json:"local_key"`
}

FetchCommandParams is a pairing of remote key and local key values

type FetchVarsCommand

type FetchVarsCommand struct {
	Keys []FetchCommandParams `mapstructure:"keys" json:"keys"`
}

FetchVarsCommand pulls a set of vars (stored in the DB on the server side) and updates the agent's expansions map using the values it gets back

func (*FetchVarsCommand) Execute

func (self *FetchVarsCommand) Execute(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator,
	conf *model.TaskConfig,
	stop chan bool) error

Execute fetches the expansions from the API server

func (*FetchVarsCommand) Name

func (self *FetchVarsCommand) Name() string

func (*FetchVarsCommand) ParseParams

func (self *FetchVarsCommand) ParseParams(params map[string]interface{}) error

ParseParams reads in the command's config. Fulfills the Command interface.

func (*FetchVarsCommand) Plugin

func (self *FetchVarsCommand) Plugin() string

type PutCommandParams

type PutCommandParams struct {
	// The name of the expansion
	Key string

	// The expanded value
	Value string

	// Can optionally concat a string to the end of the current value
	Concat string
}

PutCommandParams are pairings of expansion names and the value they expand to

type UpdateCommand

type UpdateCommand struct {
	// Key-value pairs for updating the task's parameters with
	Updates []PutCommandParams `mapstructure:"updates"`

	// Filename for a yaml file containing expansion updates
	// in the form of
	//   "expansion_key: expansions_value"
	YamlFile string `mapstructure:"file"`
}

UpdateCommand reads in a set of new expansions and updates the task's expansions at runtime. UpdateCommand can take a list of update expansion pairs and/or a file of expansion pairs

func (*UpdateCommand) Execute

func (self *UpdateCommand) Execute(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator, conf *model.TaskConfig, stop chan bool) error

Execute updates the expansions. Fulfills Command interface.

func (*UpdateCommand) ExecuteUpdates

func (self *UpdateCommand) ExecuteUpdates(conf *model.TaskConfig) error

func (*UpdateCommand) Name

func (self *UpdateCommand) Name() string

func (*UpdateCommand) ParseParams

func (self *UpdateCommand) ParseParams(params map[string]interface{}) error

ParseParams validates the input to the UpdateCommand, returning and error if something is incorrect. Fulfills Command interface.

func (*UpdateCommand) Plugin

func (self *UpdateCommand) Plugin() string

Jump to

Keyboard shortcuts

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