compose

package
v0.0.0-...-1fa5987 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package compose implements an AST, parser, validator, and interpolator for <https://github.com/compose-spec/compose-spec>.

The AST preserves some formatting information from the source Yaml. This enables extracting subdocuments in a way that perserves source formatting, and in particular maintains the stable ordering of map entries.

Parsing is implemented in terms of yaml unmarshaling and performs partial evaluation of interpolation. All scalar leaf nodes contain a String structure which maintains the original Expression string and an interpolated Value string. Other scalar types (numbers and booleans), as well as composite types, will embed a String to facitate delaying interpolation until an environment is available.

Index

Constants

View Source
const (
	UnknownStyle Style = 0
	MapStyle           = 'M'
	SeqStyle           = 'S'
)

Variables

View Source
var ErrEnvironment = template.ErrEnvironment

Functions

func FormatPort

func FormatPort(num uint16, protocol string) string

func ParsePortRange

func ParsePortRange(numbers string) (min uint16, max uint16, err error)

Types

type BindOptions

type BindOptions struct {
	Propagation    String `yaml:"propagation,omitempty"`
	CreateHostPath Bool   `yaml:"create_host_path,omitempty"`
}

func (*BindOptions) Interpolate

func (opt *BindOptions) Interpolate(env Environment) error

type BlkioConfig

type BlkioConfig struct {
	DeviceReadBPS   []ThrottleDevice `yaml:"device_read_bps,omitempty"`
	DeviceWriteBPS  []ThrottleDevice `yaml:"device_write_bps,omitempty"`
	DeviceReadIOPS  []ThrottleDevice `yaml:"device_read_iops,omitempty"`
	DeviceWriteIOPS []ThrottleDevice `yaml:"device_write_iops,omitempty"`
	Weight          Int              `yaml:"weight,omitempty"`
	WeightDevice    []WeightDevice   `yaml:"weight_device,omitempty"`
}

func (*BlkioConfig) Interpolate

func (blkio *BlkioConfig) Interpolate(env Environment) error

type Bool

type Bool struct {
	String
	Value bool
}

func MakeBool

func MakeBool(b bool) Bool

func NewBool

func NewBool(b bool) *Bool

func (*Bool) Interpolate

func (b *Bool) Interpolate(env Environment) error

func (*Bool) Ptr

func (b *Bool) Ptr() *bool

func (*Bool) UnmarshalYAML

func (b *Bool) UnmarshalYAML(node *yaml.Node) error

type Build

type Build struct {
	ShortForm String
	BuildLongForm
}

func (*Build) Interpolate

func (b *Build) Interpolate(env Environment) error

func (Build) MarshalYAML

func (b Build) MarshalYAML() (any, error)

func (*Build) UnmarshalYAML

func (b *Build) UnmarshalYAML(node *yaml.Node) error

type BuildLongForm

type BuildLongForm struct {
	Context    String     `yaml:"context,omitempty"`
	Dockerfile String     `yaml:"dockerfile,omitempty"`
	Args       Dictionary `yaml:"args,omitempty"`
	CacheFrom  Strings    `yaml:"cache_from,omitempty"`
	ExtraHosts Strings    `yaml:"extra_hosts,omitempty"`
	Isolation  String     `yaml:"isolation,omitempty"`
	Labels     Dictionary `yaml:"labels,omitempty"`
	ShmSize    Bytes      `yaml:"shm_size,omitempty"`
	Target     String     `yaml:"target,omitempty"`
}

func (*BuildLongForm) Interpolate

func (b *BuildLongForm) Interpolate(env Environment) error

type ByteUnit

type ByteUnit struct {
	Suffix string
	Scalar int64
}

type Bytes

type Bytes struct {
	String
	Quantity int64
	Unit     ByteUnit
}

func (Bytes) Int64

func (bs Bytes) Int64() int64

func (*Bytes) Interpolate

func (bs *Bytes) Interpolate(env Environment) error

func (Bytes) MarshalYAML

func (bs Bytes) MarshalYAML() (any, error)

func (*Bytes) Parse

func (bs *Bytes) Parse(s string) error

func (Bytes) Uint64

func (bs Bytes) Uint64() uint64

func (*Bytes) UnmarshalYAML

func (bs *Bytes) UnmarshalYAML(node *yaml.Node) error

type Command

