statusio

package module
v0.0.0-...-0f112e1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2020 License: MIT Imports: 6 Imported by: 6

Documentation

Overview

Package statusio provides a client for the public v2 api of pages powered by statusio

Index

Constants

This section is empty.

Variables

ComponentStatusValues represents all the possible values of the ComponetStatus iota

IncidentStatusValues represents all the possible values of an incident status

MaitenanceStatusValues represents all the possible values of the MaintenanceStatus enum

View Source
var StatusIndicatorValues = []StatusIndicator{None, Minor, Major, Critical}

StatusIndicatorValues represents all the possible values of the StatusIndicator iota

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseAddr string) *Client

NewClient creates a new statusio client for the *public api*. baseAddr is i.e. status.example.copm/api/v2/

func (*Client) GetActiveScheduledMaintenances

func (c *Client) GetActiveScheduledMaintenances() (ScheduledMaintenancesResponse, error)

GetActiveScheduledMaintenances gets a list of any upcoming maintenances. // This endpoint will only return scheduled maintenances in the In Progress or Verifying state.

func (*Client) GetAllScheduledMaintenances

func (c *Client) GetAllScheduledMaintenances() (ScheduledMaintenancesResponse, error)

GetAllScheduledMaintenances gets a list of the 50 most recent scheduled maintenances. This includes scheduled maintenances as described in the above two endpoints, as well as those in the Completed state.

func (*Client) GetComponents

func (c *Client) GetComponents() (ComponentsResponse, error)

GetComponents gets the components for the page. Each component is listed along with its status - one of operational, degraded_performance, partial_outage, or major_outage.

func (*Client) GetIncidentSubscribers

func (c *Client) GetIncidentSubscribers() NotImplemented

GetIncidentSubscribers is not implemented

func (*Client) GetIncidents

func (c *Client) GetIncidents() (IncidentsResponse, error)

GetIncidents returns a list of the 50 most recent incidents. This includes all unresolved incidents returned in GetUnresolvedIncidents, as well as those in the Resolved and Postmortem state.

func (*Client) GetPageSubscribers

func (c *Client) GetPageSubscribers() NotImplemented

GetPageSubscribers is not implemented

func (*Client) GetStatus

func (c *Client) GetStatus() (StatusResponse, error)

GetStatus returns rollup for the whole page. This endpoint includes an indicator - one of none, minor, major, or critical, as well as a human description of the blended component status. Examples of the blended status include "All Systems Operational", "Partial System Outage", and "Major Service Outage".

func (*Client) GetSummary

func (c *Client) GetSummary() (SummaryResponse, error)

GetSummary returns a summary of the status page, including a status indicator, component statuses, unresolved incidents, and any upcoming or in-progress scheduled maintenances.

func (*Client) GetUnresolvedIncidents

func (c *Client) GetUnresolvedIncidents() (IncidentsResponse, error)

GetUnresolvedIncidents gets a list of any unresolved incidents. This endpoint will only return incidents in the Investigating, Identified, or Monitoring state.

func (*Client) GetUpcomingScheduledMaintenances

func (c *Client) GetUpcomingScheduledMaintenances() (ScheduledMaintenancesResponse, error)

GetUpcomingScheduledMaintenances gets a list of any upcoming maintenances. This endpoint will only return scheduled maintenances still in the Scheduled state.

func (*Client) RemoveSubscription

func (c *Client) RemoveSubscription() NotImplemented

RemoveSubscription is not implemented

type Component

type Component struct {
	CreatedAt          *time.Time      `json:"created_at"`
	Description        interface{}     `json:"description"`
	Group              bool            `json:"group"`
	GroupID            interface{}     `json:"group_id"`
	ID                 string          `json:"id"`
	Name               string          `json:"name"`
	OnlyShowIfDegraded bool            `json:"only_show_if_degraded"`
	PageID             string          `json:"page_id"`
	Position           int             `json:"position"`
	Status             ComponentStatus `json:"status"`
	UpdatedAt          *time.Time      `json:"updated_at"`
}

type ComponentStatus

type ComponentStatus int
const (
	Operational         ComponentStatus = iota // operational
	DegradedPerformance                        // degraded_performance
	PartialOutage                              // partial_outage
	MajorOutage                                // major_outage
)

Comments are the JSON representation

func (ComponentStatus) MarshalJSON

func (r ComponentStatus) MarshalJSON() ([]byte, error)

MarshalJSON is generated so ComponentStatus satisfies json.Marshaler.

func (ComponentStatus) String

func (c ComponentStatus) String() string

func (*ComponentStatus) UnmarshalJSON

