ycs

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README

Codacy Coverage Status GitHub Actions CI Status GitHub Actions CodeQL Status

CI StatusContributingLicense


ycs is Go package for working with Yandex.Cloud status API.

CI Status

Branch Status
master CI
develop CI

Contributing

Before contributing to this project please read our Contributing Guidelines.

License

Apache License, Version 2.0

Documentation

Index

Constants

View Source
const (
	LANG_RU = "ru"
	LANG_EN = "en"
)
View Source
const (
	REGION_ALL = "all"
	REGION_RU  = "ru"
	REGION_KZ  = "kz"
)
View Source
const (
	ZONE_RU_A = "ru-central1-a"
	ZONE_RU_B = "ru-central1-b"
	ZONE_RU_C = "ru-central1-c"
	ZONE_RU_D = "ru-central1-d"
	ZONE_KZ_A = "kz1-a"
)
View Source
const (
	STATUS_OPEN        = "open"
	STATUS_RESOLVED    = "resolved"
	STATUS_WITH_REPORT = "withReport"
)
View Source
const (
	TYPE_INVESTIGATION = "investigation"
	TYPE_UPDATE        = "update"
	TYPE_RESOLVED      = "resolved"
)
View Source
const (
	LEVEL_MINOR       = "Minor"       // 1
	LEVEL_UNAVAILABLE = "Unavailable" // 2
)
View Source
const (
	LEVEL_ID_MINOR       uint8 = 1
	LEVEL_ID_UNAVAILABLE uint8 = 2
)
View Source
const UA = "EK|YCS.go"

UA is HTTP client user-agent

Variables

View Source
var AllLangs = []string{LANG_EN, LANG_RU}

AllLangs is a slice with all supported languages

AllRegions is a slice with all regions

AllZones is a slice with all availability zones

Functions

func SetLimit

func SetLimit(rps float64)

SetLimit sets a hard limit on the number of requests per second

func SetRequestTimeout

func SetRequestTimeout(timeout float64)

SetRequestTimeout sets request timeout

func SetUserAgent

func SetUserAgent(app, version string)

SetUserAgent sets user agent

Types

type Comment

type Comment struct {
	ID         uint   `json:"id"`
	IncidentID uint   `json:"incidentId"`
	Content    string `json:"content"`
	Type       string `json:"type"`
	CreatedAt  Date   `json:"createdAt"`
	UpdatedAt  Date   `json:"updatedAt"`
}

func (*Comment) Markdown

func (c *Comment) Markdown() string

Markdown converts comment HTML content to Markdown

type Comments

type Comments []*Comment

Comments is a slice with comments

func (Comments) Get

func (c Comments) Get(index int) *Comment

Get returns comment with given index

type Date

type Date struct {
	time.Time
}

Date is JSON date

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON parses JSON date

type Incident

type Incident struct {
	ID                  uint     `json:"id"`
	Title               string   `json:"title"`
	Report              string   `json:"report,omitempty"`
	Status              string   `json:"status"`
	IsReportPublished   bool     `json:"isReportPublished,omitempty"`
	LevelID             uint8    `json:"levelId"`
	StartDate           Date     `json:"startDate"`
	EndDate             Date     `json:"endDate"`
	CreatedAt           Date     `json:"createdAt"`
	UpdatedAt           Date     `json:"updatedAt"`
	ReportPublishedTime Date     `json:"reportPublishedTime"`
	Level               *Level   `json:"level"`
	Zones               Zones    `json:"zones"`
	Regions             Regions  `json:"installations"`
	Services            Services `json:"services"`
	Comments            Comments `json:"comments"`
}

Incident contains info about incident

func GetIncident

func GetIncident(id uint, lang string) (*Incident, error)

GetIncidents returns slice with incidents

func (*Incident) Duration

func (i *Incident) Duration() time.Duration

Duration returns incident duration

func (*Incident) IsResolved

func (i *Incident) IsResolved() bool

IsResolved returns true if incident is resolved

func (*Incident) RegionList

func (i *Incident) RegionList() []string

RegionList returns slice with all regions affected by the incident

func (*Incident) ReportMarkdown

func (i *Incident) ReportMarkdown() string

ReportMarkdown converts report HTML to Markdown

func (*Incident) ServiceList

func (i *Incident) ServiceList() []string

ServiceList returns slice with all services affected by the incident

func (*Incident) URL

func (i *Incident) URL(lang string) string

URL returns URL of incident page

func (*Incident) ZoneList

func (i *Incident) ZoneList() []string

ZoneList returns slice with all zones affected by the incident

type Incidents

type Incidents []*Incident

Incidents is a slice with incidents

func GetIncidents

func GetIncidents(req IncidentsRequest) (Incidents, error)

GetIncidents returns slice with incidents

func (Incidents) HasOpen added in v0.0.3

func (i Incidents) HasOpen() bool

HasOpen returns true if slice contains open incident

type IncidentsRequest

type IncidentsRequest struct {
	Lang   string
	From   time.Time
	To     time.Time
	Status string
	Region string
	Zones  []string
}

IncidentsRequest contains incident request info

type Level

type Level struct {
	Level     uint8  `json:"level"`
	Label     string `json:"label"`
	Theme     string `json:"theme"`
	CreatedAt Date   `json:"createdAt"`
	UpdatedAt Date   `json:"updatedAt"`
}

Level contains info about incident level

type Region

type Region struct {
	Code  string `json:"code"`
	Zones Zones  `json:"zones"`
}

Region contains info about installation region

type Regions

type Regions []*Region

Regions is a slice with installation regions

type Service

type Service struct {
	Name             string    `json:"name"`
	FullName         string    `json:"fullName"`
	Slug             string    `json:"slug"`
	Description      string    `json:"description"`
	IAMFlag          string    `json:"iamFlag,omitempty"`
	Status           string    `json:"status"`
	DocURL           string    `json:"docUrl"`
	PricesURL        string    `json:"pricesUrl"`
	ConsoleURL       string    `json:"consoleUrl"`
	InstallationCode string    `json:"installationCode"`
	Icon             string    `json:"icon"`
	IconName         string    `json:"iconName"`
	OrderNumber      uint      `json:"orderNumber"`
	CategoryID       uint      `json:"categoryId"`
	ID               uint      `json:"id"`
	PageID           uint      `json:"pageId"`
	CreatedAt        Date      `json:"createdAt"`
	UpdatedAt        Date      `json:"updatedAt"`
	IsProduct        bool      `json:"isProduct"`
	Incidents        Incidents `json:"incidents"`
}

Service contains info about service

type Services

type Services []*Service

Services is slice with services

func GetServices

func GetServices(lang string) (Services, error)

GetServices returns status of all services

func (Services) IDs

func (s Services) IDs() []uint

IDs returns slice with IDs of services

func (Services) InRegion

func (s Services) InRegion(code string) Services

InRegion filters services and returns only services in a given region (installation)

func (Services) Names

func (s Services) Names() []string

Names returns slice with names of services

type Zone

type Zone struct {
	InstallationID uint    `json:"installationId"`
	ID             string  `json:"id"`
	CreatedAt      Date    `json:"createdAt"`
	UpdatedAt      Date    `json:"updatedAt"`
	Region         *Region `json:"installation"`
}

Zone contains info about zone (RU/KZ)

type Zones

type Zones []*Zone

Zones is slice with zones

Jump to

Keyboard shortcuts

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