type Command struct {
	// IsShellForm is true if the command was provided as a string rather than an
	// array of strings. This indicates that it should be passed to the image's
	// shell as the first argument.
	IsShellForm bool
	Parts       Strings
}

func (*Command) Interpolate

func (cmd *Command) Interpolate(env Environment) error

func (Command) MarshalYAML

func (cmd Command) MarshalYAML() (any, error)

func (*Command) UnmarshalYAML

func (cmd *Command) UnmarshalYAML(node *yaml.Node) error

type Config

type Config struct {
	Key string `yaml:"-"`

	File     String `yaml:"file,omitempty"`
	External Bool   `yaml:"external,omitempty"`
	Name     String `yaml:"name,omitempty"`
}

func (*Config) Interpolate

func (cfg *Config) Interpolate(env Environment) error

type DeviceMapping

type DeviceMapping struct {
	String
	PathOnHost        string
	PathInContainer   string
	CgroupPermissions string
}

func (*DeviceMapping) Interpolate

func (dm *DeviceMapping) Interpolate(env Environment) error

func (DeviceMapping) MarshalYAML

func (dm DeviceMapping) MarshalYAML() (any, error)

func (*DeviceMapping) UnmarshalYAML

func (dm *DeviceMapping) UnmarshalYAML(node *yaml.Node) error

type Dictionary

type Dictionary struct {
	Style Style
	Items []DictionaryItem
}

Map of string to string that can be marshalled as either a !!map or a !!seq. In the seq style, entries are of the form "key" or "key=value".

func (*Dictionary) Interpolate

func (dict *Dictionary) Interpolate(env Environment) error

func (Dictionary) Map

func (dict Dictionary) Map() map[string]string

func (Dictionary) MapOfPtr

func (dict Dictionary) MapOfPtr() map[string]*string

func (Dictionary) MarshalYAML

func (dict Dictionary) MarshalYAML() (any, error)

func (Dictionary) Slice

func (dict Dictionary) Slice() []string

func (*Dictionary) UnmarshalYAML

func (dict *Dictionary) UnmarshalYAML(node *yaml.Node) error

type DictionaryItem

type DictionaryItem struct {
	Style Style
	// For map style, String contains only the value.
	// For seq style, String is expected to evaluate to "key" or "key=value".
	String String
	Key    string
	Value  string
	// True in seq style when there is no "=" in the evaluated String.
	NoValue bool
}

func (*DictionaryItem) Interpolate

func (item *DictionaryItem) Interpolate(env Environment) error

func (DictionaryItem) MarshalYAML

func (item DictionaryItem) MarshalYAML() (any, error)

func (*DictionaryItem) UnmarshalYAML

func (item *DictionaryItem) UnmarshalYAML(node *yaml.Node) error

type Duration

type Duration struct {
	String
	Duration time.Duration
}

func (*Duration) Interpolate

func (d *Duration) Interpolate(env Environment) error

func (Duration) MarshalYAML

func (d Duration) MarshalYAML() (any, error)

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(node *yaml.Node) error

type Environment

type Environment = template.Environment

type Healthcheck

type Healthcheck struct {
	Test        Command  `yaml:"test,omitempty"`
	Interval    Duration `yaml:"interval,omitempty"`
	Timeout     Duration `yaml:"timeout,omitempty"`
	Retries     Int      `yaml:"retries,omitempty"`
	StartPeriod Duration `yaml:"start_period,omitempty"`
}

func (*Healthcheck) Interpolate

func (hc *Healthcheck) Interpolate(env Environment) error

type Ignored

type Ignored struct{}

This is a temporary placeholder for fields that we presently don't support, but are safe to ignore. TODO: Eliminate all usages of this with actual parsing logic.

func (*Ignored) Interpolate

func (_ *Ignored) Interpolate(env Environment) error

func (*Ignored) UnmarshalYAML

func (_ *Ignored) UnmarshalYAML(node *yaml.Node) error

type Int

type Int struct {
	String
	Value int64
}

func MakeInt

func MakeInt(i int64) Int

func NewInt

func NewInt(i int64) *Int

func (Int) Int

func (i Int) Int() int

func (*Int) Int64Ptr

func (i *Int) Int64Ptr() *int64

func (*Int) Interpolate

func (i *Int) Interpolate(env Environment) error

