Documentation ¶
Index ¶
Constants ¶
const ( // StatusSuccessful is the successful status. This is determined based on status // type. // // Task Status: Determined by the success of a task updating. The 5 most // recent task updates are stored as an ‘event’ in CTS. A task is successful // when the most recent stored event is successful. StatusSuccessful = "successful" // StatusErrored is the errored status. This is determined based on status // type. // // Task Status: Determined by the success of a task updating. The 5 most // recent task updates are stored as an ‘event’ in CTS. A task is errored // when the most recent stored event is not successful but all prior stored // events are successful. StatusErrored = "errored" // StatusCritical is the critical status. This is determined based on status // type. // // Task Status: Determined by the success of a task updating. The 5 most // recent task updates are stored as an ‘event’ in CTS. A task is critical // when the most recent stored event is not successful and at least one prior // stored event is all not successful. StatusCritical = "critical" // StatusUnknown is when the status is unknown. This is determined // based on status type. // // Task Status: Determined by the success of a task updating. The 5 most // recent task updates are stored as an ‘event’ in CTS. A task is // unknown when no event data has been collected yet. StatusUnknown = "unknown" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API supports api requests to the cts binary
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client to make api requests
func NewClient ¶
func NewClient(c *ClientConfig, httpClient httpClient) *Client
NewClient returns a client to make api requests
type ClientConfig ¶
type ClientConfig struct {
Port int
}
ClientConfig configures the client to make api requests
type EnabledSummary ¶
EnabledSummary is the count of how many tasks are enabled vs. disabled
type ErrorObject ¶
type ErrorObject struct {
Message string `json:"message"`
}
ErrorObject is the object to represent an error object from the API server
type ErrorResponse ¶
type ErrorResponse struct {
Error *ErrorObject `json:"error,omitempty"`
}
ErrorResponse is the object to represent an error response from the API server
func NewErrorResponse ¶
func NewErrorResponse(err error) ErrorResponse
NewErrorResponse creates a new API response for an error
func (ErrorResponse) ErrorMessage ¶
func (resp ErrorResponse) ErrorMessage() (string, bool)
ErrorMessage returns the error message if there is an error.
type OverallStatus ¶
type OverallStatus struct {
TaskSummary TaskSummary `json:"task_summary"`
}
OverallStatus is the overall status information for cts and across all the tasks
type QueryParam ¶
QueryParam sets query parameters for the api client
func (*QueryParam) Encode ¶
func (q *QueryParam) Encode() string
Encode returns QueryParameter values as a URL encoded string. No preceding '?' e.g. "include=events&status=critical"
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status can be used to query the status endpoints
func (*Status) Overall ¶
func (s *Status) Overall() (OverallStatus, error)
Overall is used to query for overall status
func (*Status) Task ¶
func (s *Status) Task(name string, q *QueryParam) (map[string]TaskStatus, error)
Task is used to query for task status(es).
name: task name or empty string for all tasks q: nil if no query parameters
type StatusSummary ¶
type StatusSummary struct { Successful int `json:"successful"` Errored int `json:"errored"` Critical int `json:"critical"` Unknown int `json:"unknown"` }
StatusSummary is the count of how many tasks have which status
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task can be used to query the task endpoints
func (*Task) Update ¶
func (t *Task) Update(name string, config UpdateTaskConfig, q *QueryParam) (UpdateTaskResponse, error)
Update is used to patch update task
type TaskStatus ¶
type TaskStatus struct { TaskName string `json:"task_name"` Status string `json:"status"` Enabled bool `json:"enabled"` Providers []string `json:"providers"` Services []string `json:"services"` EventsURL string `json:"events_url"` Events []event.Event `json:"events,omitempty"` }
TaskStatus is the status for a single task
type TaskSummary ¶
type TaskSummary struct { Status StatusSummary `json:"status"` Enabled EnabledSummary `json:"enabled"` }
TaskSummary holds data that summarizes the tasks configured with CTS
type UpdateTaskConfig ¶
type UpdateTaskConfig struct {
Enabled *bool `mapstructure:"enabled"`
}
UpdateTaskConfig contains the fields available for patch updating a task. Not all task configuration is available for update
type UpdateTaskResponse ¶
type UpdateTaskResponse struct {
Inspect *driver.InspectPlan `json:"inspect,omitempty"`
}