func (r *ComponentStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so ComponentStatus satisfies json.Unmarshaler.

type ComponentsResponse

type ComponentsResponse struct {
	Components []Component `json:"components"`
	Page       Page        `json:"page"`
}

type Incident

type Incident struct {
	CreatedAt       *time.Time       `json:"created_at"`
	ID              string           `json:"id"`
	Impact          StatusIndicator  `json:"impact"`
	IncidentUpdates []IncidentUpdate `json:"incident_updates"`
	MonitoringAt    *time.Time       `json:"monitoring_at"`
	Name            string           `json:"name"`
	PageID          string           `json:"page_id"`
	ResolvedAt      *time.Time       `json:"resolved_at"`
	Shortlink       string           `json:"shortlink"`
	Status          IncidentStatus   `json:"status"`
	UpdatedAt       *time.Time       `json:"updated_at"`
}

type IncidentStatus

type IncidentStatus int

IncidentStatus represents the status of an incident

const (
	Investigating IncidentStatus = iota // investigating
	Identified                          // identified
	Monitoring                          // monitoring
	Resolved                            // resolved
	PostMortem                          // post_mortem (?) Guessing, the documentation doesn't use the literals for this enum
)

Comments are the JSON representation

func (IncidentStatus) MarshalJSON

func (r IncidentStatus) MarshalJSON() ([]byte, error)

MarshalJSON is generated so IncidentStatus satisfies json.Marshaler.

func (IncidentStatus) String

func (i IncidentStatus) String() string

func (*IncidentStatus) UnmarshalJSON

func (r *IncidentStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so IncidentStatus satisfies json.Unmarshaler.

type IncidentUpdate

type IncidentUpdate struct {
	Body       string     `json:"body"`
	CreatedAt  *time.Time `json:"created_at"`
	DisplayAt  *time.Time `json:"display_at"`
	ID         string     `json:"id"`
	IncidentID string     `json:"incident_id"`
	Status     string     `json:"status"`
	UpdatedAt  *time.Time `json:"updated_at"`
}

type IncidentsResponse

type IncidentsResponse struct {
	Incidents []Incident `json:"incidents"`
	Page      Page       `json:"page"`
}

type MaintenanceStatus

type MaintenanceStatus int

MaintenanceStatus represents the status of a maintenance operation

const (
	Scheduled  MaintenanceStatus = iota // scheduled
	InProgress                          // in_progress  (?) Guessing, the documentation doesn't use the literals for this enum
	Verifying                           // verifying
	Completed                           // completed
)

Comments are the JSON representation

func (MaintenanceStatus) MarshalJSON

func (r MaintenanceStatus) MarshalJSON() ([]byte, error)

MarshalJSON is generated so MaintenanceStatus satisfies json.Marshaler.

func (MaintenanceStatus) String

func (m MaintenanceStatus) String() string

func (*MaintenanceStatus) UnmarshalJSON

func (r *MaintenanceStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so MaintenanceStatus satisfies json.Unmarshaler.

type NotImplemented

type NotImplemented bool

type Page

type Page struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	UpdatedAt *time.Time `json:"updated_at"`
	URL       string     `json:"url"`
}

Page is part of all status.io public api responses.

type ScheduledMaintenance

type ScheduledMaintenance struct {
	CreatedAt       *time.Time        `json:"created_at"`
	ID              string            `json:"id"`
	Impact          StatusIndicator   `json:"impact"`
	IncidentUpdates []IncidentUpdate  `json:"incident_updates"`
	MonitoringAt    *time.Time        `json:"monitoring_at"`
	Name            string            `json:"name"`
	PageID          string            `json:"page_id"`
	ResolvedAt      *time.Time        `json:"resolved_at"`
	ScheduledFor    *time.Time        `json:"scheduled_for"`
	ScheduledUntil  *time.Time        `json:"scheduled_until"`
	Shortlink       string            `json:"shortlink"`
	Status          MaintenanceStatus `json:"status"`
	UpdatedAt       *time.Time        `json:"updated_at"`
}

type ScheduledMaintenancesResponse

type ScheduledMaintenancesResponse struct {
	Page                  Page                   `json:"page"`
	ScheduledMaintenances []ScheduledMaintenance `json:"scheduled_maintenances"`
}

type StatusIndicator

type StatusIndicator int // ScheduledMaintenance Impact field seems to use the same enum

StatusIndicator is an enum used for general status and impact fields

const (
	None     StatusIndicator = iota // none
	Minor                           // minor
	Major                           // major
	Critical                        // critical
)

Comments are the JSON representation

func (StatusIndicator) MarshalJSON

func (r StatusIndicator) MarshalJSON() ([]byte, error)

MarshalJSON is generated so StatusIndicator satisfies json.Marshaler.

func (StatusIndicator) String

func (s StatusIndicator) String() string

func (*StatusIndicator) UnmarshalJSON

func (r *StatusIndicator) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so StatusIndicator satisfies json.Unmarshaler.

type StatusResponse

type StatusResponse struct {
	Page   Page `json:"page"`
	Status struct {
		Description string          `json:"description"`
		Indicator   StatusIndicator `json:"indicator"`
	} `json:"status"`
}

type SummaryResponse

type SummaryResponse struct {
	Components            []Component            `json:"components"`
	Incidents             []Incident             `json:"incidents"`
	Page                  Page                   `json:"page"`
	ScheduledMaintenances []ScheduledMaintenance `json:"scheduled_maintenances"`
	Status                struct {
		Description     string `json:"description"`
		StatusIndicator string `json:"indicator"`
	} `json:"status"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL