entities

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DependencyStatusNew       = "NEW"
	DependencyStatusDeploying = "DEPLOYING"
	DependencyStatusFailing   = "FAILING"
	DependencyStatusRetrying  = "RETRYING"
	DependencyStatusReady     = "READY"
	DependencyStatusWaiting   = "WAITING"
)
View Source
const (
	DeploymentStatusNew       = "NEW"
	DeploymentStatusDeploying = "DEPLOYING"
	DeploymentStatusFailing   = "FAILING"
	DeploymentStatusRetrying  = "RETRYING"
	DeploymentStatusReady     = "READY"
)
View Source
const (
	NodeStatusNew        = "NEW"
	NodeStatusDeploying  = "DEPLOYING"
	NodeStatusActive     = "ACTIVE"
	NodeStatusReady      = "READY"
	NodeStatusFailing    = "FAILING"
	NodeStatusRetrying   = "RETRYING"
	NodeStatusRestarting = "RESTARTING"
	NodeStatusStopped    = "STOPPED"
	NodeStatusError      = "ERROR"
	NodeStatusDeleted    = "DELETED"
)
View Source
const DefaultProvider = "GLESYS"
View Source
const ErrorNoReservableProjects = "Could not find any available projects to reserve"
View Source
const ReserveGraceTime = time.Hour * 4

Variables

View Source
var (
	KeyStatusNew      = "NEW"
	KeyStatusAdapting = "ADAPTING"
	KeyStatusActive   = "ACTIVE"
	KeyStatusFailing  = "FAILING"
	KeyStatusDeleted  = "DELETED"
)

Functions

func NodeName added in v0.0.9

func NodeName() string

Types

type Dependency

type Dependency struct {
	Name    string `json:"name"`
	Status  string `json:"status"`
	Retries int32  `json:"retries"`
}

type Deployment

type Deployment struct {
	Name    string `json:"name"`
	Owner   string `json:"owner"`
	Repo    string `json:"repo"`
	Tag     string `json:"tag"`
	Token   string `json:"token"`
	Status  string `json:"status"`
	Retries int32  `json:"retries"`
}

type Node

type Node struct {
	ID              string       `json:"id"`
	ProviderID      string       `json:"providerId"`
	NodeToken       string       `json:"nodeToken"`
	IsMaster        bool         `json:"isMaster"`
	MasterIP        net.IP       `json:"masterIP"`
	Tags            []string     `json:"tags"`
	Name            string       `json:"name"`
	IPV4            net.IP       `json:"ipv4"`
	IPV6            net.IP       `json:"ipv6"`
	Status          string       `json:"status"`
	Retries         int          `json:"retries"`
	Error           string       `json:"error"`
	Created         time.Time    `json:"created"`
	Updated         time.Time    `json:"updated"`
	Deleted         *time.Time   `json:"deleted"`
	Features        NodeFeatures `json:"features"`
	Dependencies    []Dependency `json:"dependencies"`
	InstallPassword string       `json:"installPassword"`
	InstallUser     string       `json:"installUser"`
	Delete          *time.Time   `json:"delete"`
}

func (*Node) Fulfils

func (ma *Node) Fulfils(dependency string) bool

func (*Node) NeedsAdapting

func (ma *Node) NeedsAdapting() bool

func (*Node) Requires

func (ma *Node) Requires(dependency string) bool

func (*Node) Retry

func (n *Node) Retry() *Node

type NodeFeatures added in v0.0.7

type NodeFeatures map[string]bool

type Project

type Project struct {
	ID            string       `json:"id"`
	Provider      string       `json:"provider"`
	ProviderID    string       `json:"providerID"` // Provider Project ID
	ProviderToken string       `json:"providerToken"`
	Name          string       `json:"name"`
	SSHKey        *SSHKey      `json:"sshKey"`
	Nodes         []Node       `json:"nodes"`
	Created       time.Time    `json:"created"`
	Updated       time.Time    `json:"updated"`
	Context       string       `json:"context"`
	Deployments   []Deployment `json:"deployments"`
	Reserved      bool         `json:"reserved"`
	Delete        *time.Time   `json:"delete"`
	Domain        string       `json:"domain"`
	Tags          []string     `json:"tags"`
}

