Documentation ¶
Index ¶
- func Check(err error, exitCode int, msg string)
- func CheckOk(ok bool, exitCode int, msg string)
- func PluginDebug(debugOutput interface{})
- func PluginRun(pluginDescriptor PluginDescriptor)
- type Action
- type AdditionalLogin
- type ConfigParamsDescriptor
- type Credential
- func AutoCredential(name string, value interface{}) (c Credential)
- func AutoTextFileCredential(name string, value interface{}, saveAs string) (c Credential)
- func TextCredential(name string, value string) Credential
- func TextFileCredential(name string, value string, rows int, cols int, saveAs string) Credential
- type FeatureDescriptor
- type Input
- type Output
- type PluginDescriptor
- type RequestParamsDescriptor
- type SSHHost
- type SSHHostList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PluginDebug ¶
func PluginDebug(debugOutput interface{})
PluginDebug prints the interface and exits. *NOT* for production
func PluginRun ¶
func PluginRun(pluginDescriptor PluginDescriptor)
PluginRun is to be run by the implementing plugin
Types ¶
type AdditionalLogin ¶
type AdditionalLogin struct { UserInfo map[string]string `json:"user_info"` AccessToken string `json:"access_token"` }
AdditionalLogin type
type ConfigParamsDescriptor ¶
type ConfigParamsDescriptor struct { Name string `json:"name"` Type string `json:"type"` Default interface{} `json:"default"` }
ConfigParamsDescriptor for the PluginDescriptor
type Credential ¶
type Credential map[string]interface{}
Credential to be created by request
func AutoCredential ¶
func AutoCredential(name string, value interface{}) (c Credential)
AutoCredential returns a credential which tries to derive type and other attributes
func AutoTextFileCredential ¶
func AutoTextFileCredential(name string, value interface{}, saveAs string) (c Credential)
AutoTextFileCredential returns a credential which tries to derive type and other attributes takes a filename for the case that the credential is a textfile
func TextCredential ¶
func TextCredential(name string, value string) Credential
TextCredential returns a text credential with valid type
func TextFileCredential ¶
TextFileCredential returns a textfile credential with valid type
type FeatureDescriptor ¶
type FeatureDescriptor struct {
Stdin bool `json:"stdin"`
}
FeatureDescriptor for the PluginDescriptor
type Input ¶
type Input struct { WaTTSVersion string `json:"watts_version"` Action string `json:"action"` Conf map[string]interface{} `json:"conf_params"` Params map[string]interface{} `json:"params"` CredentialState string `json:"cred_state"` AccessToken string `json:"access_token"` UserInfo map[string]interface{} `json:"user_info"` AdditionalLogins []AdditionalLogin `json:"additional_logins"` WaTTSUserID string `json:"watts_userid"` }
Input type
func (*Input) PublicKeyFromParams ¶
PublicKeyFromParams get a public key from the parameters also validates the amount of parts of the public key
func (*Input) SSHHostFromConf ¶
SSHHostFromConf SSH Host from config values
func (*Input) SSHHostListFromConf ¶
func (pi *Input) SSHHostListFromConf(hostListKey string) SSHHostList
SSHHostListFromConf get ssh hosts from a space separated list of ssh hosts
type Output ¶
type Output map[string]interface{}
Output represents the plugins json output
func PluginAdditionalLogin ¶
PluginAdditionalLogin to be returned by request if an additional login is needed
func PluginError ¶
PluginError call to indicate an error in the logs, but not to the user
func PluginGoodRequest ¶
func PluginGoodRequest(credential []Credential, credentialState string) Output
PluginGoodRequest to be returned by request if the request yielded a credential
func PluginGoodRevoke ¶
func PluginGoodRevoke() Output
PluginGoodRevoke to be returned by revoke if the revoke succeeded
func PluginUserError ¶
PluginUserError call to indicate an error in the logs and separately to the user
type PluginDescriptor ¶
type PluginDescriptor struct { Author string Version string Description string Name string DeveloperEmail string Actions map[string]Action ConfigParams []ConfigParamsDescriptor RequestParams []RequestParamsDescriptor Features FeatureDescriptor }
PluginDescriptor describes a plugin to be executed by the wattsPluginLib
type RequestParamsDescriptor ¶
type RequestParamsDescriptor struct { Key string `json:"key"` Name string `json:"name"` Description string `json:"description"` Type string `json:"type"` Mandatory bool `json:"mandatory"` }
RequestParamsDescriptor for the PluginDescriptor
type SSHHost ¶
type SSHHost string
SSHHost for RunSSHCommand
func (*SSHHost) RunSSHCommand ¶
RunSSHCommand run command the SSHHost
type SSHHostList ¶
type SSHHostList []SSHHost
SSHHostList for RunSSHCommand
func (*SSHHostList) RunSSHCommand ¶
func (h *SSHHostList) RunSSHCommand(cmdParts ...string) []string
RunSSHCommand run command on all hosts in the host list