Documentation ¶
Index ¶
- type Check
- type CombinedResponse
- type Response
- type Runner
- func (r *Runner) Cluster(ctx context.Context, list bool, selectiveChecks ...string) (*CombinedResponse, error)
- func (r *Runner) Load(reader io.Reader) error
- func (r *Runner) LoadFromFile(path string) error
- func (r *Runner) PostStart(ctx context.Context, list bool, selectiveChecks ...string) (*CombinedResponse, error)
- func (r *Runner) PreStart(ctx context.Context, list bool, selectiveChecks ...string) (*CombinedResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct { // Cmd is a path to executable (script or binary) and arguments Cmd []string `json:"cmd"` // Description provides a basic check description. Description string `json:"description"` // Timeout is defines a custom script timeout. Timeout string `json:"timeout"` // Roles is a list of DC/OS roles (e.g. master, agent). Node must be one of roles // to execute a check. Roles []string `json:"roles"` }
Check is a basic structure that describes DC/OS check.
type CombinedResponse ¶
type CombinedResponse struct {
// contains filtered or unexported fields
}
CombinedResponse represents a parent structure for multiple checks.
func NewCombinedResponse ¶
func NewCombinedResponse(list bool) *CombinedResponse
NewCombinedResponse initiates a new instance of CombinedResponse.
func (CombinedResponse) MarshalJSON ¶
func (cr CombinedResponse) MarshalJSON() ([]byte, error)
MarshalJSON is a custom json marshaller implementation used to return the appropriate response based on user input. combinedResponseError is used to return back error message if runner was unable to execute a check. CombinedResponse.Checks is used to return back a list of checks without executing them, combinedResponseSuccess is used to return user the actual checks output.
func (CombinedResponse) Status ¶
func (cr CombinedResponse) Status() int
Status returns checks combined status.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response provides a command Response.
func (Response) MarshalJSON ¶
MarshalJSON is a custom json marshaller implementation used to return output based on user request. responseList is returned if a user requested to list the checks. response is used to return back the result with populated Output and executable return code.
type Runner ¶
type Runner struct { ClusterChecks map[string]*Check `json:"cluster_checks"` NodeChecks struct { Checks map[string]*Check `json:"checks"` PreStart []string `json:"prestart"` PostStart []string `json:"poststart"` } `json:"node_checks"` CheckEnv map[string]string `json:"check_env"` // contains filtered or unexported fields }
Runner is a main instance of DC/OS check runner.
func NewRunner ¶
NewRunner returns an initialized instance of *Runner. It returns an error if the role is not master or agent.
func (*Runner) Cluster ¶
func (r *Runner) Cluster(ctx context.Context, list bool, selectiveChecks ...string) (*CombinedResponse, error)
Cluster executes cluster runner defined in config.
func (*Runner) LoadFromFile ¶
LoadFromFile opens a config file and try to load the values to Runner struct.