opts

package
v1.10.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertKVStringsToMap

func ConvertKVStringsToMap(values []string) map[string]string

ConvertKVStringsToMap converts ["key=value"] to {"key":"value"}

func Parse

Parse parses the specified args for the specified command and generates a Config, a HostConfig and returns them with the specified command. If the specified args are not valid, it will return an error.

func ParseDevice

func ParseDevice(device string) (container.DeviceMapping, error)

ParseDevice parses a device mapping string to a container.DeviceMapping struct

func ParseEnvFile

func ParseEnvFile(filename string) ([]string, error)

ParseEnvFile reads a file with environment variables enumerated by lines

“Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase letters, digits, and the '_' (underscore) from the characters defined in Portable Character Set and do not begin with a digit. *But*, other characters may be permitted by an implementation; applications shall tolerate the presence of such names.” -- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html

As of #16585, it's up to application inside docker to validate or not environment variables, that's why we just strip leading whitespace and nothing more.

func ParseLink(val string) (string, string, error)

ParseLink parses and validates the specified string as a link format (name:alias)

func ParseRestartPolicy

func ParseRestartPolicy(policy string) (container.RestartPolicy, error)

ParseRestartPolicy returns the parsed policy or an error indicating what is incorrect

func ValidDeviceMode

func ValidDeviceMode(mode string) bool

ValidDeviceMode checks if the mode for device is valid or not. Valid mode is a composition of r (read), w (write), and m (mknod).

func ValidateAttach

func ValidateAttach(val string) (string, error)

ValidateAttach validates that the specified string is a valid attach option.

func ValidateDevice

func ValidateDevice(val string) (string, error)

ValidateDevice validates a path for devices It will make sure 'val' is in the form:

[host-dir:]container-path[:mode]

It also validates the device mode.

func ValidateEnv

func ValidateEnv(val string) (string, error)

ValidateEnv validates an environment variable and returns it. If no value is specified, it returns the current value using os.Getenv.

As on ParseEnvFile and related to #16585, environment variable names are not validate what so ever, it's up to application inside docker to validate them or not.

func ValidateExtraHost

func ValidateExtraHost(val string) (string, error)

ValidateExtraHost validates that the specified string is a valid extrahost and returns it. ExtraHost are in the form of name:ip where the ip has to be a valid ip (ipv4 or ipv6).

func ValidateLink(val string) (string, error)

ValidateLink validates that the specified string has a valid link format (containerName:alias).

func ValidateMACAddress

func ValidateMACAddress(val string) (string, error)

ValidateMACAddress validates a MAC address.

func ValidateThrottleBpsDevice

func ValidateThrottleBpsDevice(val string) (*blkiodev.ThrottleDevice, error)

ValidateThrottleBpsDevice validates that the specified string has a valid device-rate format.

func ValidateThrottleIOpsDevice

func ValidateThrottleIOpsDevice(val string) (*blkiodev.ThrottleDevice, error)

ValidateThrottleIOpsDevice validates that the specified string has a valid device-rate format.

func ValidateWeightDevice

func ValidateWeightDevice(val string) (*blkiodev.WeightDevice, error)

ValidateWeightDevice validates that the specified string has a valid device-weight format.

Types

type ErrBadEnvVariable

type ErrBadEnvVariable struct {
	// contains filtered or unexported fields
}

ErrBadEnvVariable typed error for bad environment variable

func (ErrBadEnvVariable) Error

func (e ErrBadEnvVariable) Error() string

type ThrottledeviceOpt

type ThrottledeviceOpt struct {
	// contains filtered or unexported fields
}

ThrottledeviceOpt defines a map of ThrottleDevices

func NewThrottledeviceOpt

func NewThrottledeviceOpt(validator ValidatorThrottleFctType) ThrottledeviceOpt

NewThrottledeviceOpt creates a new ThrottledeviceOpt

func (*ThrottledeviceOpt) GetList

func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice

GetList returns a slice of pointers to ThrottleDevices.

func (*ThrottledeviceOpt) Set

func (opt *ThrottledeviceOpt) Set(val string) error

Set validates a ThrottleDevice and sets its name as a key in ThrottledeviceOpt

func (*ThrottledeviceOpt) String

func (opt *ThrottledeviceOpt) String() string

String returns ThrottledeviceOpt values as a string.

type UlimitOpt

type UlimitOpt struct {
	// contains filtered or unexported fields
}

UlimitOpt defines a map of Ulimits

func NewUlimitOpt

func NewUlimitOpt(ref *map[string]*units.Ulimit) *UlimitOpt

NewUlimitOpt creates a new UlimitOpt

func (*UlimitOpt) GetList

func (o *UlimitOpt) GetList() []*units.Ulimit

GetList returns a slice of pointers to Ulimits.

func (*UlimitOpt) Set

func (o *UlimitOpt) Set(val string) error

Set validates a Ulimit and sets its name as a key in UlimitOpt

func (*UlimitOpt) String

func (o *UlimitOpt) String() string

String returns Ulimit values as a string.

type ValidatorThrottleFctType

type ValidatorThrottleFctType func(val string) (*blkiodev.ThrottleDevice, error)

ValidatorThrottleFctType defines a validator function that returns a validated struct and/or an error.

type ValidatorWeightFctType

type ValidatorWeightFctType func(val string) (*blkiodev.WeightDevice, error)

ValidatorWeightFctType defines a validator function that returns a validated struct and/or an error.

type WeightdeviceOpt

type WeightdeviceOpt struct {
	// contains filtered or unexported fields
}

WeightdeviceOpt defines a map of WeightDevices

func NewWeightdeviceOpt

func NewWeightdeviceOpt(validator ValidatorWeightFctType) WeightdeviceOpt

NewWeightdeviceOpt creates a new WeightdeviceOpt

func (*WeightdeviceOpt) GetList

func (opt *WeightdeviceOpt) GetList() []*blkiodev.WeightDevice

GetList returns a slice of pointers to WeightDevices.

func (*WeightdeviceOpt) Set

func (opt *WeightdeviceOpt) Set(val string) error

Set validates a WeightDevice and sets its name as a key in WeightdeviceOpt

func (*WeightdeviceOpt) String

func (opt *WeightdeviceOpt) String() string

String returns WeightdeviceOpt values as a string.

Jump to

Keyboard shortcuts

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