Documentation
¶
Overview ¶
Package power is the power behavior: reboot or shut down the host. Each method is an action with the execute permission, power:execute, so the operator role has it and the automation role does not. The host goes down, so no example runs on a live host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Behavior = behavior.Register(behavior.Define( "power", "Reboot or shut down the host", behavior.Node, behavior.API, behavior.Area(area.Node), behavior.CLI, behavior.Platform(behavior.PlatformDebian, newDebian), action("reboot", Reboot, "Reboot the host", "-r"), action("shutdown", Shutdown, "Shut the host down", "-h"), ))
Behavior is the power definition.
Functions ¶
This section is empty.
Types ¶
type Input ¶
type Input struct {
Delay int `` /* 151-byte string literal not displayed */
Message string `json:"message,omitempty" validate:"omitempty" doc:"A message to the logged-in users first."`
}
Input is when the host goes down, and what its users read first.
type Provider ¶
type Provider interface {
Reboot(ctx context.Context, in Input) (Result, error)
Shutdown(ctx context.Context, in Input) (Result, error)
}
Provider reboots or shuts down the host.
type Result ¶
type Result struct {
Action string `json:"action" doc:"reboot or shutdown"`
Delay int `json:"delay" doc:"Seconds before the host goes down."`
Changed bool `json:"changed" doc:"Always true: each run changes the host."`
}
Result is what the host does.