func NewProject

func NewProject(opts ...ProjectOption) (*Project, error)

func ParseConfig

func ParseConfig(jsonStr string) (*Project, error)

func (*Project) AddNode added in v0.0.9

func (p *Project) AddNode() (*Project, *Node, error)

func (*Project) FindMasterNode added in v0.0.9

func (p *Project) FindMasterNode() *Node

func (*Project) FindNodeByID

func (p *Project) FindNodeByID(id string) *Node

func (*Project) FindNodeByIPV4

func (p *Project) FindNodeByIPV4(ip net.IP) *Node

func (*Project) FindNodeByName

func (p *Project) FindNodeByName(name string) *Node

func (*Project) HasTag added in v0.0.3

func (p *Project) HasTag(tag string) bool

func (*Project) RemoveKey

func (p *Project) RemoveKey(key *SSHKey) *Project

func (*Project) RemoveNode

func (p *Project) RemoveNode(node *Node) *Project

func (*Project) Reserve added in v0.0.2

func (p *Project) Reserve() *Project

func (*Project) Tag added in v0.0.2

func (p *Project) Tag(tags ...string) *Project

func (*Project) ToJSON

func (p *Project) ToJSON() ([]byte, error)

func (*Project) UpdateKey

func (p *Project) UpdateKey(key *SSHKey) *Project

func (*Project) UpdateNode

func (p *Project) UpdateNode(node *Node) *Project

func (*Project) WithDeployments added in v0.0.11

func (p *Project) WithDeployments(deployments ...Deployment) *Project

func (*Project) WithName added in v0.0.4

func (p *Project) WithName(name string) *Project

func (*Project) WithProvider

func (p *Project) WithProvider(provider string) *Project

func (*Project) WithProviderID added in v0.0.5

func (p *Project) WithProviderID(providerProjectId string) *Project

func (*Project) WithProviderToken added in v0.0.5

func (p *Project) WithProviderToken(token string) *Project

func (*Project) WriteJSON

func (p *Project) WriteJSON(w io.Writer) error

type ProjectOption

type ProjectOption func(config *Project) *Project

func WithDeployments added in v0.0.11

func WithDeployments(deployments ...Deployment) ProjectOption

func WithDomain added in v0.0.3

func WithDomain(domain string) ProjectOption

func WithID

func WithID(id string) ProjectOption

func WithName

func WithName(name string) ProjectOption

func WithProvider added in v0.0.5

func WithProvider(provider string) ProjectOption

func WithProviderID added in v0.0.5

func WithProviderID(projectProviderId string) ProjectOption

func WithProviderToken

func WithProviderToken(token string) ProjectOption

type Projects added in v0.0.3

type Projects []Project

func ParseProjects added in v0.0.3

func ParseProjects(jsonStr string) (Projects, error)

func (Projects) ReserveOne added in v0.0.3

func (ps Projects) ReserveOne() (Projects, *Project, error)

type SSHKey

type SSHKey struct {
	ID          string    `json:"id"`
	ProviderID  string    `json:"providerId"`
	Name        string    `json:"name"`
	Status      string    `json:"status"`
	Fingerprint string    `json:"fingerprint"`
	Error       string    `json:"error"`
	PrivateKey  string    `json:"privateKey"`
	PublicKey   string    `json:"publicKey"`
	Created     time.Time `json:"created"`
	Updated     time.Time `json:"updated"`
}

func GenerateKeyPair added in v0.0.19

func GenerateKeyPair() (*SSHKey, error)

GenerateKeyPair creates a SSH key pair (Ed25519).

func (*SSHKey) NeedsAdapting

func (k *SSHKey) NeedsAdapting() bool

Jump to

Keyboard shortcuts

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