manifest

package
v0.0.0-...-cd22644 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidNameDescription = "must contain only lowercase alphanumeric and dashes"
)

Variables

View Source
var (
	DefaultCpu = 256
	DefaultMem = 512
)

Functions

This section is empty.

Types

type DefaultsSetter

type DefaultsSetter interface {
	SetDefaults() error
}

type Environment

type Environment []string

func (*Environment) UnmarshalYAML

func (v *Environment) UnmarshalYAML(unmarshal func(interface{}) error) error

type Manifest

type Manifest struct {
	Environment Environment `yaml:"environment,omitempty"`
	Params      Params      `yaml:"params,omitempty"`
	Resources   Resources   `yaml:"resources,omitempty"`
	Services    Services    `yaml:"services,omitempty"`
	Timers      Timers      `yaml:"timers,omitempty"`
	// contains filtered or unexported fields
}

func Load

func Load(data []byte, env map[string]string) (*Manifest, error)

func (*Manifest) Agents

func (m *Manifest) Agents() []string

func (*Manifest) ApplyDefaults

func (m *Manifest) ApplyDefaults() error

func (*Manifest) AttributeSet

func (m *Manifest) AttributeSet(name string) bool

func (*Manifest) Attributes

func (m *Manifest) Attributes() []string

func (*Manifest) AttributesByPrefix

func (m *Manifest) AttributesByPrefix(prefix string) []string

func (*Manifest) CombineEnv

func (m *Manifest) CombineEnv() error

func (*Manifest) Env

func (m *Manifest) Env() map[string]string

func (*Manifest) Service

func (m *Manifest) Service(name string) (*Service, error)

func (*Manifest) ServiceEnvironment

func (m *Manifest) ServiceEnvironment(service string) (map[string]string, error)

func (*Manifest) SetAttributes

func (m *Manifest) SetAttributes(attrs []string)

used only for tests

func (*Manifest) SetEnv

func (m *Manifest) SetEnv(env map[string]string)

used only for tests

func (*Manifest) Validate

func (m *Manifest) Validate() error

type NameGetter

type NameGetter interface {
	GetName() string
}

type NameSetter

type NameSetter interface {
	SetName(name string) error
}

type Params

type Params map[string]string

type Resource

type Resource struct {
	Name    string            `yaml:"-"`
	Type    string            `yaml:"type"`
	Options map[string]string `yaml:"options"`
}

func (Resource) GetName

func (r Resource) GetName() string

func (*Resource) SetName

func (v *Resource) SetName(name string) error

type Resources

type Resources []Resource

func (Resources) MarshalYAML

func (v Resources) MarshalYAML() (interface{}, error)

func (*Resources) UnmarshalYAML

func (v *Resources) UnmarshalYAML(unmarshal func(interface{}) error) error

type Service

type Service struct {
	Name string `yaml:"-"`

	Agent       ServiceAgent       `yaml:"agent,omitempty"`
	Build       ServiceBuild       `yaml:"build,omitempty"`
	Command     ServiceCommand     `yaml:"command,omitempty"`
	Deployment  ServiceDeployment  `yaml:"deployment,omitempty"`
	Domains     ServiceDomains     `yaml:"domain,omitempty"`
	Drain       int                `yaml:"drain,omitempty"`
	Environment Environment        `yaml:"environment,omitempty"`
	Health      ServiceHealth      `yaml:"health,omitempty"`
	Image       string             `yaml:"image,omitempty"`
	Init        bool               `yaml:"init,omitempty"`
	Internal    bool               `yaml:"internal,omitempty"`
	Links       []string           `yaml:"links,omitempty"`
	Policies    []string           `yaml:"policies,omitempty"`
	Port        ServicePort        `yaml:"port,omitempty"`
	Privileged  bool               `yaml:"privileged,omitempty"`
	Resources   []string           `yaml:"resources,omitempty"`
	Scale       ServiceScale       `yaml:"scale,omitempty"`
	Singleton   bool               `yaml:"singleton,omitempty"`
	Sticky      bool               `yaml:"sticky,omitempty"`
	Termination ServiceTermination `yaml:"termination,omitempty"`
	Test        string             `yaml:"test,omitempty"`
	Volumes     []string           `yaml:"volumes,omitempty"`
}

func (Service) Autoscale

func (s Service) Autoscale() bool

func (Service) BuildHash

func (s Service) BuildHash(key string) string

func (Service) Domain

func (s Service) Domain() string

func (Service) EnvironmentDefaults

func (s Service) EnvironmentDefaults() map[string]string

