Documentation ¶
Overview ¶
Package statusio provides structs and functions for accessing version 2.0 of the Status.io API.
Successful API queries return native Go structs that can be used immediately, with no need for type assertions.
Authentication ¶
If you already have the API ID and API KEY for your user, creating the client is simple:
api := statusio.NewStatusioApi("your-api-id", "your-api-key")
Queries ¶
Executing queries is simple
statusSummary, _ := api.StatusSummary("your-statuspage-id") fmt.Print(result.Result.Status[0].Containers[0].Status)
Endpoints ¶
`statusio` implements most of the endpoints defined in the Status.io documentation: http://docs.statusio.apiary.io For clarity, in most cases, the function name is simply the name of the endpoint (e.g., the endpoint `status/summary` is provided by the function `StatusSummary`).
More detailed information about the behavior of each particular endpoint can be found at the official Status.io documentation.
Index ¶
- Constants
- type ComponentListResponse
- type ComponentStatus
- type ComponentUpdateResponse
- type Incident
- type IncidentCreateResponse
- type IncidentDeleteResponse
- type IncidentListByIDResponse
- type IncidentListResponse
- type IncidentMessageResponse
- type IncidentResolveResponse
- type IncidentResponse
- type IncidentSingleResponse
- type IncidentUpdateResponse
- type Maintenance
- type MaintenanceControl
- type MaintenanceDeleteResponse
- type MaintenanceFinishResponse
- type MaintenanceListByIDResponse
- type MaintenanceListResponse
- type MaintenanceMessageResponse
- type MaintenanceResponse
- type MaintenanceScheduleResponse
- type MaintenanceSingleResponse
- type MaintenanceStartResponse
- type MaintenanceUpdateResponse
- type Metric
- type MetricUpdateResponse
- type State
- type Status
- type StatusSummaryResponse
- type StatusioApi
- func (a StatusioApi) ComponentList(statusPageID string) (r ComponentListResponse, err error)
- func (a StatusioApi) ComponentUpdate(status ComponentStatus) (r ComponentUpdateResponse, err error)
- func (a StatusioApi) IncidentCreate(incident Incident) (r IncidentCreateResponse, err error)
- func (a StatusioApi) IncidentDelete(incident Incident) (r IncidentDeleteResponse, err error)
- func (a StatusioApi) IncidentList(statusPageID string) (r IncidentListResponse, err error)
- func (a StatusioApi) IncidentListByID(statusPageID string) (r IncidentListByIDResponse, err error)
- func (a StatusioApi) IncidentMessage(statusPageID, messageID string) (r IncidentMessageResponse, err error)
- func (a StatusioApi) IncidentResolve(incident Incident) (r IncidentResolveResponse, err error)
- func (a StatusioApi) IncidentSingle(statusPageID, incidentID string) (r IncidentSingleResponse, err error)
- func (a StatusioApi) IncidentUpdate(incident Incident) (r IncidentUpdateResponse, err error)
- func (a StatusioApi) MaintenanceDelete(control MaintenanceControl) (r MaintenanceDeleteResponse, err error)
- func (a StatusioApi) MaintenanceFinish(control MaintenanceControl) (r MaintenanceFinishResponse, err error)
- func (a StatusioApi) MaintenanceList(statusPageID string) (r MaintenanceListResponse, err error)
- func (a StatusioApi) MaintenanceListByID(statusPageID string) (r MaintenanceListByIDResponse, err error)
- func (a StatusioApi) MaintenanceMessage(statusPageID, messageID string) (r MaintenanceMessageResponse, err error)
- func (a StatusioApi) MaintenanceSchedule(task Maintenance) (r MaintenanceScheduleResponse, err error)
- func (a StatusioApi) MaintenanceSingle(statusPageID, maintenanceID string) (r MaintenanceSingleResponse, err error)
- func (a StatusioApi) MaintenanceStart(control MaintenanceControl) (r MaintenanceStartResponse, err error)
- func (a StatusioApi) MaintenanceUpdate(control MaintenanceControl) (r MaintenanceUpdateResponse, err error)
- func (a StatusioApi) MetricUpdate(metric Metric) (r MetricUpdateResponse, err error)
- func (a StatusioApi) StatusSummary(statusPageId string) (r StatusSummaryResponse, err error)
- func (a StatusioApi) SubscriberAdd(subscriber Subscriber) (r SubscriberAddResponse, err error)
- func (a StatusioApi) SubscriberList(statuspage_id string) (r SubscriberListResponse, err error)
- func (a StatusioApi) SubscriberRemove(subscriber Subscriber) (r SubscriberRemoveResponse, err error)
- func (a StatusioApi) SubscriberUpdate(subscriber Subscriber) (r SubscriberUpdateResponse, err error)
- type Subscriber
- type SubscriberAddResponse
- type SubscriberListResponse
- type SubscriberRemoveResponse
- type SubscriberResponse
- type SubscriberUpdateResponse
Constants ¶
const ( STATE_INVESTIGATING = 100 // Deprecated: use StateInvestigating instead STATE_IDENTIFIED = 200 // Deprecated: use StateIdentified instead STATE_MONITORING = 300 // Deprecated: use StateMonitoring instead STATUS_OPERATIONAL = 100 // Deprecated: use StatusOperational instead STATUS_PLANNED_MAINTENANCE = 200 // Deprecated: use StatusPlannedMaintenance instead STATUS_DEGRADED_PERFORMANCE = 300 // Deprecated: use StatusDegradedPerformance instead STATUS_PARTIAL_SERVICE_DISRUPTION = 400 // Deprecated: use StatusPartialServiceDisruption instead STATUS_SERVICE_DISRUPTION = 500 // Deprecated: use StatusServiceDisruption instead STATUS_SECURITY_EVENT = 600 // Deprecated: use StatusSecurityEvent instead )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComponentListResponse ¶
type ComponentListResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result []struct { ID string `json:"_id"` Statuspage string `json:"statuspage"` HookKey string `json:"hook_key"` Containers []struct { ID string `json:"_id"` Name string `json:"name"` V int `json:"__v"` LocationGeo struct { QueryType string `json:"query_type"` Name string `json:"name"` Description string `json:"description"` Region string `json:"region"` Country string `json:"country"` Address string `json:"address"` Host string `json:"host"` Coords []string `json:"coords"` } `json:"location_geo"` Location string `json:"location"` } `json:"containers"` History []struct { MessageId string `json:"message_id"` Id string `json:"_id"` Datetime string `json:"datetime"` } `json:"history"` Name string `json:"name"` V int `json:"__v"` Position int `json:"position"` Description string `json:"description"` } `json:"result"` }
type ComponentStatus ¶
type ComponentUpdateResponse ¶
type Incident ¶
type Incident struct { StatuspageID string `json:"statuspage_id"` IncidentID string `json:"incident_id,omitempty"` IncidentName string `json:"incident_name,omitempty"` IncidentDetails string `json:"incident_details"` MessageSubject string `json:"message_subject,omitempty"` NotifyEmail string `json:"notify_email"` NotifySms string `json:"notify_sms"` NotifyWebhook string `json:"notify_webhook"` Social string `json:"social"` Irc string `json:"irc,omitempty"` Hipchat string `json:"hipchat,omitempty"` Msteams string `json:"msteams,omitempty"` Slack string `json:"slack,omitempty"` CurrentStatus Status `json:"current_status,omitempty"` CurrentState State `json:"current_state,omitempty"` AllInfrastructureAffected string `json:"all_infrastructure_affected,omitempty"` InfrastructureAffected []string `json:"infrastructure_affected"` }
type IncidentCreateResponse ¶
type IncidentDeleteResponse ¶
type IncidentListResponse ¶
type IncidentListResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result struct { ActiveIncidents []IncidentResponse `json:"active_incidents"` ResolvedIncidents []IncidentResponse `json:"resolved_incidents"` } `json:"result"` }
type IncidentMessageResponse ¶
type IncidentMessageResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result struct { UserEmail string `json:"user_email"` UserFullName string `json:"user_full_name"` Details string `json:"details"` Source string `json:"source"` Social string `json:"social"` State State `json:"state"` Status Status `json:"status"` Statuspage string `json:"statuspage"` Incident string `json:"incident"` IP string `json:"ip"` ID string `json:"_id"` V int `json:"__v"` Datetime time.Time `json:"datetime"` Containers []string `json:"containers"` Components []string `json:"components"` } `json:"result"` }
type IncidentResolveResponse ¶
type IncidentResponse ¶
type IncidentResponse struct { V int `json:"__v"` ID string `json:"_id"` ComponentsAffected []struct { V int `json:"__v"` ID string `json:"_id"` Position int `json:"position"` Statuspage string `json:"statuspage"` Containers []string `json:"containers"` Name string `json:"name"` } `json:"components_affected"` ContainersAffected []struct { V int `json:"__v"` ID string `json:"_id"` Name string `json:"name"` Location string `json:"location"` } `json:"containers_affected"` DatetimeOpen time.Time `json:"datetime_open"` Kind string `json:"kind"` Messages []struct { Details string `json:"details"` Source string `json:"source"` State State `json:"state"` Status Status `json:"status"` Statuspage string `json:"statuspage"` Incident string `json:"incident"` IP string `json:"ip"` ID string `json:"_id"` V int `json:"__v"` Datetime time.Time `json:"datetime"` Containers []string `json:"containers"` Components []string `json:"components"` } `json:"messages"` Name string `json:"name"` PostMortemUrl string `json:"post_mortem_url"` Statuspage string `json:"statuspage"` }
type IncidentSingleResponse ¶
type IncidentSingleResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result []IncidentResponse `json:"result"` }
type IncidentUpdateResponse ¶
type Maintenance ¶
type Maintenance struct { StatuspageID string `json:"statuspage_id"` AllInfrastructureAffected string `json:"all_infrastructure_affected,omitempty"` InfrastructureAffected []string `json:"infrastructure_affected"` Automation string `json:"automation"` MaintenanceName string `json:"maintenance_name"` MaintenanceDetails string `json:"maintenance_details"` MessageSubject string `json:"message_subject,omitempty"` DatePlannedStart string `json:"date_planned_start"` TimePlannedStart string `json:"time_planned_start"` DatePlannedEnd string `json:"date_planned_end"` TimePlannedEnd string `json:"time_planned_end"` MaintenanceNotifyNow string `json:"maintenance_notify_now"` MaintenanceNotify72Hr string `json:"maintenance_notify_72_hr"` MaintenanceNotify24Hr string `json:"maintenance_notify_24_hr"` MaintenanceNotify1Hr string `json:"maintenance_notify_1_hr"` }
type MaintenanceControl ¶
type MaintenanceControl struct { StatuspageID string `json:"statuspage_id"` MaintenanceID string `json:"maintenance_id"` MaintenanceDetails string `json:"maintenance_details,omitempty"` MessageSubject string `json:"message_subject,omitempty"` NotifyEmail string `json:"notify_email"` NotifySms string `json:"notify_sms"` NotifyWebhook string `json:"notify_webhook"` Social string `json:"social"` Irc string `json:"irc,omitempty"` Hipchat string `json:"hipchat,omitempty"` Msteams string `json:"msteams,omitempty"` Slack string `json:"slack,omitempty"` }
type MaintenanceListByIDResponse ¶
type MaintenanceListByIDResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result struct { ActiveMaintenances []string `json:"active_maintenances"` UpcomingMaintenances []string `json:"upcoming_maintenances"` ResolvedMaintenances []string `json:"resolved_maintenances"` } `json:"result"` }
type MaintenanceListResponse ¶
type MaintenanceListResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result struct { ActiveMaintenances []MaintenanceResponse `json:"active_maintenances"` UpcomingMaintenances []MaintenanceResponse `json:"upcoming_maintenances"` ResolvedMaintenances []MaintenanceResponse `json:"resolved_maintenances"` } `json:"result"` }
type MaintenanceMessageResponse ¶
type MaintenanceMessageResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result struct { Details string `json:"details"` Source string `json:"source"` State int `json:"state"` Statuspage string `json:"statuspage"` Maintenance string `json:"maintenance"` IP string `json:"ip"` ID string `json:"_id"` V int `json:"__v"` Datetime time.Time `json:"datetime"` Containers []string `json:"containers"` Components []string `json:"components"` } `json:"result"` }
type MaintenanceResponse ¶
type MaintenanceResponse struct { V int `json:"__v"` ID string `json:"_id"` ComponentsAffected []struct { V int `json:"__v"` ID string `json:"_id"` Position int `json:"position"` Statuspage string `json:"statuspage"` Containers []string `json:"containers"` Name string `json:"name"` } `json:"components_affected"` ContainersAffected []struct { V int `json:"__v"` ID string `json:"_id"` Name string `json:"name"` Location string `json:"location"` } `json:"containers_affected"` DatetimeOpen time.Time `json:"datetime_open"` DatetimePlannedEnd time.Time `json:"datetime_planned_end"` DatetimePlannedStart time.Time `json:"datetime_planned_start"` Kind string `json:"kind"` Messages []struct { Details string `json:"details"` Source string `json:"source"` State int `json:"state"` Status int `json:"status"` Statuspage string `json:"statuspage"` Maintenance string `json:"maintenance"` IP string `json:"ip"` ID string `json:"_id"` V int `json:"__v"` Datetime time.Time `json:"datetime"` Containers []string `json:"containers"` Components []string `json:"components"` } `json:"messages"` Name string `json:"name"` Statuspage string `json:"statuspage"` }
type MaintenanceSingleResponse ¶
type MaintenanceSingleResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result MaintenanceResponse `json:"result"` }
type Metric ¶
type Metric struct { StatuspageID string `json:"statuspage_id"` MetricID string `json:"metric_id"` DayAvg float64 `json:"day_avg"` DayStart int64 `json:"day_start"` DayDates []time.Time `json:"day_dates"` DayValues []float64 `json:"day_values"` WeekAvg float64 `json:"week_avg"` WeekStart int64 `json:"week_start"` WeekDates []time.Time `json:"week_dates"` WeekValues []float64 `json:"week_values"` MonthAvg float64 `json:"month_avg"` MonthStart int64 `json:"month_start"` MonthDates []time.Time `json:"month_dates"` MonthValues []float64 `json:"month_values"` }
type MetricUpdateResponse ¶
type StatusSummaryResponse ¶
type StatusSummaryResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result struct { Status []struct { ID string `json:"id"` Name string `json:"name"` Updated time.Time `json:"updated"` Status string `json:"status"` StatusCode int `json:"status_code"` Containers []struct { ID string `json:"id"` Name string `json:"name"` Updated time.Time `json:"updated"` Status string `json:"status"` StatusCode int `json:"status_code"` } `json:"containers"` } `json:"status"` StatusOverall struct { Updated time.Time `json:"updated"` Status string `json:"status"` StatusCode int `json:"status_code"` } `json:"status_overall"` Incidents []struct { ID string `json:"_id"` Name string `json:"name"` DateTimeOpen time.Time `json:"datetime_open"` Status string `json:"status"` StatusCode int `json:"status_code"` Messages []struct { Details string `json:"details"` DateTime time.Time `json:"datetime"` State int `json:"state"` Status int `json:"status"` } `json:"messages"` Components []struct { ID string `json:"_id"` Name string `json:"name"` } `json:"components_affected"` Containers []struct { ID string `json:"_id"` Name string `json:"name"` } `json:"containers_affected"` } `json:"incidents"` Maintenance struct { Active []struct { ID string `json:"_id"` Name string `json:"name"` DateTimeOpen time.Time `json:"datetime_open"` DateTimeStart time.Time `json:"datetime_planned_start"` DateTimeEnd time.Time `json:"datetime_planned_end"` Messages []struct { Details string `json:"details"` DateTime time.Time `json:"datetime"` State int `json:"state"` Status int `json:"status"` } `json:"messages"` Components []struct { ID string `json:"_id"` Name string `json:"name"` } `json:"components_affected"` Containers []struct { ID string `json:"_id"` Name string `json:"name"` } `json:"containers_affected"` } `json:"active"` Upcoming []struct { ID string `json:"_id"` Name string `json:"name"` DateTimeOpen time.Time `json:"datetime_open"` DateTimeStart time.Time `json:"datetime_planned_start"` DateTimeEnd time.Time `json:"datetime_planned_end"` Messages []struct { Details string `json:"details"` DateTime time.Time `json:"datetime"` State int `json:"state"` Status int `json:"status"` } `json:"messages"` Components []struct { ID string `json:"_id"` Name string `json:"name"` } `json:"components_affected"` Containers []struct { ID string `json:"_id"` Name string `json:"name"` } `json:"containers_affected"` } `json:"upcoming"` } `json:"maintenance"` } `json:"result"` }
type StatusioApi ¶
type StatusioApi struct { ApiId string ApiKey string HttpClient *http.Client // contains filtered or unexported fields }
func NewStatusioApi ¶
func NewStatusioApi(api_id string, api_key string) *StatusioApi
func (StatusioApi) ComponentList ¶
func (a StatusioApi) ComponentList(statusPageID string) (r ComponentListResponse, err error)
func (StatusioApi) ComponentUpdate ¶
func (a StatusioApi) ComponentUpdate(status ComponentStatus) (r ComponentUpdateResponse, err error)
func (StatusioApi) IncidentCreate ¶
func (a StatusioApi) IncidentCreate(incident Incident) (r IncidentCreateResponse, err error)
func (StatusioApi) IncidentDelete ¶
func (a StatusioApi) IncidentDelete(incident Incident) (r IncidentDeleteResponse, err error)
func (StatusioApi) IncidentList ¶
func (a StatusioApi) IncidentList(statusPageID string) (r IncidentListResponse, err error)
func (StatusioApi) IncidentListByID ¶
func (a StatusioApi) IncidentListByID(statusPageID string) (r IncidentListByIDResponse, err error)
func (StatusioApi) IncidentMessage ¶
func (a StatusioApi) IncidentMessage(statusPageID, messageID string) (r IncidentMessageResponse, err error)
func (StatusioApi) IncidentResolve ¶
func (a StatusioApi) IncidentResolve(incident Incident) (r IncidentResolveResponse, err error)
func (StatusioApi) IncidentSingle ¶
func (a StatusioApi) IncidentSingle(statusPageID, incidentID string) (r IncidentSingleResponse, err error)
func (StatusioApi) IncidentUpdate ¶
func (a StatusioApi) IncidentUpdate(incident Incident) (r IncidentUpdateResponse, err error)
func (StatusioApi) MaintenanceDelete ¶
func (a StatusioApi) MaintenanceDelete(control MaintenanceControl) (r MaintenanceDeleteResponse, err error)
func (StatusioApi) MaintenanceFinish ¶
func (a StatusioApi) MaintenanceFinish(control MaintenanceControl) (r MaintenanceFinishResponse, err error)
func (StatusioApi) MaintenanceList ¶
func (a StatusioApi) MaintenanceList(statusPageID string) (r MaintenanceListResponse, err error)
func (StatusioApi) MaintenanceListByID ¶
func (a StatusioApi) MaintenanceListByID(statusPageID string) (r MaintenanceListByIDResponse, err error)
func (StatusioApi) MaintenanceMessage ¶
func (a StatusioApi) MaintenanceMessage(statusPageID, messageID string) (r MaintenanceMessageResponse, err error)
func (StatusioApi) MaintenanceSchedule ¶
func (a StatusioApi) MaintenanceSchedule(task Maintenance) (r MaintenanceScheduleResponse, err error)
func (StatusioApi) MaintenanceSingle ¶
func (a StatusioApi) MaintenanceSingle(statusPageID, maintenanceID string) (r MaintenanceSingleResponse, err error)
func (StatusioApi) MaintenanceStart ¶
func (a StatusioApi) MaintenanceStart(control MaintenanceControl) (r MaintenanceStartResponse, err error)
func (StatusioApi) MaintenanceUpdate ¶
func (a StatusioApi) MaintenanceUpdate(control MaintenanceControl) (r MaintenanceUpdateResponse, err error)
func (StatusioApi) MetricUpdate ¶
func (a StatusioApi) MetricUpdate(metric Metric) (r MetricUpdateResponse, err error)
func (StatusioApi) StatusSummary ¶
func (a StatusioApi) StatusSummary(statusPageId string) (r StatusSummaryResponse, err error)
func (StatusioApi) SubscriberAdd ¶
func (a StatusioApi) SubscriberAdd(subscriber Subscriber) (r SubscriberAddResponse, err error)
func (StatusioApi) SubscriberList ¶
func (a StatusioApi) SubscriberList(statuspage_id string) (r SubscriberListResponse, err error)
func (StatusioApi) SubscriberRemove ¶
func (a StatusioApi) SubscriberRemove(subscriber Subscriber) (r SubscriberRemoveResponse, err error)
func (StatusioApi) SubscriberUpdate ¶
func (a StatusioApi) SubscriberUpdate(subscriber Subscriber) (r SubscriberUpdateResponse, err error)
type Subscriber ¶
type SubscriberAddResponse ¶
type SubscriberListResponse ¶
type SubscriberListResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result struct { Email []SubscriberResponse `json:"email"` Webhook []SubscriberResponse `json:"webhook"` Sms []SubscriberResponse `json:"sms"` } `json:"result"` }
type SubscriberResponse ¶
type SubscriberUpdateResponse ¶
type SubscriberUpdateResponse struct { Status struct { Error string `json:"error"` Message string `json:"message"` } `json:"status"` Result SubscriberResponse `json:"result"` }