Help us shape the future of Go! Take the 2026 Go Developer Survey

statuspage

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: MIT Imports: 8 Imported by: 0

README

go-statuspage-api

Go library for StatusPage.io API

Usage

Base
package main

import "github.com/yfronto/go-statuspage-api"

const (
  apiKey = "....."
  pageID = "....."
)

func main() {
  c, err := statuspage.NewClient(apiKey, pageID)
  if err != nil {
    // ...
   }
   // Do stuff
}

Things are still in progress.

Documentation

Index

Constants

View Source
const DefaultAPIURL = "https://api.statuspage.io/v1/pages/"

Variables

This section is empty.

Functions

func WithHTTPClient added in v0.4.0

func WithHTTPClient(client *Client, c HTTPClient) error

Types

type Client

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

func NewClient

func NewClient(apiKey, pageID string) (*Client, error)

func (*Client) CreateHistoricIncident

func (c *Client) CreateHistoricIncident(name, message string, date time.Time) (*Incident, error)

func (*Client) CreateIncident

func (c *Client) CreateIncident(component, name, message, status string, componentIDs []string) (*Incident, error)

func (*Client) CreateSubscriber

func (c *Client) CreateSubscriber(email string) (*Subscriber, error)

func (*Client) DeleteIncident

func (c *Client) DeleteIncident(incident *Incident) (*Incident, error)

func (*Client) DeleteSubscriber

func (c *Client) DeleteSubscriber(subscriber *Subscriber) (*Subscriber, error)

func (*Client) GetAllComponents

func (c *Client) GetAllComponents() ([]Component, error)

func (*Client) GetAllIncidents

func (c *Client) GetAllIncidents() ([]Incident, error)

func (*Client) GetAllSubscribers

func (c *Client) GetAllSubscribers() ([]Subscriber, error)

func (*Client) GetComponentByID

func (c *Client) GetComponentByID(id string) (*Component, error)

func (*Client) GetComponentByName

func (c *Client) GetComponentByName(name string) (*Component, error)

func (*Client) GetComponentGroups added in v0.2.0

func (c *Client) GetComponentGroups() ([]ComponentGroup, error)

func (*Client) GetIncident added in v0.3.1

func (c *Client) GetIncident(incidentID string) (*Incident, error)

func (*Client) GetOpenIncidents

func (c *Client) GetOpenIncidents() ([]Incident, error)

func (*Client) GetScheduledIncidents

func (c *Client) GetScheduledIncidents() ([]Incident, error)

func (*Client) ScheduleIncident

func (c *Client) ScheduleIncident(component, name, message string, start, end time.Time, remind, autoInProgress, autoComplete bool) (*Incident, error)

func (*Client) UpdateComponentDesc

func (c *Client) UpdateComponentDesc(comp *Component) (*Component, error)

func (*Client) UpdateComponentName

func (c *Client) UpdateComponentName(comp *Component) (*Component, error)

func (*Client) UpdateComponentStatus

func (c *Client) UpdateComponentStatus(comp *Component) (*Component, error)

func (*Client) UpdateIncident

func (c *Client) UpdateIncident(incident *Incident, name, status, message string) (*Incident, error)

UpdateIncident updates an incident. If Status and/or Message are different, a new update will be published for the incident. Each change will add an update notification, so updates should be batched.

type Component

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

func (*Component) String

func (c *Component) String() string

type ComponentGroup added in v0.2.0

type ComponentGroup struct {
	Components *[]string  `json:"components,omitempty"`
	CreatedAt  *time.Time `json:"created_at,omitempty"`
	ID         *string    `json:"id,omitempty"`
	Name       *string    `json:"name,omitempty"`
	PageID     *string    `json:"page_id,omitempty"`
	Position   *int       `json:"position,omitempty"`
	UpdatedAt  *time.Time `json:"updated_at,omitempty"`
}

type ComponentStatus

type ComponentStatus int
const (
	Operational ComponentStatus = iota
	DegradedPerformance
	PartialOutage
	MajorOutage
)

func (ComponentStatus) String

func (i ComponentStatus) String() string

func (ComponentStatus) ToLower

func (i ComponentStatus) ToLower() string

type ComponentUpdateData

type ComponentUpdateData struct {
	Data string
}

func (*ComponentUpdateData) String

func (c *ComponentUpdateData) String() string

type ComponentsResponse

type ComponentsResponse []Component

type HTTPClient added in v0.4.0

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type HistoricIncident

type HistoricIncident struct {
	Name         string
	Backfilled   bool
	BackfillDate string
	Message      string
}

func (*HistoricIncident) String

func (i *HistoricIncident) String() string

type Incident