func (Int) Uint16

func (i Int) Uint16() uint16

func (*Int) UnmarshalYAML

func (i *Int) UnmarshalYAML(node *yaml.Node) error

type Interpolator

type Interpolator interface {
	Interpolate(Environment) error
}
type Link struct {
	String
	Service string
	Alias   string
}

func (*Link) Interpolate

func (l *Link) Interpolate(env Environment) error

func (Link) MarshalYAML

func (l Link) MarshalYAML() (any, error)

func (*Link) UnmarshalYAML

func (l *Link) UnmarshalYAML(node *yaml.Node) error
type Links []Link

func (Links) Values

func (ls Links) Values() []string

type Logging

type Logging struct {
	Driver  String     `yaml:"driver,omitempty"`
	Options Dictionary `yaml:"options,omitempty"`
}

func (*Logging) Interpolate

func (l *Logging) Interpolate(env Environment) error

type MapEnvironment

type MapEnvironment = template.MapEnvironment

type Network

type Network struct {
	Key string `yaml:"-"`

	Name       String     `yaml:"name,omitempty"`
	Driver     String     `yaml:"driver,omitempty"`
	DriverOpts Dictionary `yaml:"driver_opts,omitempty"`
	Attachable Bool       `yaml:"attachable,omitempty"`
	EnableIPv6 Bool       `yaml:"enable_ipv6,omitempty"`
	Internal   Bool       `yaml:"internal,omitempty"`
	Labels     Dictionary `yaml:"labels,omitempty"`
	External   Bool       `yaml:"external,omitempty"`
}

func (*Network) Interpolate

func (n *Network) Interpolate(env Environment) error

type PortMapping

type PortMapping struct {
	IsShortForm bool
	String
	PortMappingLongForm
}

func (*PortMapping) Interpolate

func (pm *PortMapping) Interpolate(env Environment) error

func (PortMapping) MarshalYAML

func (pm PortMapping) MarshalYAML() (any, error)

func (*PortMapping) UnmarshalYAML

func (pm *PortMapping) UnmarshalYAML(node *yaml.Node) error

type PortMappingLongForm

type PortMappingLongForm struct {
	Target    PortRange `yaml:"target,omitempty"`
	Published PortRange `yaml:"published,omitempty"`
	HostIP    string    `yaml:"host_ip,omitempty"`
	Protocol  string    `yaml:"protocol,omitempty"`
	Mode      string    `yaml:"mode,omitempty"`
}

func ParsePortMapping

func ParsePortMapping(short string) (PortMappingLongForm, error)

type PortMappings

type PortMappings []PortMapping

func ParsePortMappings

func ParsePortMappings(short string) (mappings PortMappings, err error)

func (*PortMappings) Interpolate

func (pm *PortMappings) Interpolate(env Environment) error

func (PortMappings) MarshalYAML

func (mappings PortMappings) MarshalYAML() (any, error)

type PortRange

type PortRange struct {
	String
	Min uint16
	Max uint16
}

func (*PortRange) Interpolate

func (rng *PortRange) Interpolate(env Environment) error

func (PortRange) MarshalYAML

func (rng PortRange) MarshalYAML() (any, error)

func (*PortRange) UnmarshalYAML

func (rng *PortRange) UnmarshalYAML(node *yaml.Node) error

type PortRangeWithProtocol

type PortRangeWithProtocol struct {
	String
	Min      uint16
	Max      uint16
	Protocol string
}

func (*PortRangeWithProtocol) Interpolate

func (rng *PortRangeWithProtocol) Interpolate(env Environment) error

func (PortRangeWithProtocol) MarshalYAML

func (rng PortRangeWithProtocol) MarshalYAML() (any, error)

func (*PortRangeWithProtocol) UnmarshalYAML

func (rng *PortRangeWithProtocol) UnmarshalYAML(node *yaml.Node) error

type Project

type Project struct {
	Version  String          `yaml:"version,omitempty"`
	Services ProjectServices `yaml:"services,omitempty"`
	Networks ProjectNetworks `yaml:"networks,omitempty"`
	Volumes  ProjectVolumes  `yaml:"volumes,omitempty"`
	Configs  ProjectConfigs  `yaml:"configs,omitempty"`
	Secrets  ProjectSecrets  `yaml:"secrets,omitempty"`
}

func Parse

