sdk

package
v0.0.0-...-907143c Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusSuccess = "succeeded"
	StatusFailure = "failed"
	StatusRunning = "running"
	StatusAborted = "aborted"
	StatusPending = "pending"
)

Variables

View Source
var ErrInternal = errors.New("internal error occurred")
View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrPageExceeded = errors.New("specified page exceeds total pages")
View Source
var ErrQueryLimitMalformed = errors.New("query parameter 'limit' is malformed")
View Source
var ErrQueryPageMalformed = errors.New("query parameter 'page' is malformed")
View Source
var ErrQueryPerPageMalformed = errors.New("query parameter 'perPage' is malformed")
View Source
var ErrQuerySinceMalformed = errors.New("query parameter 'since' is malformed")

Functions

func ListenAndServe

func ListenAndServe(addr string, p ProviderConfig) error

func ListenAndServeAppInstancesProvider

func ListenAndServeAppInstancesProvider(addr string, p AppProvider) error

func ListenAndServeAppProvider

func ListenAndServeAppProvider(addr string, p AppProvider) error

func ListenAndServeAppRoutingProvider

func ListenAndServeAppRoutingProvider(addr string, p AppProvider) error

func ListenAndServeGroupProvider

func ListenAndServeGroupProvider(addr string, p GroupProvider) error

func ListenAndServePipelineProvider

func ListenAndServePipelineProvider(addr string, p PipelineProvider) error

func NewAppInstancesProviderHandler

func NewAppInstancesProviderHandler(p InstancesProvider) http.Handler

func NewAppProviderHandler

func NewAppProviderHandler(p AppProvider) http.Handler

func NewAppRoutingProviderHandler

func NewAppRoutingProviderHandler(p RoutingProvider) http.Handler

func NewGroupProviderHandler

func NewGroupProviderHandler(p GroupProvider) http.Handler

func NewPipelineProviderHandler

func NewPipelineProviderHandler(p PipelineProvider) http.Handler

Types

type App

type App struct {
	Id       string      `json:"id"`
	Name     string      `json:"name"`
	Labels   AppLabels   `json:"labels,omitempty"`
	Position AppPosition `json:"position,omitempty"`
}

type AppInstance

type AppInstance struct {
	State AppState
	Since time.Time
}

type AppInstances

type AppInstances []AppInstance

type AppLabels

type AppLabels map[string]string

type AppPage

type AppPage struct {
	Pagination
	Apps []App `json:"apps"`
}

type AppPosition

type AppPosition []string

type AppProvider

type AppProvider interface {
	ListApps() ([]App, error)
	GetApp(id string) (App, error)
}

type AppRoute

type AppRoute struct {
	Host    string `json:"host"`
	Path    string `json:"path"`
	AppPort int    `json:"appPort"`
}

type AppRoutes

type AppRoutes []AppRoute

type AppRouting

type AppRouting struct {
	Routes AppRoutes `json:"routes"`
}

type AppSearchResult

type AppSearchResult struct {
	App   App     `json:"app"`
	Score float64 `json:"score"`
}

type AppState

type AppState string
const (
	AppStateRunning  AppState = "running"
	AppStateStopped  AppState = "stopped"
	AppStateCrashed  AppState = "crashed"
	AppStateStarting AppState = "starting"
	AppStateUnknown  AppState = "unknown"
)

type Group

type Group struct {
	Id      string   `json:"id" bson:"id"`
	Name    string   `json:"name" bson:"name"`
	Members []Member `json:"members,omitempty"`
}

type GroupPage

type GroupPage struct {
	Pagination
	Groups []Group `json:"groups"`
}

type GroupProvider

type GroupProvider interface {
	ListGroups() ([]Group, error)
	GetGroup(id string) (Group, error)
}

type InstancesProvider

type InstancesProvider interface {
	GetAppInstances(id string) (AppInstances, error)
}

type Member

type Member struct {
	Id   string
	Name string
}

type Pagination