func (Service) EnvironmentKeys

func (s Service) EnvironmentKeys() string

func (Service) GetName

func (s Service) GetName() string

func (*Service) SetName

func (v *Service) SetName(name string) error

type ServiceAgent

type ServiceAgent struct {
	Enabled bool               `yaml:"enabled,omitempty"`
	Ports   []ServiceAgentPort `yaml:"ports,omitempty"`
}

func (*ServiceAgent) UnmarshalYAML

func (v *ServiceAgent) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceAgentPort

type ServiceAgentPort struct {
	Port     int    `yaml:"port,omitempty"`
	Protocol string `yaml:"protocol,omitempty"`
}

func (*ServiceAgentPort) UnmarshalYAML

func (v *ServiceAgentPort) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceBuild

type ServiceBuild struct {
	Args     []string `yaml:"args,omitempty"`
	Manifest string   `yaml:"manifest,omitempty"`
	Path     string   `yaml:"path,omitempty"`
}

func (ServiceBuild) MarshalYAML

func (v ServiceBuild) MarshalYAML() (interface{}, error)

func (*ServiceBuild) UnmarshalYAML

func (v *ServiceBuild) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceCommand

type ServiceCommand []string

func (*ServiceCommand) UnmarshalYAML

func (v *ServiceCommand) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceDeployment

type ServiceDeployment struct {
	Maximum int `yaml:"maximum,omitempty"`
	Minimum int `yaml:"minimum,omitempty"`
}

type ServiceDomains

type ServiceDomains []string

func (*ServiceDomains) UnmarshalYAML

func (v *ServiceDomains) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceHealth

type ServiceHealth struct {
	Grace    int
	Interval int
	Path     string
	Timeout  int
}

func (*ServiceHealth) UnmarshalYAML

func (v *ServiceHealth) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServicePort

type ServicePort struct {
	Port   int    `yaml:"port,omitempty"`
	Scheme string `yaml:"scheme,omitempty"`
}

func (ServicePort) MarshalYAML

func (v ServicePort) MarshalYAML() (interface{}, error)

func (*ServicePort) UnmarshalYAML

func (v *ServicePort) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceScale

type ServiceScale struct {
	Cooldown ServiceScaleCooldown
	Count    ServiceScaleCount
	Cpu      int
	Memory   int
	Targets  ServiceScaleTargets `yaml:"targets,omitempty"`
}

func (*ServiceScale) UnmarshalYAML

func (v *ServiceScale) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceScaleCooldown

type ServiceScaleCooldown struct {
	Down int
	Up   int
}

func (*ServiceScaleCooldown) UnmarshalYAML

func (v *ServiceScaleCooldown) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceScaleCount

type ServiceScaleCount struct {
	Min int
	Max int
}

func (ServiceScaleCount) MarshalYAML

func (v ServiceScaleCount) MarshalYAML() (interface{}, error)

func (*ServiceScaleCount) UnmarshalYAML

func (v *ServiceScaleCount) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceScaleMetric

type ServiceScaleMetric struct {
	Aggregate  string
	Dimensions map[string]string
	Namespace  string
	Name       string
	Value      float64
}

type ServiceScaleMetrics

type ServiceScaleMetrics []ServiceScaleMetric

func (*ServiceScaleMetrics) UnmarshalYAML

func (v *ServiceScaleMetrics) UnmarshalYAML(unmarshal func(interface{}) error) error

type ServiceScaleTargets

type ServiceScaleTargets struct {
	Cpu      int
	Custom   ServiceScaleMetrics
	Memory   int
	Requests int
}

type ServiceTermination

type ServiceTermination struct {
	Grace int `yaml:"grace,omitempty"`
}

type Services

type Services []Service

func (Services) MarshalYAML

func (v Services) MarshalYAML() (interface{}, error)

func (*Services) UnmarshalYAML

func (v *Services) UnmarshalYAML(unmarshal func(interface{}) error) error

type Timer

type Timer struct {
	Name string `yaml:"-"`

	Command  string `yaml:"command"`
	Schedule string `yaml:"schedule"`
	Service  string `yaml:"service"`
}

func (Timer) Cron

func (t Timer) Cron() (string, error)

func (Timer) GetName

func (t Timer) GetName() string

func (*Timer) SetName

func (t *Timer) SetName(name string) error

type Timers

type Timers []Timer

func (Timers) MarshalYAML

func (v Timers) MarshalYAML() (interface{}, error)

func (*Timers) UnmarshalYAML

func (v *Timers) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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