type Incident struct {
	Backfilled                    *bool             `json:"backfilled,omitempty"`
	Components                    *[]Component      `json:"components,omitempty"`
	CreatedAt                     *time.Time        `json:"created_at,omitempty"`
	ID                            *string           `json:"id,omitempty"`
	Impact                        *string           `json:"impact,omitempty"`
	ImpactOverride                *string           `json:"impact_override,omitempty"`
	IncidentUpdates               []*IncidentUpdate `json:"incident_updates,omitempty"`
	MonitoringAt                  *time.Time        `json:"monitoring_at,omitempty"`
	Name                          *string           `json:"name,omitempty"`
	PageID                        *string           `json:"page_id,omitempty"`
	PostmortemBody                *string           `json:"postmortem_body,omitempty"`
	PostmortemBodyLastUpdatedAt   *time.Time        `json:"postmortem_body_last_updated_at,omitempty"`
	PostmortemIgnored             *bool             `json:"postmortem_ignored,omitempty"`
	PostmortemNotifiedSubscribers *bool             `json:"postmortem_notified_subscribers,omitempty"`
	PostmortemNotifiedTwitter     *bool             `json:"postmortem_notified_twitter,omitempty"`
	PostmortemPublishedAt         *time.Time        `json:"postmorem_published_at,omitempty"`
	ResolvedAt                    *time.Time        `json:"resolved_at,omitempty"`
	ScheduledAutoInProgress       *bool             `json:"scheduled_auto_in_progress,omitempty"`
	ScheduledAutoCompleted        *bool             `json:"scheduled_auto_completed,omitempty"`
	ScheduledFor                  *time.Time        `json:"scheduled_for"`
	ScheduledRemindPrior          *bool             `json:"scheduled_remind_prior,omitempty"`
	ScheduledRemindedAt           *time.Time        `json:"scheduled_reminded_at,omitempty"`
	ScheduledUntil                *time.Time        `json:"scheduled_until,omitempty"`
	Shortlink                     *string           `json:shortlink,omitempty"`
	Status                        *string           `json:status,omitempty"`
	UpdatedAt                     *time.Time        `json:updated_at,omitempty"`
}

type IncidentAffectedComponent

type IncidentAffectedComponent struct {
	Code      *string `json:"code,omitempty"`
	Name      *string `json:"name,omitempty"`
	OldStatus *string `json:"old_status,omitempty"`
	NewStatus *string `json:"new_status,omitempty"`
}

type IncidentResponse

type IncidentResponse []Incident

type IncidentUpdate

type IncidentUpdate struct {
	AffectedComponents   *[]IncidentAffectedComponent `json:"affected_components,omitempty"`
	Body                 *string                      `json:"body,omitempty"`
	CreatedAt            *time.Time                   `json:"created_at,omitempty"`
	CustomTweet          *string                      `json:"custom_tweet,omitempty"`
	DeliverNotifications *bool                        `json:"deliver_notifications,omitempty"`
	DisplayAt            *time.Time                   `json:"display_at,omitempty"`
	ID                   *string                      `json:"id,omitempty"`
	IncidentID           *string                      `json:"incident_id,omitempty"`
	Status               *string                      `json:"status,omitempty"`
	TweetID              *string                      `json:"tweet_id,omitempty"`
	TwitterUpdatedAt     *time.Time                   `json:"twitter_updated_at,omitempty"`
	UpdatedAt            *time.Time                   `json:"updated_at,omitempty"`
	WantsTwitterUpdate   *bool                        `json:"wants_twitter-update,omitempty"`
}

type NewIncident

type NewIncident struct {
	Name               string
	Status             string
	Message            string
	WantsTwitterUpdate bool
	ImpactOverride     string
	ComponentIDs       []string
}

func (*NewIncident) String

func (i *NewIncident) String() string

type NewIncidentUpdate

type NewIncidentUpdate struct {
	Name               string
	Status             string
	Message            string
	WantsTwitterUpdate bool
	ImpactOverride     string
	ComponentIDs       []string
}

func (*NewIncidentUpdate) String

func (i *NewIncidentUpdate) String() string

type NewSubscriber

type NewSubscriber struct {
	Email string `json:"email,omitempty"`
}

func (*NewSubscriber) String

func (s *NewSubscriber) String() string

type ScheduledIncident

type ScheduledIncident struct {
	Name                    string
	Status                  string
	ScheduledFor            time.Time
	ScheduledUntil          time.Time
	WantsTwitterUpdate      bool
	ScheduledRemindPrior    bool
	ScheduledAutoInProgress bool
	ScheduledAutoCompleted  bool
	ImpactOverride          string
	Message                 string
	ComponentIDs            []string
}

func (*ScheduledIncident) String

func (i *ScheduledIncident) String() string

type Subscriber

type Subscriber struct {
	ID            *string      `json:"id,omitempty"`
	CreatedAt     *time.Time   `json:"created_at,omitempty"`
	PhoneCountry  *string      `json:"phone_country,omitempty"`
	PhoneNumber   *string      `json:"phone_number,omitempty"`
	Email         *string      `json:"email,omitempty"`
	SkipNotify    *bool        `json:"skip_confirmation_notification,omitempty"`
	Mode          *string      `json:"mode,omitempty"`
	QuarantinedAt *time.Time   `json:"quarantined_at,omitempty"`
	PurgeAt       *time.Time   `json:"purge_at,omitempty"`
	Components    []*Component `json:"components,omitempty"`
}

func (*Subscriber) String

func (s *Subscriber) String() string

type SubscriberResponse

type SubscriberResponse []Subscriber

Jump to

Keyboard shortcuts

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