func Parse(r io.Reader) (*Project, error)

func (*Project) Interpolate

func (project *Project) Interpolate(env Environment) error

type ProjectConfigs

type ProjectConfigs []Config

func (*ProjectConfigs) Interpolate

func (section *ProjectConfigs) Interpolate(env Environment) error

func (ProjectConfigs) MarshalYAML

func (section ProjectConfigs) MarshalYAML() (any, error)

func (*ProjectConfigs) UnmarshalYAML

func (section *ProjectConfigs) UnmarshalYAML(node *yaml.Node) error

type ProjectNetworks

type ProjectNetworks []Network

func (*ProjectNetworks) Interpolate

func (section *ProjectNetworks) Interpolate(env Environment) error

func (ProjectNetworks) MarshalYAML

func (section ProjectNetworks) MarshalYAML() (any, error)

func (*ProjectNetworks) UnmarshalYAML

func (section *ProjectNetworks) UnmarshalYAML(node *yaml.Node) error

type ProjectSecrets

type ProjectSecrets []Secret

func (*ProjectSecrets) Interpolate

func (section *ProjectSecrets) Interpolate(env Environment) error

func (ProjectSecrets) MarshalYAML

func (section ProjectSecrets) MarshalYAML() (any, error)

func (*ProjectSecrets) UnmarshalYAML

func (section *ProjectSecrets) UnmarshalYAML(node *yaml.Node) error

type ProjectServices

type ProjectServices []Service

func (*ProjectServices) Interpolate

func (section *ProjectServices) Interpolate(env Environment) error

func (ProjectServices) MarshalYAML

func (section ProjectServices) MarshalYAML() (any, error)

func (*ProjectServices) UnmarshalYAML

func (section *ProjectServices) UnmarshalYAML(node *yaml.Node) error

type ProjectVolumes

type ProjectVolumes []Volume

func (*ProjectVolumes) Interpolate

func (section *ProjectVolumes) Interpolate(env Environment) error

func (ProjectVolumes) MarshalYAML

func (section ProjectVolumes) MarshalYAML() (any, error)

func (*ProjectVolumes) UnmarshalYAML

func (section *ProjectVolumes) UnmarshalYAML(node *yaml.Node) error

type Secret

type Secret struct {
	Key string `yaml:"-"`

	File     String `yaml:"file,omitempty"`
	External Bool   `yaml:"external,omitempty"`
	Name     String `yaml:"name,omitempty"`
}

func (*Secret) Interpolate

func (s *Secret) Interpolate(env Environment) error

