model

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BoxPrefixName = "box-"
	BoxShellNone  = "none" // distroless
	BoxPortNone   = "none" // runtime only when tunnelling

)
View Source
const (
	LabelSchemaKind          = "com.hckops.schema.kind"
	LabelTemplateLocal       = "com.hckops.template.local"
	LabelTemplateGit         = "com.hckops.template.git"
	LabelTemplateGitUrl      = "com.hckops.template.git.url"
	LabelTemplateGitRevision = "com.hckops.template.git.revision"
	LabelTemplateGitCommit   = "com.hckops.template.git.commit"
	LabelTemplateGitDir      = "com.hckops.template.git.dir"
	LabelTemplateGitName     = "com.hckops.template.git.name"
	LabelTemplateCachePath   = "com.hckops.template.cache.path"
	LabelBoxSize             = "com.hckops.box.size"
)

Variables

This section is empty.

Functions

func PortFormatPadding added in v0.8.0

func PortFormatPadding(ports []BoxPort) int

func ToBoxTemplateName

func ToBoxTemplateName(boxName string) string

ToBoxTemplateName returns the strictly validated template name, or the original trimmed name

Types

type BoxClientOptions added in v0.8.0

type BoxClientOptions struct {
	Provider   BoxProvider
	CommonOpts *CommonBoxOptions
	DockerOpts *DockerBoxOptions
	KubeOpts   *KubeBoxOptions
	CloudOpts  *CloudBoxOptions
}

type BoxDetails added in v0.8.0

type BoxDetails struct {
	Info         BoxInfo
	TemplateInfo *BoxTemplateInfo
	ProviderInfo *BoxProviderInfo
	Size         ResourceSize
	Env          []BoxEnv
	Ports        []BoxPort
	Created      time.Time
}

type BoxEnv added in v0.8.0

type BoxEnv struct {
	Key   string
	Value string
}

func SortEnv added in v0.8.0

func SortEnv(env []BoxEnv) []BoxEnv

type BoxInfo

type BoxInfo struct {
	Id      string
	Name    string
	Healthy bool // TODO BoxStatus healthy, offline, unknown, error, etc
}

type BoxLabels added in v0.8.0

type BoxLabels map[string]string

func NewGitLabels added in v0.8.0

func NewGitLabels(url, revision, dir string) BoxLabels

func NewLocalLabels added in v0.8.0

func NewLocalLabels() BoxLabels

func (BoxLabels) AddGitLabels added in v0.8.0

func (l BoxLabels) AddGitLabels(size ResourceSize, path string, commit string) BoxLabels

func (BoxLabels) AddLocalLabels added in v0.8.0

func (l BoxLabels) AddLocalLabels(size ResourceSize, path string) BoxLabels

func (BoxLabels) ToCachedTemplateInfo added in v0.8.0

func (l BoxLabels) ToCachedTemplateInfo() *CachedTemplateInfo

func (BoxLabels) ToGitTemplateInfo added in v0.8.0

func (l BoxLabels) ToGitTemplateInfo() *GitTemplateInfo

func (BoxLabels) ToSize added in v0.8.0

func (l BoxLabels) ToSize() (ResourceSize, error)

type BoxPort

type BoxPort struct {
	Alias  string
	Local  string // TODO int ?
	Remote string // TODO int ?
	Public bool   // TODO not used, always false
}

func SortPorts added in v0.8.0

func SortPorts(ports []BoxPort) []BoxPort

type BoxProvider

type BoxProvider uint
const (
	Docker BoxProvider = iota
	Kubernetes
	Cloud
)

func (BoxProvider) String added in v0.7.0

func (p BoxProvider) String() string

type BoxProviderInfo added in v0.8.0

type BoxProviderInfo struct {
	Provider       BoxProvider
	DockerProvider *DockerProviderInfo
	KubeProvider   *KubeProviderInfo
}

type BoxStreams

type BoxStreams struct {
	In    io.ReadCloser
	Out   io.Writer
	Err   io.Writer
	IsTty bool // tty is false only for ssh tunnel
}

func NewDefaultStreams added in v0.8.0

func NewDefaultStreams(tty bool) *BoxStreams

type BoxTemplateInfo added in v0.8.0

type BoxTemplateInfo struct {
	CachedTemplate *CachedTemplateInfo
	GitTemplate    *GitTemplateInfo
}

func (*BoxTemplateInfo) IsCached added in v0.8.0

func (info *BoxTemplateInfo) IsCached() bool

type BoxV1

type BoxV1 struct {
	Kind  string
	Name  string
	Tags  []string
	Image struct {
		Repository string
		Version    string
	}
	Shell   string
	Network struct {
		Ports []string
	}
}

func (*BoxV1) GenerateName

func (box *BoxV1) GenerateName() string

func (*BoxV1) HasPorts

func (box *BoxV1) HasPorts() bool

func (*BoxV1) ImageName

func (box *BoxV1) ImageName() string

func (*BoxV1) ImageVersion

func (box *BoxV1) ImageVersion() string

func (*BoxV1) NetworkPorts

func (box *BoxV1) NetworkPorts(includeVirtual bool) []BoxPort

func (*BoxV1) Pretty

func (box *BoxV1) Pretty() string

type CachedTemplateInfo added in v0.8.0

type CachedTemplateInfo struct {
	Path string
}

type CloudBoxOptions added in v0.8.0

type CloudBoxOptions struct {
	Version  string
	Address  string
	Username string
	Token    string
}

type CommonBoxOptions added in v0.8.0

type CommonBoxOptions struct {
	EventBus *event.EventBus
}

func NewCommonBoxOpts added in v0.8.0

func NewCommonBoxOpts() *CommonBoxOptions

type ConnectOptions added in v0.8.0

type ConnectOptions struct {
	Template      *BoxV1
	Streams       *BoxStreams
	Name          string
	DisableExec   bool
	DisableTunnel bool
	DeleteOnExit  bool
}

type CreateOptions added in v0.8.0

type CreateOptions struct {
	Template *BoxV1
	Size     ResourceSize
	Labels   BoxLabels
}

type DockerBoxOptions added in v0.8.0

type DockerBoxOptions struct {
	NetworkName          string
	IgnoreImagePullError bool
}

type DockerProviderInfo added in v0.8.0

type DockerProviderInfo struct {
	Network string
	Ip      string
}

type GitTemplateInfo added in v0.8.0

type GitTemplateInfo struct {
	Url      string
	Revision string
	Commit   string
	Name     string
}

type KubeBoxOptions added in v0.8.0

type KubeBoxOptions struct {
	InCluster  bool
	ConfigPath string
	Namespace  string
}

type KubeProviderInfo added in v0.8.0

type KubeProviderInfo struct {
	Namespace string
}

type ResourceSize added in v0.8.0

type ResourceSize uint
const (
	ExtraSmall ResourceSize = iota
	Small
	Medium
	Large
	ExtraLarge
)

func ExistResourceSize added in v0.8.0

func ExistResourceSize(value string) (ResourceSize, error)

func (ResourceSize) String added in v0.8.0

func (size ResourceSize) String() string

func (ResourceSize) ToKubeResource added in v0.8.0

func (size ResourceSize) ToKubeResource() *kubernetes.KubeResource

Jump to

Keyboard shortcuts

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