Documentation ¶
Index ¶
- func DefaultUnitType(name string) string
- func RecognizedUnitType(name string) bool
- type FakeUnitManager
- func (fum *FakeUnitManager) GetUnitState(name string) (us *UnitState, err error)
- func (fum *FakeUnitManager) Load(name string, u Unit) error
- func (fum *FakeUnitManager) MarshalJSON() ([]byte, error)
- func (fum *FakeUnitManager) Start(string)
- func (fum *FakeUnitManager) Stop(string)
- func (fum *FakeUnitManager) Units() ([]string, error)
- func (fum *FakeUnitManager) Unload(name string)
- type Hash
- type Unit
- type UnitManager
- type UnitNameInfo
- type UnitState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultUnitType ¶ added in v0.3.1
DefaultUnitType appends the default unit type to a given unit name, ignoring any file extensions that already exist.
func RecognizedUnitType ¶ added in v0.3.1
RecognizedUnitType determines whether or not the given unit name represents a recognized unit type.
Types ¶
type FakeUnitManager ¶ added in v0.4.0
func NewFakeUnitManager ¶ added in v0.4.0
func NewFakeUnitManager() *FakeUnitManager
func (*FakeUnitManager) GetUnitState ¶ added in v0.4.0
func (fum *FakeUnitManager) GetUnitState(name string) (us *UnitState, err error)
func (*FakeUnitManager) Load ¶ added in v0.4.0
func (fum *FakeUnitManager) Load(name string, u Unit) error
func (*FakeUnitManager) MarshalJSON ¶ added in v0.4.0
func (fum *FakeUnitManager) MarshalJSON() ([]byte, error)
func (*FakeUnitManager) Start ¶ added in v0.4.0
func (fum *FakeUnitManager) Start(string)
func (*FakeUnitManager) Stop ¶ added in v0.4.0
func (fum *FakeUnitManager) Stop(string)
func (*FakeUnitManager) Units ¶ added in v0.4.0
func (fum *FakeUnitManager) Units() ([]string, error)
func (*FakeUnitManager) Unload ¶ added in v0.4.0
func (fum *FakeUnitManager) Unload(name string)
type Unit ¶ added in v0.3.0
type Unit struct { // Contents represents the parsed unit file. // This field must be considered readonly. Contents map[string]map[string][]string // Raw represents the entire contents of the unit file. Raw string }
A Unit represents a systemd configuration which encodes information about any of the unit types that fleet supports (as defined in SupportedUnitTypes()). Units are linked to Jobs by the Hash of their contents. Similar to systemd, a Unit configuration has no inherent name, but is rather named through the reference to it; in the case of systemd, the reference is the filename, and in the case of fleet, the reference is the name of the job that references this Unit.
func NewUnitFromLegacyContents ¶ added in v0.3.0
NewUnitFromLegacyContents creates a Unit object from an obsolete unit file datastructure. This should only be used to remain backwards-compatible where necessary.
func (*Unit) Description ¶ added in v0.3.0
Description returns the first Description option found in the Unit section. If the option is not defined, an empty string is returned.
type UnitManager ¶ added in v0.4.0
type UnitNameInfo ¶ added in v0.5.0
type UnitNameInfo struct { FullName string // Original complete name of the unit (e.g. foo.socket, foo@bar.service) Name string // Name of the unit without suffix (e.g. foo, foo@bar) Prefix string // Prefix of the template unit (e.g. foo) // If the unit represents an instance or a template, the following values are set Template string // Name of the canonical template unit (e.g. foo@.service) Instance string // Instance name (e.g. bar) }
UnitNameInfo exposes certain interesting items about a Unit based on its name. For example, a unit with the name "foo@.service" constitutes a template unit, and a unit named "foo@1.service" would represent an instance unit of that template.
func NewUnitNameInfo ¶ added in v0.5.0
func NewUnitNameInfo(un string) *UnitNameInfo
NewUnitNameInfo generates a UnitNameInfo from the given name. If the given string is not a correct unit name, nil is returned.
func (UnitNameInfo) IsInstance ¶ added in v0.5.0
func (nu UnitNameInfo) IsInstance() bool
IsInstance returns a boolean indicating whether the UnitNameInfo appears to be an Instance of a Template unit
type UnitState ¶ added in v0.3.0
UnitState encodes the current state of a unit loaded into systemd