type Service

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

	// Note that these two are only applicable to Windows.
	CPUCount   Int `yaml:"cpu_count,omitempty"`
	CPUPercent Int `yaml:"cpu_percent,omitempty"`

	CPUShares          Int         `yaml:"cpu_shares,omitempty"`
	CPUPeriod          Int         `yaml:"cpu_period,omitempty"`
	CPUQuota           Int         `yaml:"cpu_quota,omitempty"`
	CPURealtimeRuntime Duration    `yaml:"cpu_rt_runtime,omitempty"`
	CPURealtimePeriod  Duration    `yaml:"cpu_rt_period,omitempty"`
	CPUSet             String      `yaml:"cpuset,omitempty"`
	BlkioConfig        BlkioConfig `yaml:"blkio_config,omitempty"`
	Build              Build       `yaml:"build,omitempty"`
	CapAdd             Strings     `yaml:"cap_add,omitempty"`
	CapDrop            Strings     `yaml:"cap_drop,omitempty"`
	CgroupParent       String      `yaml:"cgroup_parent,omitempty"`
	Command            Command     `yaml:"command,omitempty"`
	Configs            Strings     `yaml:"configs,omitempty"` // TODO: support long syntax.
	ContainerName      String      `yaml:"container_name,omitempty"`
	// TODO: credential_spec
	DependsOn         ServiceDependencies     `yaml:"depends_on,omitempty"`
	DeviceCgroupRules Strings                 `yaml:"device_cgroup_rules,omitempty"`
	Devices           []DeviceMapping         `yaml:"devices,omitempty"`
	DNS               Tuple                   `yaml:"dns,omitempty"`
	DNSOptions        Strings                 `yaml:"dns_opt,omitempty"`
	DNSSearch         Tuple                   `yaml:"dns_search,omitempty"`
	Domainname        String                  `yaml:"domainname,omitempty"`
	Entrypoint        Command                 `yaml:"entrypoint,omitempty"`
	EnvFile           Tuple                   `yaml:"env_file,omitempty"`
	Environment       Dictionary              `yaml:"environment,omitempty"`
	Expose            []PortRangeWithProtocol `yaml:"expose,omitempty"`
	// TODO: extends
	// List of links of the form `SERVICE` or `SERVICE:ALIAS`
	ExternalLinks Strings `yaml:"external_links,omitempty"`
	// List of host/IP pairs to add to /etc/hosts of the form `HOST:IP`
	ExtraHosts       Strings         `yaml:"extra_hosts,omitempty"`
	GroupAdd         Strings         `yaml:"group_add,omitempty"`
	Healthcheck      *Healthcheck    `yaml:"healthcheck,omitempty"`
	Hostname         String          `yaml:"hostname,omitempty"`
	Image            String          `yaml:"image,omitempty"`
	Init             *Bool           `yaml:"init,omitempty"`
	IPC              String          `yaml:"ipc,omitempty"`
	Isolation        String          `yaml:"isolation,omitempty"`
	Labels           Dictionary      `yaml:"labels,omitempty"`
	Links            Links           `yaml:"links,omitempty"`
	Logging          Logging         `yaml:"logging,omitempty"`
	NetworkMode      String          `yaml:"network_mode,omitempty"`
	Networks         ServiceNetworks `yaml:"networks,omitempty"`
	MacAddress       String          `yaml:"mac_address,omitempty"`
	MemorySwappiness *Int            `yaml:"mem_swappiness,omitempty"`
	// MemoryLimit and MemoryReservation can be specified either as strings or integers.
	// TODO: Deprecate these fields once we support `deploy.limits.memory` and `deploy.reservations.memory`.
	MemoryLimit       Bytes `yaml:"mem_limit,omitempty"`
	MemoryReservation Bytes `yaml:"mem_reservation,omitempty"`

	MemswapLimit   Bytes        `yaml:"memswap_limit,omitempty"`
	OomKillDisable *Bool        `yaml:"oom_kill_disable,omitempty"`
	OomScoreAdj    Int          `yaml:"oom_score_adj,omitempty"`
	PidMode        String       `yaml:"pid,omitempty"`
	PidsLimit      *Int         `yaml:"pids_limit,omitempty"`
	Platform       String       `yaml:"platform,omitempty"`
	Ports          PortMappings `yaml:"ports,omitempty"`
	Privileged     Bool         `yaml:"privileged,omitempty"`
	// TODO: Support profiles. See https://docs.docker.com/compose/profiles/.
	Profiles        Ignored       `yaml:"profiles,omitempty"`
	PullPolicy      String        `yaml:"pull_policy,omitempty"`
	ReadOnly        Bool          `yaml:"read_only,omitempty"`
	Restart         String        `yaml:"restart,omitempty"`
	Runtime         String        `yaml:"runtime,omitempty"`
	SecurityOpt     Strings       `yaml:"security_opt,omitempty"`
	ShmSize         Bytes         `yaml:"shm_size,omitempty"`
	StdinOpen       Bool          `yaml:"stdin_open,omitempty"`
	StopGracePeriod *Duration     `yaml:"stop_grace_period,omitempty"`
	StopSignal      String        `yaml:"stop_signal,omitempty"`
	StorageOpt      Dictionary    `yaml:"storage_opt,omitempty"`
	Sysctls         Dictionary    `yaml:"sysctls,omitempty"`
	Tmpfs           Tuple         `yaml:"tmpfs,omitempty"`
	TTY             Bool          `yaml:"tty,omitempty"`
	Ulimits         Ulimits       `yaml:"ulimits,omitempty"`
	User            String        `yaml:"user,omitempty"`
	UsernsMode      String        `yaml:"userns_mode,omitempty"`
	Volumes         []VolumeMount `yaml:"volumes,omitempty"`
	VolumesFrom     Strings       `yaml:"volumes_from,omitempty"`
	WorkingDir      String        `yaml:"working_dir,omitempty"`

	// NOTE [DOCKER SWARM FEATURES]:
	// Docker-Compose manages local, single-container deployments as well as Docker Swarm
	// deployments. Since Swarm is not as widely used as Kubernetes, support for the Swarm
	// features that Docker-Compose includes is not a top priority. The settings listed
	// below are the ones that are applicable to a Swarm deployment.
	Deploy  Ignored `yaml:"deploy,omitempty"`
	Scale   Ignored `yaml:"scale,omitempty"`
	Secrets Ignored `yaml:"secrets,omitempty"`
}