type Pagination struct {
	TotalResults int `json:"totalResults"`
	TotalPages   int `json:"totalPages"`
	PerPage      int `json:"perPage"`
	Page         int `json:"page"`
}

type Pipeline

type Pipeline struct {
	Id      string          `json:"id" bson:"id"`
	Name    string          `json:"name" bson:"name"`
	Current PipelineVersion `json:"current" bson:"current"`
}

type PipelineConnection

type PipelineConnection struct {
	From   int  `json:"from" bson:"from"`
	To     int  `json:"to" bson:"to"`
	Manual bool `json:"manual" bson:"manual"`
}

type PipelineDefinition

type PipelineDefinition struct {
	Steps       []PipelineStep       `json:"steps,omitempty" bson:"steps,omitempty"`
	Connections []PipelineConnection `json:"connections,omitempty" bson:"connections,omitempty"`
}

type PipelinePage

type PipelinePage struct {
	Pagination
	Pipelines []Pipeline `json:"pipelines" bson:"pipelines"`
}

type PipelineProvider

type PipelineProvider interface {
	ListPipelines() ([]Pipeline, error)
	ListUpdates(since time.Time) (PipelineUpdates, error)
	GetPipeline(id string) (Pipeline, error)
	GetHistory(id string, before time.Time, limit int) (PipelineStatusList, error)
}

type PipelineStatus

type PipelineStatus struct {
	PipelineId string    `json:"pipelineId" bson:"pipelineId"`
	Started    time.Time `json:"started" bson:"started"`
	Steps      []StepRun `json:"steps,omitempty" bson:"steps,omitempty"`
}

func (PipelineStatus) Fold

type PipelineStatusList

type PipelineStatusList []PipelineStatus

func (PipelineStatusList) Fold

func (PipelineStatusList) Len

func (pl PipelineStatusList) Len() int

func (PipelineStatusList) Less

func (pl PipelineStatusList) Less(i, j int) bool

func (PipelineStatusList) Swap

func (pl PipelineStatusList) Swap(i, j int)

type PipelineStep

type PipelineStep struct {
	Name           string   `json:"name" bson:"name"`
	Id             int      `json:"id" bson:"id"`
	AppDeployments []string `json:"appDeployments,omitempty" bson:"appDeployments,omitempty"`
}

type PipelineUpdates

type PipelineUpdates struct {
	Runs     PipelineStatusList  `json:"runs,omitempty" bson:"runs,omitempty"`
	Versions PipelineVersionList `json:"versions,omitempty" bson:"versions,omitempty"`
}

type PipelineVersion

type PipelineVersion struct {
	PipelineId string             `json:"pipelineId" bson:"pipelineId"`
	Created    time.Time          `json:"created" bson:"created"`
	Definition PipelineDefinition `json:"definition" bson:"definition"`
}

type PipelineVersionList

type PipelineVersionList []PipelineVersion

func (PipelineVersionList) Len

func (pl PipelineVersionList) Len() int

func (PipelineVersionList) Less

func (pl PipelineVersionList) Less(i, j int) bool

func (PipelineVersionList) Swap

func (pl PipelineVersionList) Swap(i, j int)

func (PipelineVersionList) VersionAt

func (pl PipelineVersionList) VersionAt(t time.Time) PipelineVersion

type ProviderConfig

type ProviderConfig struct {
	Apps      AppProvider
	Pipelines PipelineProvider
	Groups    GroupProvider
	Routing   RoutingProvider
	Instances InstancesProvider
}

type RoutingProvider

type RoutingProvider interface {
	GetAppRouting(id string) (AppRouting, error)
}

type StepRun

type StepRun struct {
	StepId  int        `json:"stepId" bson:"stepId"`
	Status  StepStatus `json:"status" bson:"status"`
	Started time.Time  `json:"started" bson:"started"`
	Ended   time.Time  `json:"ended" bson:"ended"`
}

type StepStatus

type StepStatus string

Jump to

Keyboard shortcuts

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