Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterCommands(registrar rsapi.APICommandRegistrar)
- type API
- func (a *API) BuildRequest(resource, action, href string, params rsapi.APIParams) (*http.Request, error)
- func (api *API) DebugCookbookPathLocator(href string) *DebugCookbookPathLocator
- func (api *API) EnvLocator(href string) *EnvLocator
- func (api *API) ProcLocator(href string) *ProcLocator
- func (api *API) Rl10Locator(href string) *Rl10Locator
- func (a *API) RunCommand(cmd string) (*http.Response, error)
- func (a *API) ShowAPIActions(cmd string) error
- func (a *API) ShowCommandHelp(cmd string) error
- func (api *API) TSSControlLocator(href string) *TSSControlLocator
- func (api *API) TSSLocator(href string) *TSSLocator
- type DebugCookbookPath
- type DebugCookbookPathLocator
- type Env
- type EnvLocator
- type Href
- type Proc
- type ProcLocator
- type Rl10
- type Rl10Locator
- type TSS
- type TSSControl
- type TSSControlLocator
- type TSSLocator
Constants ¶
const (
// APIName is used by rsc to display the command line help.
APIName = "RightScale RightLink10 API"
)
const APIVersion = "unversioned"
API Version
Variables ¶
var GenMetadata = map[string]*metadata.Resource{ "DebugCookbookPath": &metadata.Resource{ Name: "DebugCookbookPath", Description: `Manipulate debug cookbook directory location`, Actions: []*metadata.Action{ &metadata.Action{ Name: "show", Description: `Retrieve debug cookbook directory location`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "GET", Pattern: "/rll/debug/cookbook", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/debug/cookbook`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, &metadata.Action{ Name: "update", Description: `Set debug cookbook directory location`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "PUT", Pattern: "/rll/debug/cookbook", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/debug/cookbook`), }, }, CommandFlags: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "path", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: true, NonBlank: false, }, }, APIParams: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "path", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: true, NonBlank: false, }, }, }, &metadata.Action{ Name: "delete", Description: `Remove debug cookbook directory location`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "DELETE", Pattern: "/rll/debug/cookbook", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/debug/cookbook`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, }, }, "Env": &metadata.Resource{ Name: "Env", Description: `Manipulate global script environment variables`, Actions: []*metadata.Action{ &metadata.Action{ Name: "index", Description: `Retrieve all environment variables`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "GET", Pattern: "/rll/env", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/env`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, &metadata.Action{ Name: "show", Description: `Retrieve environment variable value`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "GET", Pattern: "/rll/env/%s", Variables: []string{"name"}, Regexp: regexp.MustCompile(`/rll/env/([^/]+)`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, &metadata.Action{ Name: "update", Description: `Set environment variable value`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "PUT", Pattern: "/rll/env/%s", Variables: []string{"name"}, Regexp: regexp.MustCompile(`/rll/env/([^/]+)`), }, }, CommandFlags: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "payload", Description: ``, Type: "string", Location: metadata.PayloadParam, Mandatory: true, NonBlank: false, }, }, Payload: "string", APIParams: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "payload", Description: ``, Type: "string", Location: metadata.PayloadParam, Mandatory: true, NonBlank: false, }, }, }, &metadata.Action{ Name: "delete", Description: `Delete environment variable`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "DELETE", Pattern: "/rll/env/%s", Variables: []string{"name"}, Regexp: regexp.MustCompile(`/rll/env/([^/]+)`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, }, }, "Proc": &metadata.Resource{ Name: "Proc", Description: `List of process variables, such as version, identity, and protocol_version`, Actions: []*metadata.Action{ &metadata.Action{ Name: "index", Description: `List all process variables`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "GET", Pattern: "/rll/proc", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/proc`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, &metadata.Action{ Name: "show", Description: `Retrieve process variable value`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "GET", Pattern: "/rll/proc/%s", Variables: []string{"name"}, Regexp: regexp.MustCompile(`/rll/proc/([^/]+)`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, }, }, "Rl10": &metadata.Resource{ Name: "Rl10", Description: `Miscellaneous RightLink 10 local requests`, Actions: []*metadata.Action{ &metadata.Action{ Name: "upgrade", Description: `Relaunch the RightLink process using a specified binary`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "POST", Pattern: "/rll/upgrade", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/upgrade`), }, }, CommandFlags: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "exec", Description: `Absolute path to binary`, Type: "string", Location: metadata.QueryParam, Mandatory: true, NonBlank: false, }, }, APIParams: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "exec", Description: `Absolute path to binary`, Type: "string", Location: metadata.QueryParam, Mandatory: true, NonBlank: false, }, }, }, &metadata.Action{ Name: "run_recipe", Description: `Run git-based scripts (as recipes) synchronously`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "POST", Pattern: "/rll/run/recipe", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/run/recipe`), }, }, CommandFlags: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "arguments", Description: `Script argument values`, Type: "map", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "json", Description: `JSON hash of "name": "value" pairs`, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "recipe", Description: `Name of recipe`, Type: "string", Location: metadata.QueryParam, Mandatory: true, NonBlank: false, }, }, APIParams: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "arguments", Description: `Script argument values`, Type: "map[string]interface{}", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "json", Description: `JSON hash of "name": "value" pairs`, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "recipe", Description: `Name of recipe`, Type: "string", Location: metadata.QueryParam, Mandatory: true, NonBlank: false, }, }, }, &metadata.Action{ Name: "run_right_script", Description: `Run RightScripts synchronously`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "POST", Pattern: "/rll/run/right_script", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/run/right_script`), }, }, CommandFlags: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "arguments", Description: `Script argument values`, Type: "map", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "right_script", Description: `Name of script`, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "right_script_id", Description: `Id of script`, Type: "int", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, }, APIParams: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "arguments", Description: `Script argument values`, Type: "map[string]interface{}", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "right_script", Description: `Name of script`, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "right_script_id", Description: `Id of script`, Type: "int", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, }, }, }, }, "TSS": &metadata.Resource{ Name: "TSS", Description: `Manipulate the TSS proxy (this is deprecated, please use the /rll/tss/control resource)`, Actions: []*metadata.Action{ &metadata.Action{ Name: "get_hostname", Description: `Get the TSS hostname to proxy (deprecated, RL10 knows the hostname)`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "GET", Pattern: "/rll/tss/hostname", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/tss/hostname`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, &metadata.Action{ Name: "put_hostname", Description: `Set the TSS hostname to proxy (deprecated, RL10 knows the hostname)`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "PUT", Pattern: "/rll/tss/hostname", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/tss/hostname`), }, }, CommandFlags: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "hostname", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: true, NonBlank: false, }, }, APIParams: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "hostname", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: true, NonBlank: false, }, }, }, }, }, "TSSControl": &metadata.Resource{ Name: "TSSControl", Description: `Manipulate monitoring (TSS) settings`, Actions: []*metadata.Action{ &metadata.Action{ Name: "show", Description: `Show monitoring features`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "GET", Pattern: "/rll/tss/control", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/tss/control`), }, }, CommandFlags: []*metadata.ActionParam{}, APIParams: []*metadata.ActionParam{}, }, &metadata.Action{ Name: "update", Description: `Enable/disable monitoring features`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "PUT", Pattern: "/rll/tss/control", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/tss/control`), }, }, CommandFlags: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "enable_monitoring", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, ValidValues: []string{"false", "true", "none", "util", "extra", "all"}, }, &metadata.ActionParam{ Name: "tss_id", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, }, APIParams: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "enable_monitoring", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, ValidValues: []string{"false", "true", "none", "util", "extra", "all"}, }, &metadata.ActionParam{ Name: "tss_id", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, }, }, &metadata.Action{ Name: "put_control", Description: `Control the TSS monitoring (deprecated, use the /rll/tss/control resource)`, PathPatterns: []*metadata.PathPattern{ &metadata.PathPattern{ HTTPMethod: "PUT", Pattern: "/rll/tss/control", Variables: []string{}, Regexp: regexp.MustCompile(`/rll/tss/control`), }, }, CommandFlags: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "enable_monitoring", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "tss_id", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, }, APIParams: []*metadata.ActionParam{ &metadata.ActionParam{ Name: "enable_monitoring", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, &metadata.ActionParam{ Name: "tss_id", Description: ``, Type: "string", Location: metadata.QueryParam, Mandatory: false, NonBlank: false, }, }, }, }, }, }
Consists of a map of resource name to resource metadata.
Functions ¶
func RegisterCommands ¶
func RegisterCommands(registrar rsapi.APICommandRegistrar)
RegisterCommands registers all the commands with the kinpin application.
Types ¶
type API ¶
API is the RightLink 10 client.
func FromCommandLine ¶
func FromCommandLine(cmdLine *cmd.CommandLine) (*API, error)
FromCommandLine builds the API client from the command line.
func New ¶
func New(host string, auth rsapi.Authenticator) *API
New returns a client that uses RL10 authentication. accountId, host and auth arguments are not used. If no HTTP client is specified then the default client is used.
func NewRL10 ¶
NewRL10 returns a RL10 client that uses the information stored in /var/run/rightlink/secret to do auth and configure the host. The client behaves identically to the one returned by New in all other aspects.
func (*API) BuildRequest ¶
func (a *API) BuildRequest(resource, action, href string, params rsapi.APIParams) (*http.Request, error)
BuildRequest builds a HTTP request from a resource name and href and an action name and parameters. It is intended for generic clients that need to consume APIs in a generic maner. The method builds an HTTP request that can be fed to PerformRequest.
func (*API) DebugCookbookPathLocator ¶
func (api *API) DebugCookbookPathLocator(href string) *DebugCookbookPathLocator
DebugCookbookPathLocator builds a locator from the given href.
func (*API) EnvLocator ¶
func (api *API) EnvLocator(href string) *EnvLocator
EnvLocator builds a locator from the given href.
func (*API) ProcLocator ¶
func (api *API) ProcLocator(href string) *ProcLocator
ProcLocator builds a locator from the given href.
func (*API) Rl10Locator ¶
func (api *API) Rl10Locator(href string) *Rl10Locator
Rl10Locator builds a locator from the given href.
func (*API) RunCommand ¶
RunCommand parses and runs the command with the given name.
func (*API) ShowAPIActions ¶
ShowAPIActions displays the command hrefs.
func (*API) ShowCommandHelp ¶
ShowCommandHelp displays the command help.
func (*API) TSSControlLocator ¶
func (api *API) TSSControlLocator(href string) *TSSControlLocator
TSSControlLocator builds a locator from the given href.
func (*API) TSSLocator ¶
func (api *API) TSSLocator(href string) *TSSLocator
TSSLocator builds a locator from the given href.
type DebugCookbookPath ¶
type DebugCookbookPath struct { }
Manipulate debug cookbook directory location
type DebugCookbookPathLocator ¶
type DebugCookbookPathLocator struct { Href // contains filtered or unexported fields }
DebugCookbookPathLocator exposes the DebugCookbookPath resource actions.
func (*DebugCookbookPathLocator) Delete ¶
func (loc *DebugCookbookPathLocator) Delete() error
DELETE /rll/debug/cookbook
Remove debug cookbook directory location
func (*DebugCookbookPathLocator) Show ¶
func (loc *DebugCookbookPathLocator) Show() (string, error)
GET /rll/debug/cookbook
Retrieve debug cookbook directory location
type EnvLocator ¶
type EnvLocator struct { Href // contains filtered or unexported fields }
EnvLocator exposes the Env resource actions.
func (*EnvLocator) Delete ¶
func (loc *EnvLocator) Delete() error
DELETE /rll/env/:name
Delete environment variable
func (*EnvLocator) Index ¶
func (loc *EnvLocator) Index() (string, error)
GET /rll/env
Retrieve all environment variables
func (*EnvLocator) Show ¶
func (loc *EnvLocator) Show() (string, error)
GET /rll/env/:name
Retrieve environment variable value
type Href ¶
type Href string
An Href contains the relative path to a resource or resource collection, e.g. "/api/servers/123" or "/api/servers".
func (*Href) ActionPath ¶
func (r *Href) ActionPath(rName, aName string) (*metadata.ActionPath, error)
ActionPath computes the path to the given resource action. For example given the href "/api/servers/123" calling ActionPath with resource "servers" and action "clone" returns the path "/api/servers/123/clone" and verb POST. The algorithm consists of extracting the variables from the href by looking up a matching pattern from the resource metadata. The variables are then substituted in the action path. If there are more than one pattern that match the href then the algorithm picks the one that can substitute the most variables.
type Proc ¶
type Proc struct { }
List of process variables, such as version, identity, and protocol_version
type ProcLocator ¶
type ProcLocator struct { Href // contains filtered or unexported fields }
ProcLocator exposes the Proc resource actions.
func (*ProcLocator) Index ¶
func (loc *ProcLocator) Index() (string, error)
GET /rll/proc
List all process variables
func (*ProcLocator) Show ¶
func (loc *ProcLocator) Show() (string, error)
GET /rll/proc/:name
Retrieve process variable value
type Rl10Locator ¶
type Rl10Locator struct { Href // contains filtered or unexported fields }
Rl10Locator exposes the Rl10 resource actions.
func (*Rl10Locator) RunRecipe ¶
POST /rll/run/recipe
Run git-based scripts (as recipes) synchronously
func (*Rl10Locator) RunRightScript ¶
func (loc *Rl10Locator) RunRightScript(options rsapi.APIParams) (string, error)
POST /rll/run/right_script
Run RightScripts synchronously
type TSS ¶
type TSS struct { }
Manipulate the TSS proxy (this is deprecated, please use the /rll/tss/control resource)
type TSSControlLocator ¶
type TSSControlLocator struct { Href // contains filtered or unexported fields }
TSSControlLocator exposes the TSSControl resource actions.
func (*TSSControlLocator) PutControl ¶
func (loc *TSSControlLocator) PutControl(options rsapi.APIParams) (string, error)
PUT /rll/tss/control
Control the TSS monitoring (deprecated, use the /rll/tss/control resource)
func (*TSSControlLocator) Show ¶
func (loc *TSSControlLocator) Show() (string, error)
GET /rll/tss/control
Show monitoring features
type TSSLocator ¶
type TSSLocator struct { Href // contains filtered or unexported fields }
TSSLocator exposes the TSS resource actions.
func (*TSSLocator) GetHostname ¶
func (loc *TSSLocator) GetHostname() (string, error)
GET /rll/tss/hostname
Get the TSS hostname to proxy (deprecated, RL10 knows the hostname)
func (*TSSLocator) PutHostname ¶
func (loc *TSSLocator) PutHostname(hostname string) (string, error)
PUT /rll/tss/hostname
Set the TSS hostname to proxy (deprecated, RL10 knows the hostname)