func (*Service) Interpolate

func (service *Service) Interpolate(env Environment) error

type ServiceDependencies

type ServiceDependencies struct {
	Style Style
	Items []ServiceDependency
}

func (*ServiceDependencies) Interpolate

func (deps *ServiceDependencies) Interpolate(env Environment) error

func (ServiceDependencies) MarshalYAML

func (deps ServiceDependencies) MarshalYAML() (any, error)

func (*ServiceDependencies) UnmarshalYAML

func (deps *ServiceDependencies) UnmarshalYAML(node *yaml.Node) error

type ServiceDependency

type ServiceDependency struct {
	IsShortSyntax bool
	Service       String
	ServiceDependencyLongForm
}

func (*ServiceDependency) Interpolate

func (dep *ServiceDependency) Interpolate(env Environment) error

func (ServiceDependency) MarshalYAML

func (dep ServiceDependency) MarshalYAML() (any, error)

func (*ServiceDependency) UnmarshalYAML

func (dep *ServiceDependency) UnmarshalYAML(node *yaml.Node) error

type ServiceDependencyLongForm

type ServiceDependencyLongForm struct {
	Condition String `yaml:"condition,omitempty"`
}

func (*ServiceDependencyLongForm) Interpolate

func (dep *ServiceDependencyLongForm) Interpolate(env Environment) error

type ServiceNetwork

type ServiceNetwork struct {
	Key string

	ShortForm String
	ServiceNetworkLongForm
}

func (*ServiceNetwork) Interpolate

func (sn *ServiceNetwork) Interpolate(env Environment) error

func (ServiceNetwork) MarshalYAML

func (sn ServiceNetwork) MarshalYAML() (any, error)

func (*ServiceNetwork) UnmarshalYAML

func (sn *ServiceNetwork) UnmarshalYAML(node *yaml.Node) error

type ServiceNetworkLongForm

type ServiceNetworkLongForm struct {
	Aliases      Strings `yaml:"aliases,omitempty"`
	IPV4Address  String  `yaml:"ipv4_address,omitempty"`
	IPV6Address  String  `yaml:"ipv6_address,omitempty"`
	LinkLocalIPs Strings `yaml:"link_local_ips,omitempty"`
	Priority     Int     `yaml:"priority,omitempty"`
}

func (*ServiceNetworkLongForm) Interpolate

func (sn *ServiceNetworkLongForm) Interpolate(env Environment) error

type ServiceNetworks

type ServiceNetworks struct {
	Style Style
	Items []ServiceNetwork
}

func (*ServiceNetworks) Interpolate

func (sn *ServiceNetworks) Interpolate(env Environment) error

func (ServiceNetworks) MarshalYAML

func (sn ServiceNetworks) MarshalYAML() (any, error)

func (*ServiceNetworks) UnmarshalYAML

func (sn *ServiceNetworks) UnmarshalYAML(node *yaml.Node) error

type String

type String struct {
	Tag        string
	Style      yaml.Style
	Expression string
	Value      string
}

String is a scalar leaf node in a compose document. Non-string types generally embed a String to facilitate interpolation. See the package documentation.

func MakeString

func MakeString(s string) String

func (*String) Interpolate

func (s *String) Interpolate(env Environment) error

func (String) MarshalYAML

func (s String) MarshalYAML() (any, error)

func (*String) UnmarshalYAML

func (s *String) UnmarshalYAML(node *yaml.Node) error

func (String) WithValue

func (s String) WithValue(v string) String

type Strings

type Strings []String

func (Strings) Values

func (ss Strings) Values() []string

type Style

type Style byte

Some sections and subsections can be expressed as either a map or sequence. Style records the original kind of syntax used in the source YAML.

type ThrottleDevice

type ThrottleDevice struct {
	Path String `yaml:"path,omitempty"`
	Rate Bytes  `yaml:"rate,omitempty"`
}

func (*ThrottleDevice) Interpolate

func (td *ThrottleDevice) Interpolate(env Environment) error

type TmpfsOptions

type TmpfsOptions struct {
	Size Bytes `yaml:"size,omitempty"`
}

func (*TmpfsOptions) Interpolate

func (opt *TmpfsOptions) Interpolate(env Environment) error

type Tuple

type Tuple struct {
	IsSequence bool
	Items      []String
}

A sequence of strings that may be marshalled as an individual string.

func MakeTuple

func MakeTuple(items ...String) Tuple

func (*Tuple) Interpolate

func (tup *Tuple) Interpolate(env Environment) error

func (Tuple) MarshalYAML

func (ss Tuple) MarshalYAML() (any, error)

func (*Tuple) UnmarshalYAML

func (ss *Tuple) UnmarshalYAML(node *yaml.Node) error

func (Tuple) Values

func (ss Tuple) Values() []string

type Ulimit

type Ulimit struct {
	Name string

	ShortForm Int
	UlimitLongForm
}

func (*Ulimit) Interpolate

func (ul *Ulimit) Interpolate(env Environment) error

func (Ulimit) MarshalYAML

func (ul Ulimit) MarshalYAML() (any, error)

func (*Ulimit) UnmarshalYAML

func (ul *Ulimit) UnmarshalYAML(node *yaml.Node) error

type UlimitLongForm

type UlimitLongForm struct {
	Soft Int `yaml:"soft,omitempty"`
	Hard Int `yaml:"hard,omitempty"`
}

func (*UlimitLongForm) Interpolate

func (ul *UlimitLongForm) Interpolate(env Environment) error

type Ulimits

type Ulimits []Ulimit

func (*Ulimits) Interpolate

func (uls *Ulimits) Interpolate(env Environment) error

func (Ulimits) MarshalYAML

func (uls Ulimits) MarshalYAML() (any, error)

func (*Ulimits) UnmarshalYAML

func (uls *Ulimits) UnmarshalYAML(node *yaml.Node) error

type Volume

type Volume struct {
	Key string `yaml:"-"`

	Driver     String     `yaml:"driver,omitempty"`
	DriverOpts Dictionary `yaml:"driver_opts,omitempty"`
	// TODO: external
	Labels Dictionary `yaml:"labels,omitempty"`
	Name   String     `yaml:"name,omitempty"`
}

func (*Volume) Interpolate

func (v *Volume) Interpolate(env Environment) error

type VolumeMount

type VolumeMount struct {
	ShortForm String
	VolumeMountLongForm
}

func (*VolumeMount) Interpolate

func (vm *VolumeMount) Interpolate(env Environment) error

func (VolumeMount) MarshalYAML

func (vm VolumeMount) MarshalYAML() (any, error)

func (*VolumeMount) UnmarshalYAML

func (vm *VolumeMount) UnmarshalYAML(node *yaml.Node) error

type VolumeMountLongForm

type VolumeMountLongForm struct {
	Type        String         `yaml:"type,omitempty"`
	Source      String         `yaml:"source,omitempty"`
	Target      String         `yaml:"target,omitempty"`
	ReadOnly    Bool           `yaml:"read_only,omitempty"`
	Bind        *BindOptions   `yaml:"bind,omitempty"`
	Volume      *VolumeOptions `yaml:"volume,omitempty"`
	Tmpfs       *TmpfsOptions  `yaml:"tmpfs,omitempty"`
	Consistency *Ignored       `yaml:"consistency,omitempty"`
}

func (*VolumeMountLongForm) Interpolate

func (vm *VolumeMountLongForm) Interpolate(env Environment) error

type VolumeOptions

type VolumeOptions struct {
	Nocopy Bool `yaml:"nocopy,omitempty"`
}

func (*VolumeOptions) Interpolate

func (opt *VolumeOptions) Interpolate(env Environment) error

type WeightDevice

type WeightDevice struct {
	Path   String `yaml:"path,omitempty"`
	Weight Int    `yaml:"weight,omitempty"`
}

func (*WeightDevice) Interpolate

func (wd *WeightDevice) Interpolate(env Environment) error

Directories

Path Synopsis
Package template implements string substitution in the style of Python's string.Template library as extended by Docker Compose.
Package template implements string substitution in the style of Python's string.Template library as extended by Docker Compose.

Jump to

Keyboard shortcuts

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