resources

package
v0.0.0-...-1887219 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: GPL-3.0 Imports: 66 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AwsPrefix is a const which gets prepended onto object names. We can only use
	// alphanumeric chars, underscores and hyphens for sns topics and cloud watch rules.
	AwsPrefix = "_mgmt-"
	// Ec2Prefix is added to the names of sns and cloudwatch objects.
	Ec2Prefix = AwsPrefix + "ec2-"
	// SnsPrefix gets prepended onto the sns topic.
	SnsPrefix = Ec2Prefix + "sns-"
	// SnsTopicName is the name of the sns topic created by snsMakeTopic.
	SnsTopicName = SnsPrefix + "events"
	// SnsSubscriptionProto is used to tell sns that the subscriber uses the http protocol.
	// TODO: add https support
	SnsSubscriptionProto = "http"
	// SnsServerShutdownTimeout is the maximum number of seconds to wait for the http server to shutdown gracefully.
	SnsServerShutdownTimeout = 30
	// SnsPolicy is the topic attribute that defines the security policy for the topic.
	SnsPolicy = "Policy"
	// SnsPolicySid is the friendly name of the policy statement.
	SnsPolicySid = CwePrefix + "publish"
	// SnsPolicyEffect allows the action(s) defined in the policy statement.
	SnsPolicyEffect = "Allow"
	// SnsPolicyService is the cloudwatch events security principal that we are granting the permission to.
	SnsPolicyService = "events.amazonaws.com"
	// SnsPolicyAction is the specific permission we are granting in the policy.
	SnsPolicyAction = "SNS:Publish"
	// SnsCertURLRegex is used to make sure we only download certificates
	// from amazon. This regex will match "https://sns.***.amazonaws.com/"
	// where *** represents any combination of words and hyphens, and will
	// match any aws region name, eg: ca-central-1.
	SnsCertURLRegex = `(^https:\/\/sns\.([\w\-])+\.amazonaws.com\/)`
	// CwePrefix gets prepended onto the cloudwatch rule name.
	CwePrefix = Ec2Prefix + "cw-"
	// CweRuleName is the name of the rule created by makeCloudWatchRule.
	CweRuleName = CwePrefix + "state"
	// CweRuleSource describes the resource type to monitor for cloudwatch events.
	CweRuleSource = "aws.ec2"
	// CweRuleDetailType describes the specific type of events to trigger cloudwatch.
	CweRuleDetailType = "EC2 Instance State-change Notification"
	// CweTargetID is used to tell cloudwatch events to target the sns service.
	CweTargetID = "sns"
	// CweTargetJSON is the json field that cloudwatch will send to our endpoint so we don't get more than we need.
	CweTargetJSON = "$.detail"
	// AwsErrExceededWaitAttempts is the awserr.Message() that gets sent with
	// the ResourceStateNotReady awserr.Code() when the waiters time out.
	AwsErrExceededWaitAttempts = "exceeded wait attempts"
	// AwsErrIncorrectInstanceState is the error returned when an action
	// cannot be completed due to the current instance state.
	AwsErrIncorrectInstanceState = "IncorrectInstanceState"
)
View Source
const (
	// OnCalendar is a systemd-timer trigger, whose behaviour is defined in
	// 'man systemd-timer', and whose format is defined in the 'Calendar
	// Events' section of 'man systemd-time'.
	OnCalendar = "OnCalendar"
	// OnActiveSec is a systemd-timer trigger, whose behaviour is defined in
	// 'man systemd-timer', and whose format is a time span as defined in
	// 'man systemd-time'.
	OnActiveSec = "OnActiveSec"
	// OnBootSec is a systemd-timer trigger, whose behaviour is defined in
	// 'man systemd-timer', and whose format is a time span as defined in
	// 'man systemd-time'.
	OnBootSec = "OnBootSec"
	// OnStartupSec is a systemd-timer trigger, whose behaviour is defined in
	// 'man systemd-timer', and whose format is a time span as defined in
	// 'man systemd-time'.
	OnStartupSec = "OnStartupSec"
	// OnUnitActiveSec is a systemd-timer trigger, whose behaviour is defined
	// in 'man systemd-timer', and whose format is a time span as defined in
	// 'man systemd-time'.
	OnUnitActiveSec = "OnUnitActiveSec"
	// OnUnitInactiveSec is a systemd-timer trigger, whose behaviour is defined
	// in 'man systemd-timer', and whose format is a time span as defined in
	// 'man systemd-time'.
	OnUnitInactiveSec = "OnUnitInactiveSec"
)
View Source
const (
	// ContainerRunning is the running container state.
	ContainerRunning = "running"
	// ContainerStopped is the stopped container state.
	ContainerStopped = "stopped"
	// ContainerRemoved is the removed container state.
	ContainerRemoved = "removed"
)
View Source
const (
	// PkgStateInstalled is the string that represents that the package
	// should be installed.
	PkgStateInstalled = "installed"

	// PkgStateUninstalled is the string that represents that the package
	// should be uninstalled.
	PkgStateUninstalled = "uninstalled"

	// PkgStateNewest is the string that represents that the package should
	// be installed in the newest available version.
	PkgStateNewest = "newest"
)
View Source
const (
	// DefaultMaxCPUs is the default number of possible cpu "slots" used.
	DefaultMaxCPUs = 32

	// MaxShutdownDelayTimeout is the max time we wait for a vm to shutdown.
	MaxShutdownDelayTimeout = 60 * 5 // seconds

	// ShortPollInterval is how often we poll when expecting an event.
	ShortPollInterval = 5 // seconds
)
View Source
const (
	// IfacePrefix is the prefix used to identify unit files for managed links.
	IfacePrefix = "mgmt-"
)
View Source
const (
	// NS is a namespace for augeas operations
	NS = "Xmgmt"
)

Variables

View Source
var AwsRegions = []string{
	"ap-northeast-1",
	"ap-northeast-2",
	"ap-south-1",
	"ap-southeast-1",
	"ap-southeast-2",
	"ca-central-1",
	"cn-north-1",
	"eu-central-1",
	"eu-west-1",
	"eu-west-2",
	"sa-east-1",
	"us-east-1",
	"us-east-2",
	"us-gov-west-1",
	"us-west-1",
	"us-west-2",
}

AwsRegions is a list of all AWS regions generated using ec2.DescribeRegions. cn-north-1 and us-gov-west-1 are not returned, probably due to security. List available at http://docs.aws.amazon.com/general/latest/gr/rande.html

View Source
var ErrResourceInsufficientParameters = errors.New("insufficient parameters for this resource")

ErrResourceInsufficientParameters is returned when the configuration of the resource is insufficient for the resource to do any useful work.

Functions

func ReturnSvcInFileList

func ReturnSvcInFileList(fileList []string) []string

ReturnSvcInFileList returns a list of svc names for matches like: `/usr/lib/systemd/system/*.service`.

Types

type AugeasRes

type AugeasRes struct {
	traits.Base // add the base methods without re-implementation

	// File is the path to the file targeted by this resource.
	File string `yaml:"file"`

	// Lens is the lens used by this resource. If specified, mgmt
	// will lower the augeas overhead by only loading that lens.
	Lens string `yaml:"lens"`

	// Sets is a list of changes that will be applied to the file, in the form of
	// ["path", "value"]. mgmt will run augeas.Get() before augeas.Set(), to
	// prevent changing the file when it is not needed.
	Sets []*AugeasSet `yaml:"sets"`
	// contains filtered or unexported fields
}

AugeasRes is a resource that enables you to use the augeas resource. Currently only allows you to change simple files (e.g sshd_config).

func (*AugeasRes) CheckApply

func (obj *AugeasRes) CheckApply(apply bool) (bool, error)

CheckApply method for Augeas resource.

func (*AugeasRes) Close

func (obj *AugeasRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*AugeasRes) Cmp

func (obj *AugeasRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*AugeasRes) Default

func (obj *AugeasRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*AugeasRes) Init

func (obj *AugeasRes) Init(init *engine.Init) error

Init initializes the resource.

func (*AugeasRes) UIDs

func (obj *AugeasRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object.

func (*AugeasRes) UnmarshalYAML

func (obj *AugeasRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*AugeasRes) Validate

func (obj *AugeasRes) Validate() error

Validate if the params passed in are valid data.

func (*AugeasRes) Watch

func (obj *AugeasRes) Watch() error

Watch is the primary listener for this resource and it outputs events. Taken from the File resource. FIXME: DRY - This is taken from the file resource

type AugeasSet

type AugeasSet struct {
	Path  string `yaml:"path"`  // The relative path to the value to be changed.
	Value string `yaml:"value"` // The value to be set on the given Path.
}

AugeasSet represents a key/value pair of settings to be applied.

func (*AugeasSet) Cmp

func (obj *AugeasSet) Cmp(set *AugeasSet) error

Cmp compares this set with another one.

type AugeasUID

type AugeasUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

AugeasUID is the UID struct for AugeasRes.

type AwsEc2Res

type AwsEc2Res struct {
	traits.Base // add the base methods without re-implementation

	State   string `yaml:"state"`   // state: running, stopped, terminated
	Region  string `yaml:"region"`  // region must match an element of AwsRegions
	Type    string `yaml:"type"`    // type of ec2 instance, eg: t2.micro
	ImageID string `yaml:"imageid"` // imageid must be available on the chosen region

	WatchEndpoint   string `yaml:"watchendpoint"`   // the public url of the sns endpoint, eg: http://server:12345/
	WatchListenAddr string `yaml:"watchlistenaddr"` // the local address or port that the sns listens on, eg: 10.0.0.0:23456 or 23456
	// ErrorOnMalformedPost controls whether or not malformed HTTP post
	// requests, that cause JSON decoder errors, will also make the engine
	// shut down. If ErrorOnMalformedPost set to true and an error occurs,
	// Watch() will return the error and the engine will shut down.
	ErrorOnMalformedPost bool `yaml:"erroronmalformedpost"`

	// UserData is used to run bash and cloud-init commands on first launch.
	// See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
	// for documantation and examples.
	UserData string `yaml:"userdata"`

	// store read-only values for send/recv.
	PublicIPv4  string
	PrivateIPv4 string
	InstanceID  string
	// contains filtered or unexported fields
}

AwsEc2Res is an AWS EC2 resource. In order to create a client session, your AWS credentials must be present in ~/.aws - For detailed instructions see http://docs.aws.amazon.com/cli/latest/userguide/cli-config-files.html

func (*AwsEc2Res) CheckApply

func (obj *AwsEc2Res) CheckApply(apply bool) (bool, error)

CheckApply method for AwsEc2 resource.

func (*AwsEc2Res) Close

func (obj *AwsEc2Res) Close() error

Close cleans up when we're done. This is needed to delete some of the AWS objects created for the SNS endpoint.

func (*AwsEc2Res) Cmp

func (obj *AwsEc2Res) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*AwsEc2Res) Compare

func (obj *AwsEc2Res) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*AwsEc2Res) Default

func (obj *AwsEc2Res) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*AwsEc2Res) Init

func (obj *AwsEc2Res) Init(init *engine.Init) error

Init initializes the resource.

func (*AwsEc2Res) UIDs

func (obj *AwsEc2Res) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*AwsEc2Res) UnmarshalYAML

func (obj *AwsEc2Res) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*AwsEc2Res) Validate

func (obj *AwsEc2Res) Validate() error

Validate if the params passed in are valid data.

func (*AwsEc2Res) Watch

func (obj *AwsEc2Res) Watch() error

Watch is the primary listener for this resource and it outputs events.

type AwsEc2UID

type AwsEc2UID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

AwsEc2UID is the UID struct for AwsEc2Res.

type CDRomDevice

type CDRomDevice struct {
	Source string `lang:"source" yaml:"source"`
	Type   string `lang:"type" yaml:"type"`
}

CDRomDevice represents a CDRom device that is attached to the virt machine.

func (*CDRomDevice) Cmp

func (obj *CDRomDevice) Cmp(dev *CDRomDevice) error

Cmp compares two CDRomDevice's and returns an error if they are not equivalent.

func (*CDRomDevice) GetXML

func (obj *CDRomDevice) GetXML(idx int) string

GetXML returns the XML representation of this device.

type ConfigEtcdRes

type ConfigEtcdRes struct {
	traits.Base // add the base methods without re-implementation

	// IdealClusterSize is the requested minimum size of the cluster. If you
	// set this to zero, it will cause a cluster wide shutdown if
	// AllowSizeShutdown is true. If it's not true, then it will cause a
	// validation error.
	IdealClusterSize uint16 `lang:"idealclustersize"`
	// AllowSizeShutdown is a required safety flag that you must set to true
	// if you want to allow causing a cluster shutdown by setting
	// IdealClusterSize to zero.
	AllowSizeShutdown bool `lang:"allow_size_shutdown"`
	// contains filtered or unexported fields
}

ConfigEtcdRes is a resource that sets mgmt's etcd configuration.

func (*ConfigEtcdRes) CheckApply

func (obj *ConfigEtcdRes) CheckApply(apply bool) (bool, error)

CheckApply method for Noop resource. Does nothing, returns happy!

func (*ConfigEtcdRes) Close

func (obj *ConfigEtcdRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*ConfigEtcdRes) Cmp

func (obj *ConfigEtcdRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*ConfigEtcdRes) Default

func (obj *ConfigEtcdRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*ConfigEtcdRes) Init

func (obj *ConfigEtcdRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*ConfigEtcdRes) Interrupt

func (obj *ConfigEtcdRes) Interrupt() error

Interrupt is called to ask the execution of this resource to end early.

func (*ConfigEtcdRes) UnmarshalYAML

func (obj *ConfigEtcdRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*ConfigEtcdRes) Validate

func (obj *ConfigEtcdRes) Validate() error

Validate if the params passed in are valid data.

func (*ConfigEtcdRes) Watch

func (obj *ConfigEtcdRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type CronRes

type CronRes struct {
	traits.Base
	traits.Edgeable
	traits.Recvable
	traits.Refreshable // needed because we embed a svc res

	// Unit is the name of the systemd service unit. It is only necessary to
	// set if you want to specify a service with a different name than the
	// resource.
	Unit string `yaml:"unit"`
	// State must be 'exists' or 'absent'.
	State string `yaml:"state"`

	// Session, if true, creates the timer as the current user, rather than
	// root. The service it points to must also be a user unit. It defaults to
	// false.
	Session bool `yaml:"session"`

	// Trigger is the type of timer. Valid types are 'OnCalendar',
	// 'OnActiveSec'. 'OnBootSec'. 'OnStartupSec'. 'OnUnitActiveSec', and
	// 'OnUnitInactiveSec'. For more information see 'man systemd.timer'.
	Trigger string `yaml:"trigger"`
	// Time must be used with all triggers. For 'OnCalendar', it must be in
	// the format defined in 'man systemd-time' under the heading 'Calendar
	// Events'. For all other triggers, time should be a valid time span as
	// defined in 'man systemd-time'
	Time string `yaml:"time"`

	// AccuracySec is the accuracy of the timer in systemd-time time span
	// format. It defaults to one minute.
	AccuracySec string `yaml:"accuracysec"`
	// RandomizedDelaySec delays the timer by a randomly selected, evenly
	// distributed amount of time between 0 and the specified time value. The
	// value must be a valid systemd-time time span.
	RandomizedDelaySec string `yaml:"randomizeddelaysec"`

	// Persistent, if true, means the time when the service unit was last
	// triggered is stored on disk. When the timer is activated, the service
	// unit is triggered immediately if it would have been triggered at least
	// once during the time when the timer was inactive. It defaults to false.
	Persistent bool `yaml:"persistent"`
	// WakeSystem, if true, will cause the system to resume from suspend,
	// should it be suspended and if the system supports this. It defaults to
	// false.
	WakeSystem bool `yaml:"wakesystem"`
	// RemainAfterElapse, if true, means an elapsed timer will stay loaded, and
	// its state remains queriable. If false, an elapsed timer unit that cannot
	// elapse anymore is unloaded. It defaults to true.
	RemainAfterElapse bool `yaml:"remainafterelapse"`
	// contains filtered or unexported fields
}

CronRes is a systemd-timer cron resource.

func (*CronRes) AutoEdges

func (obj *CronRes) AutoEdges() (engine.AutoEdge, error)

AutoEdges returns the AutoEdge interface.

func (*CronRes) CheckApply

func (obj *CronRes) CheckApply(apply bool) (bool, error)

CheckApply is run to check the state and, if apply is true, to apply the necessary changes to reach the desired state. This is run before Watch and again if Watch finds a change occurring to the state.

func (*CronRes) Close

func (obj *CronRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*CronRes) Cmp

func (obj *CronRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*CronRes) Default

func (obj *CronRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*CronRes) Init

func (obj *CronRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*CronRes) UIDs

func (obj *CronRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one although some resources can return multiple.

func (*CronRes) UnitFilePath

func (obj *CronRes) UnitFilePath() (string, error)

UnitFilePath returns the path to the systemd-timer unit file.

func (*CronRes) UnmarshalYAML

func (obj *CronRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*CronRes) Validate

func (obj *CronRes) Validate() error

Validate if the params passed in are valid data.

func (*CronRes) Watch

func (obj *CronRes) Watch() error

Watch for state changes and sends a message to the bus if there is a change.

type CronUID

type CronUID struct {
	// NOTE: There is also a name variable in the BaseUID struct, this is
	// information about where this UID came from, and is unrelated to the
	// information about the resource we're matching. That data which is
	// used in the IFF function, is what you see in the struct fields here.
	engine.BaseUID
	// contains filtered or unexported fields
}

CronUID is a unique resource identifier.

func (*CronUID) IFF

func (obj *CronUID) IFF(uid engine.ResUID) bool

IFF aka if and only if they are equivalent, return true. If not, false.

type DiskDevice

type DiskDevice struct {
	Source string `lang:"source" yaml:"source"`
	Type   string `lang:"type" yaml:"type"`
}

DiskDevice represents a disk that is attached to the virt machine.

func (*DiskDevice) Cmp

func (obj *DiskDevice) Cmp(dev *DiskDevice) error

Cmp compares two DiskDevice's and returns an error if they are not equivalent.

func (*DiskDevice) GetXML

func (obj *DiskDevice) GetXML(idx int) string

GetXML returns the XML representation of this device.

type DockerContainerRes

type DockerContainerRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Edgeable

	// State of the container must be running, stopped, or removed.
	State string `yaml:"state"`
	// Image is a docker image, or image:tag.
	Image string `yaml:"image"`
	// Cmd is a command, or list of commands to run on the container.
	Cmd []string `yaml:"cmd"`
	// Env is a list of environment variables. E.g. ["VAR=val",].
	Env []string `yaml:"env"`
	// Ports is a map of port bindings. E.g. {"tcp" => {80 => 8080},}.
	Ports map[string]map[int64]int64 `yaml:"ports"`
	// APIVersion allows you to override the host's default client API version.
	APIVersion string `yaml:"apiversion"`

	// Force, if true, will destroy and redeploy the container if the image is
	// incorrect.
	Force bool `yaml:"force"`
	// contains filtered or unexported fields
}

DockerContainerRes is a docker container resource.

func (*DockerContainerRes) CheckApply

func (obj *DockerContainerRes) CheckApply(apply bool) (bool, error)

CheckApply method for Docker resource.

func (*DockerContainerRes) Close

func (obj *DockerContainerRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*DockerContainerRes) Cmp

func (obj *DockerContainerRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*DockerContainerRes) Default

func (obj *DockerContainerRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*DockerContainerRes) Init

func (obj *DockerContainerRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*DockerContainerRes) UIDs

func (obj *DockerContainerRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*DockerContainerRes) UnmarshalYAML

func (obj *DockerContainerRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*DockerContainerRes) Validate

func (obj *DockerContainerRes) Validate() error

Validate if the params passed in are valid data.

func (*DockerContainerRes) Watch

func (obj *DockerContainerRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type DockerUID

type DockerUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

DockerUID is the UID struct for DockerContainerRes.

type ExecRes

type ExecRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Edgeable
	traits.Sendable

	// Cmd is the command to run. If this is not specified, we use the name.
	Cmd string `yaml:"cmd"`
	// Args is a list of args to pass to Cmd. This can be used *instead* of
	// passing the full command and args as a single string to Cmd. It can
	// only be used when a Shell is *not* specified. The advantage of this
	// is that you don't have to worry about escape characters.
	Args []string `yaml:"args"`
	// Cmd is the dir to run the command in. If empty, then this will use
	// the working directory of the calling process. (This process is mgmt,
	// not the process being run here.)
	Cwd string `yaml:"cwd"`
	// Shell is the (optional) shell to use to run the cmd. If you specify
	// this, then you can't use the Args parameter.
	Shell string `yaml:"shell"`
	// Timeout is the number of seconds to wait before sending a Kill to the
	// running command. If the Kill is received before the process exits,
	// then this be treated as an error.
	Timeout uint64 `yaml:"timeout"`

	// Watch is the command to run to detect event changes. Each line of
	// output from this command is treated as an event.
	WatchCmd string `yaml:"watchcmd"`
	// WatchCwd is the Cwd for the WatchCmd. See the docs for Cwd.
	WatchCwd string `yaml:"watchcwd"`
	// WatchShell is the Shell for the WatchCmd. See the docs for Shell.
	WatchShell string `yaml:"watchshell"`

	// IfCmd is the command that runs to guard against running the Cmd. If
	// this command succeeds, then Cmd *will* be run. If this command
	// returns a non-zero result, then the Cmd will not be run. Any error
	// scenario or timeout will cause the resource to error.
	IfCmd string `yaml:"ifcmd"`
	// IfCwd is the Cwd for the IfCmd. See the docs for Cwd.
	IfCwd string `yaml:"ifcwd"`
	// IfShell is the Shell for the IfCmd. See the docs for Shell.
	IfShell string `yaml:"ifshell"`

	// User is the (optional) user to use to execute the command. It is used
	// for any command being run.
	User string `yaml:"user"`
	// Group is the (optional) group to use to execute the command. It is
	// used for any command being run.
	Group string `yaml:"group"`
	// contains filtered or unexported fields
}

ExecRes is an exec resource for running commands.

func (*ExecRes) AutoEdges

func (obj *ExecRes) AutoEdges() (engine.AutoEdge, error)

AutoEdges returns the AutoEdge interface. In this case the systemd units.

func (*ExecRes) CheckApply

func (obj *ExecRes) CheckApply(apply bool) (bool, error)

CheckApply checks the resource state and applies the resource if the bool input is true. It returns error info and if the state check passed or not. TODO: expand the IfCmd to be a list of commands

func (*ExecRes) Close

func (obj *ExecRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*ExecRes) Cmp

func (obj *ExecRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*ExecRes) Default

func (obj *ExecRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*ExecRes) Init

func (obj *ExecRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*ExecRes) Interrupt

func (obj *ExecRes) Interrupt() error

Interrupt is called to ask the execution of this resource to end early.

func (*ExecRes) Sends

func (obj *ExecRes) Sends() interface{}

Sends represents the default struct of values we can send using Send/Recv.

func (*ExecRes) UIDs

func (obj *ExecRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*ExecRes) UnmarshalYAML

func (obj *ExecRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*ExecRes) Validate

func (obj *ExecRes) Validate() error

Validate if the params passed in are valid data.

func (*ExecRes) Watch

func (obj *ExecRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type ExecResAutoEdges

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

ExecResAutoEdges holds the state of the auto edge generator.

func (*ExecResAutoEdges) Next

func (obj *ExecResAutoEdges) Next() []engine.ResUID

Next returns the next automatic edge.

func (*ExecResAutoEdges) Test

func (obj *ExecResAutoEdges) Test(input []bool) bool

Test gets results of the earlier Next() call, & returns if we should continue!

type ExecSends

type ExecSends struct {
	// Output is the combined stdout and stderr of the command.
	Output *string `lang:"output"`
	// Stdout is the stdout of the command.
	Stdout *string `lang:"stdout"`
	// Stderr is the stderr of the command.
	Stderr *string `lang:"stderr"`
}

ExecSends is the struct of data which is sent after a successful Apply.

type ExecUID

type ExecUID struct {
	engine.BaseUID
	Cmd   string
	IfCmd string
}

ExecUID is the UID struct for ExecRes.

type FileInfo

type FileInfo struct {
	os.FileInfo        // embed
	AbsPath     string // smart variant
	RelPath     string // smart variant
}

FileInfo is an enhanced variant of the traditional os.FileInfo struct. It can store both the absolute and the relative paths (when built from our ReadDir), and those two paths contain a trailing slash when they refer to a directory.

func ReadDir

func ReadDir(path string) ([]FileInfo, error)

ReadDir reads a directory path, and returns a list of enhanced FileInfo's.

type FileRes

type FileRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Edgeable
	//traits.Groupable // TODO: implement this
	traits.Recvable

	// Path, which defaults to the name if not specified, represents the
	// destination path for the file or directory being managed. It must be
	// an absolute path, and as a result must start with a slash.
	Path     string `lang:"path" yaml:"path"`
	Dirname  string `lang:"dirname" yaml:"dirname"`   // override the path dirname
	Basename string `lang:"basename" yaml:"basename"` // override the path basename

	// Content specifies the file contents to use. If this is nil, they are
	// left undefined. It cannot be combined with Source.
	Content *string `lang:"content" yaml:"content"`
	// Source specifies the source contents for the file resource. It cannot
	// be combined with the Content parameter.
	Source string `lang:"source" yaml:"source"`
	// State specifies the desired state of the file. It can be either
	// `exists` or `absent`. If you do not specify this, it will be
	// undefined, and determined based on the other parameters.
	State string `lang:"state" yaml:"state"`

	Owner   string `lang:"owner" yaml:"owner"`
	Group   string `lang:"group" yaml:"group"`
	Mode    string `lang:"mode" yaml:"mode"`
	Recurse bool   `lang:"recurse" yaml:"recurse"`
	Force   bool   `lang:"force" yaml:"force"`
	// contains filtered or unexported fields
}

FileRes is a file and directory resource. Dirs are defined by names ending in a slash.

func (*FileRes) AutoEdges

func (obj *FileRes) AutoEdges() (engine.AutoEdge, error)

AutoEdges generates a simple linear sequence of each parent directory from the bottom up!

func (*FileRes) CheckApply

func (obj *FileRes) CheckApply(apply bool) (bool, error)

CheckApply checks the resource state and applies the resource if the bool input is true. It returns error info and if the state check passed or not.

func (*FileRes) Close

func (obj *FileRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*FileRes) Cmp

func (obj *FileRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*FileRes) CollectPattern

func (obj *FileRes) CollectPattern(pattern string)

CollectPattern applies the pattern for collection resources.

func (*FileRes) Default

func (obj *FileRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*FileRes) Init

func (obj *FileRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*FileRes) UIDs

func (obj *FileRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*FileRes) UnmarshalYAML

func (obj *FileRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*FileRes) Validate

func (obj *FileRes) Validate() error

Validate reports any problems with the struct definition.

func (*FileRes) Watch

func (obj *FileRes) Watch() error

Watch is the primary listener for this resource and it outputs events. This one is a file watcher for files and directories. Modify with caution, it is probably important to write some test cases first! If the Watch returns an error, it means that something has gone wrong, and it must be restarted. On a clean exit it returns nil. FIXME: Also watch the source directory when using obj.Source !!!

type FileResAutoEdges

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

FileResAutoEdges holds the state of the auto edge generator.

func (*FileResAutoEdges) Next

func (obj *FileResAutoEdges) Next() []engine.ResUID

Next returns the next automatic edge.

func (*FileResAutoEdges) Test

func (obj *FileResAutoEdges) Test(input []bool) bool

Test gets results of the earlier Next() call, & returns if we should continue!

type FileUID

type FileUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

FileUID is the UID struct for FileRes.

func (*FileUID) IFF

func (obj *FileUID) IFF(uid engine.ResUID) bool

IFF aka if and only if they are equivalent, return true. If not, false.

type FilesystemDevice

type FilesystemDevice struct {
	Access   string `lang:"access" yaml:"access"`
	Source   string `lang:"source" yaml:"source"`
	Target   string `lang:"target" yaml:"target"`
	ReadOnly bool   `lang:"read_only" yaml:"read_only"`
}

FilesystemDevice represents a filesystem that is attached to the virt machine.

func (*FilesystemDevice) Cmp

func (obj *FilesystemDevice) Cmp(dev *FilesystemDevice) error

Cmp compares two FilesystemDevice's and returns an error if they are not equivalent.

func (*FilesystemDevice) GetXML

func (obj *FilesystemDevice) GetXML(idx int) string

GetXML returns the XML representation of this device.

type GroupRes

type GroupRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Edgeable

	State string  `yaml:"state"` // state: exists, absent
	GID   *uint32 `yaml:"gid"`   // the group's gid
	// contains filtered or unexported fields
}

GroupRes is a user group resource.

func (*GroupRes) AutoEdges

func (obj *GroupRes) AutoEdges() (engine.AutoEdge, error)

AutoEdges returns the AutoEdge interface.

func (*GroupRes) CheckApply

func (obj *GroupRes) CheckApply(apply bool) (bool, error)

CheckApply method for Group resource.

func (*GroupRes) Close

func (obj *GroupRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*GroupRes) Cmp

func (obj *GroupRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*GroupRes) Compare

func (obj *GroupRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*GroupRes) Default

func (obj *GroupRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*GroupRes) Init

func (obj *GroupRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*GroupRes) UIDs

func (obj *GroupRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*GroupRes) UnmarshalYAML

func (obj *GroupRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*GroupRes) Validate

func (obj *GroupRes) Validate() error

Validate if the params passed in are valid data.

func (*GroupRes) Watch

func (obj *GroupRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type GroupUID

type GroupUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

GroupUID is the UID struct for GroupRes.

func (*GroupUID) IFF

func (obj *GroupUID) IFF(uid engine.ResUID) bool

IFF aka if and only if they are equivalent, return true. If not, false.

type HostnameRes

type HostnameRes struct {
	traits.Base // add the base methods without re-implementation

	Hostname          string `yaml:"hostname"`
	PrettyHostname    string `yaml:"pretty_hostname"`
	StaticHostname    string `yaml:"static_hostname"`
	TransientHostname string `yaml:"transient_hostname"`
	// contains filtered or unexported fields
}

HostnameRes is a resource that allows setting and watching the hostname.

StaticHostname is the one configured in /etc/hostname or a similar file. It is chosen by the local user. It is not always in sync with the current host name as returned by the gethostname() system call.

TransientHostname is the one configured via the kernel's sethostbyname(). It can be different from the static hostname in case DHCP or mDNS have been configured to change the name based on network information.

PrettyHostname is a free-form UTF8 host name for presentation to the user.

Hostname is the fallback value for all 3 fields above, if only Hostname is specified, it will set all 3 fields to this value.

func (*HostnameRes) CheckApply

func (obj *HostnameRes) CheckApply(apply bool) (bool, error)

CheckApply method for Hostname resource.

func (*HostnameRes) Close

func (obj *HostnameRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*HostnameRes) Cmp

func (obj *HostnameRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*HostnameRes) Compare

func (obj *HostnameRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*HostnameRes) Default

func (obj *HostnameRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*HostnameRes) Init

func (obj *HostnameRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*HostnameRes) UIDs

func (obj *HostnameRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*HostnameRes) UnmarshalYAML

func (obj *HostnameRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*HostnameRes) Validate

func (obj *HostnameRes) Validate() error

Validate if the params passed in are valid data.

func (*HostnameRes) Watch

func (obj *HostnameRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type HostnameUID

type HostnameUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

HostnameUID is the UID struct for HostnameRes.

type KVRes

type KVRes struct {
	traits.Base // add the base methods without re-implementation
	//traits.Groupable // TODO: it could be useful to group our writes and watches!
	traits.Refreshable
	traits.Recvable

	// Key represents the key to set. If it is not specified, the Name value
	// is used instead.
	Key string `lang:"key" yaml:"key"`
	// Value represents the string value to set. If this value is nil or,
	// undefined, then this will delete that key.
	Value *string `lang:"value" yaml:"value"`
	// SkipLessThan causes the value to be updated as long as it is greater.
	SkipLessThan bool `lang:"skiplessthan" yaml:"skiplessthan"`
	// SkipCmpStyle is the type of compare function used when determining if
	// the value is greater when using the SkipLessThan parameter.
	SkipCmpStyle KVResSkipCmpStyle `lang:"skipcmpstyle" yaml:"skipcmpstyle"`
	// contains filtered or unexported fields
}

KVRes is a resource which writes a key/value pair into cluster wide storage. It will ensure that the key is set to the requested value. The one exception is that if you use the SkipLessThan parameter, then it will only replace the stored value with the requested value if it is greater than that stored one. This allows the KV resource to be used in fast acting, finite state machines which have monotonically increasing state values that represent progression. The one exception is that when this resource receives a refresh signal, then it will set the value to be the exact one if they are not identical already.

func (*KVRes) CheckApply

func (obj *KVRes) CheckApply(apply bool) (bool, error)

CheckApply method for Password resource. Does nothing, returns happy!

func (*KVRes) Close

func (obj *KVRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*KVRes) Cmp

func (obj *KVRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*KVRes) Default

func (obj *KVRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*KVRes) Init

func (obj *KVRes) Init(init *engine.Init) error

Init initializes the resource.

func (*KVRes) Interrupt

func (obj *KVRes) Interrupt() error

Interrupt is called to ask the execution of this resource to end early.

func (*KVRes) UIDs

func (obj *KVRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*KVRes) UnmarshalYAML

func (obj *KVRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*KVRes) Validate

func (obj *KVRes) Validate() error

Validate if the params passed in are valid data.

func (*KVRes) Watch

func (obj *KVRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type KVResSkipCmpStyle

type KVResSkipCmpStyle int

KVResSkipCmpStyle represents the different styles of comparison when using SkipLessThan.

const (
	SkipCmpStyleInt KVResSkipCmpStyle = iota
	SkipCmpStyleString
)

These are the different allowed comparison styles. Most folks will want SkipCmpStyleInt.

type KVUID

type KVUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

KVUID is the UID struct for KVRes.

type MountRes

type MountRes struct {
	traits.Base

	// State must be exists ot absent. If absent, remaining fields are ignored.
	State   string            `yaml:"state"`
	Device  string            `yaml:"device"`  // location of the device or image
	Type    string            `yaml:"type"`    // the type of filesystem
	Options map[string]string `yaml:"options"` // mount options
	Freq    int               `yaml:"freq"`    // dump frequency
	PassNo  int               `yaml:"passno"`  // verification order
	// contains filtered or unexported fields
}

MountRes is a systemd mount resource that adds/removes entries from /etc/fstab, and makes sure the defined device is mounted or unmounted accordingly. The mount point is set according to the resource's name.

func (*MountRes) CheckApply

func (obj *MountRes) CheckApply(apply bool) (bool, error)

CheckApply is run to check the state and, if apply is true, to apply the necessary changes to reach the desired state. This is run before Watch and again if Watch finds a change occurring to the state.

func (*MountRes) Close

func (obj *MountRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*MountRes) Cmp

func (obj *MountRes) Cmp(r engine.Res) error

Cmp compares two resources and return if they are equivalent.

func (*MountRes) Default

func (obj *MountRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*MountRes) Init

func (obj *MountRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*MountRes) UIDs

func (obj *MountRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one although some resources can return multiple.

func (*MountRes) UnmarshalYAML

func (obj *MountRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*MountRes) Validate

func (obj *MountRes) Validate() error

Validate if the params passed in are valid data.

func (*MountRes) Watch

func (obj *MountRes) Watch() error

Watch listens for signals from the mount unit associated with the resource. It also watch for changes to /etc/fstab, where mounts are defined.

type MountUID

type MountUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

MountUID is a unique resource identifier.

func (*MountUID) IFF

func (obj *MountUID) IFF(uid engine.ResUID) bool

IFF aka if and only if they are equivalent, return true. If not, false.

type MsgRes

type MsgRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Refreshable

	Body     string            `yaml:"body"`
	Priority string            `yaml:"priority"`
	Fields   map[string]string `yaml:"fields"`
	Journal  bool              `yaml:"journal"` // enable systemd journal output
	Syslog   bool              `yaml:"syslog"`  // enable syslog output
	// contains filtered or unexported fields
}

MsgRes is a resource that writes messages to logs.

func (*MsgRes) CheckApply

func (obj *MsgRes) CheckApply(apply bool) (bool, error)

CheckApply method for Msg resource. Every check leads to an apply, meaning that the message is flushed to the journal.

func (*MsgRes) Close

func (obj *MsgRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*MsgRes) Cmp

func (obj *MsgRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*MsgRes) Compare

func (obj *MsgRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*MsgRes) Default

func (obj *MsgRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*MsgRes) Init

func (obj *MsgRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*MsgRes) UIDs

func (obj *MsgRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*MsgRes) UnmarshalYAML

func (obj *MsgRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*MsgRes) Validate

func (obj *MsgRes) Validate() error

Validate the params that are passed to MsgRes.

func (*MsgRes) Watch

func (obj *MsgRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type MsgUID

type MsgUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

MsgUID is a unique representation for a MsgRes object.

type NetRes

type NetRes struct {
	traits.Base // add the base methods without re-implementation

	State   string   `yaml:"state"`   // up, down, or empty
	Addrs   []string `yaml:"addrs"`   // list of addresses in cidr format
	Gateway string   `yaml:"gateway"` // gateway address
	// contains filtered or unexported fields
}

NetRes is a network interface resource based on netlink. It manages the state of a network link. Configuration is also stored in a networkd configuration file, so the network is available upon reboot.

func (*NetRes) CheckApply

func (obj *NetRes) CheckApply(apply bool) (bool, error)

CheckApply is run to check the state and, if apply is true, to apply the necessary changes to reach the desired state. This is run before Watch and again if Watch finds a change occurring to the state.

func (*NetRes) Close

func (obj *NetRes) Close() error

Close cleans up when we're done.

func (*NetRes) Cmp

func (obj *NetRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*NetRes) Compare

func (obj *NetRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*NetRes) Default

func (obj *NetRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*NetRes) Init

func (obj *NetRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*NetRes) UIDs

func (obj *NetRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one although some resources can return multiple.

func (*NetRes) UnmarshalYAML

func (obj *NetRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*NetRes) Validate

func (obj *NetRes) Validate() error

Validate if the params passed in are valid data.

func (*NetRes) Watch

func (obj *NetRes) Watch() error

Watch listens for events from the specified interface via a netlink socket. TODO: currently gets events from ALL interfaces, would be nice to reject events from other interfaces.

type NetUID

type NetUID struct {
	// NOTE: There is also a name variable in the BaseUID struct, this is
	// information about where this UID came from, and is unrelated to the
	// information about the resource we're matching. That data which is
	// used in the IFF function, is what you see in the struct fields here.
	engine.BaseUID
	// contains filtered or unexported fields
}

NetUID is a unique resource identifier.

func (*NetUID) IFF

func (obj *NetUID) IFF(uid engine.ResUID) bool

IFF aka if and only if they are equivalent, return true. If not, false.

type NetworkDevice

type NetworkDevice struct {
	Name string `lang:"name" yaml:"name"`
	MAC  string `lang:"mac" yaml:"mac"`
}

NetworkDevice represents a network card that is attached to the virt machine.

func (*NetworkDevice) Cmp

func (obj *NetworkDevice) Cmp(dev *NetworkDevice) error

Cmp compares two NetworkDevice's and returns an error if they are not equivalent.

func (*NetworkDevice) GetXML

func (obj *NetworkDevice) GetXML(idx int) string

GetXML returns the XML representation of this device.

type NoopRes

type NoopRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Groupable
	traits.Refreshable

	Comment string `lang:"comment" yaml:"comment"` // extra field for example purposes
	// contains filtered or unexported fields
}

NoopRes is a no-op resource that does nothing.

func (*NoopRes) CheckApply

func (obj *NoopRes) CheckApply(apply bool) (bool, error)

CheckApply method for Noop resource. Does nothing, returns happy!

func (*NoopRes) Close

func (obj *NoopRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*NoopRes) Cmp

func (obj *NoopRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*NoopRes) Default

func (obj *NoopRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*NoopRes) GroupCmp

func (obj *NoopRes) GroupCmp(r engine.GroupableRes) error

GroupCmp returns whether two resources can be grouped together or not.

func (*NoopRes) Init

func (obj *NoopRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*NoopRes) UIDs

func (obj *NoopRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*NoopRes) UnmarshalYAML

func (obj *NoopRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*NoopRes) Validate

func (obj *NoopRes) Validate() error

Validate if the params passed in are valid data.

func (*NoopRes) Watch

func (obj *NoopRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type NoopUID

type NoopUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

NoopUID is the UID struct for NoopRes.

type NspawnRes

type NspawnRes struct {
	traits.Base // add the base methods without re-implementation
	//traits.Groupable // TODO: this would be quite useful for this resource
	traits.Refreshable // needed because we embed a svc res

	State string `yaml:"state"`
	// contains filtered or unexported fields
}

NspawnRes is an nspawn container resource.

func (*NspawnRes) CheckApply

func (obj *NspawnRes) CheckApply(apply bool) (bool, error)

CheckApply is run to check the state and, if apply is true, to apply the necessary changes to reach the desired state. This is run before Watch and again if Watch finds a change occurring to the state.

func (*NspawnRes) Close

func (obj *NspawnRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*NspawnRes) Cmp

func (obj *NspawnRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*NspawnRes) Compare

func (obj *NspawnRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*NspawnRes) Default

func (obj *NspawnRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*NspawnRes) Init

func (obj *NspawnRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*NspawnRes) UIDs

func (obj *NspawnRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one although some resources can return multiple.

func (*NspawnRes) UnmarshalYAML

func (obj *NspawnRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*NspawnRes) Validate

func (obj *NspawnRes) Validate() error

Validate if the params passed in are valid data.

func (*NspawnRes) Watch

func (obj *NspawnRes) Watch() error

Watch for state changes and sends a message to the bus if there is a change.

type NspawnUID

type NspawnUID struct {
	// NOTE: There is also a name variable in the BaseUID struct, this is
	// information about where this UID came from, and is unrelated to the
	// information about the resource we're matching. That data which is
	// used in the IFF function, is what you see in the struct fields here.
	engine.BaseUID
	// contains filtered or unexported fields
}

NspawnUID is a unique resource identifier.

func (*NspawnUID) IFF

func (obj *NspawnUID) IFF(uid engine.ResUID) bool

IFF aka if and only if they are equivalent, return true. If not, false.

type PasswordRes

type PasswordRes struct {
	traits.Base // add the base methods without re-implementation
	// TODO: it could be useful to group our tokens into a single write, and
	// as a result, we save inotify watches too!
	//traits.Groupable // TODO: this is doable, but probably not very useful
	traits.Refreshable
	traits.Sendable

	// FIXME: is uint16 too big?
	Length        uint16 `yaml:"length"` // number of characters to return
	Saved         bool   // this caches the password in the clear locally
	CheckRecovery bool   // recovery from integrity checks by re-generating
	// contains filtered or unexported fields
}

PasswordRes is a no-op resource that returns a random password string.

func (*PasswordRes) CheckApply

func (obj *PasswordRes) CheckApply(apply bool) (bool, error)

CheckApply method for Password resource. Does nothing, returns happy!

func (*PasswordRes) Close

func (obj *PasswordRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*PasswordRes) Cmp

func (obj *PasswordRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*PasswordRes) Compare

func (obj *PasswordRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*PasswordRes) Default

func (obj *PasswordRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*PasswordRes) Init

func (obj *PasswordRes) Init(init *engine.Init) error

Init runs some startup code for this resource. It generates a new password for this resource if one was not provided. It will save this into a local file. It will load it back in from previous runs.

func (*PasswordRes) Sends

func (obj *PasswordRes) Sends() interface{}

Sends represents the default struct of values we can send using Send/Recv.

func (*PasswordRes) UIDs

func (obj *PasswordRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*PasswordRes) UnmarshalYAML

func (obj *PasswordRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*PasswordRes) Validate

func (obj *PasswordRes) Validate() error

Validate if the params passed in are valid data.

func (*PasswordRes) Watch

func (obj *PasswordRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type PasswordSends

type PasswordSends struct {
	// Password is the generated password being sent.
	Password *string `lang:"password"`
	// Hashing is the algorithm used for this password. Empty is plain text.
	Hashing string // TODO: implement me
}

PasswordSends is the struct of data which is sent after a successful Apply.

type PasswordUID

type PasswordUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

PasswordUID is the UID struct for PasswordRes.

type PkgFileUID

type PkgFileUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

PkgFileUID is the UID struct for PkgRes files.

type PkgRes

type PkgRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Edgeable
	traits.Groupable

	State            string `yaml:"state"`            // state: installed, uninstalled, newest, <version>
	AllowUntrusted   bool   `yaml:"allowuntrusted"`   // allow untrusted packages to be installed?
	AllowNonFree     bool   `yaml:"allownonfree"`     // allow nonfree packages to be found?
	AllowUnsupported bool   `yaml:"allowunsupported"` // allow unsupported packages to be found?
	// contains filtered or unexported fields
}

PkgRes is a package resource for packagekit.

func (*PkgRes) Adapts

func (obj *PkgRes) Adapts(r engine.CompatibleRes) error

Adapts compares two resources and returns an error if they are not able to be equivalently output compatible.

func (*PkgRes) AutoEdges

func (obj *PkgRes) AutoEdges() (engine.AutoEdge, error)

AutoEdges produces an object which generates a minimal pkg file optimization sequence of edges.

func (*PkgRes) CheckApply

func (obj *PkgRes) CheckApply(apply bool) (bool, error)

CheckApply checks the resource state and applies the resource if the bool input is true. It returns error info and if the state check passed or not.

func (*PkgRes) Close

func (obj *PkgRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*PkgRes) Cmp

func (obj *PkgRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*PkgRes) Copy

func (obj *PkgRes) Copy() engine.CopyableRes

Copy copies the resource. Don't call it directly, use engine.ResCopy instead. TODO: should this copy internal state?

func (*PkgRes) Default

func (obj *PkgRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*PkgRes) GroupCmp

func (obj *PkgRes) GroupCmp(r engine.GroupableRes) error

GroupCmp returns whether two resources can be grouped together or not. Can these two resources be merged, aka, does this resource support doing so? Will resource allow itself to be grouped _into_ this obj?

func (*PkgRes) Init

func (obj *PkgRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*PkgRes) Merge

Merge returns the best equivalent of the two resources. They must satisfy the Adapts test for this to work.

func (*PkgRes) UIDs

func (obj *PkgRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*PkgRes) UnmarshalYAML

func (obj *PkgRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*PkgRes) Validate

func (obj *PkgRes) Validate() error

Validate checks if the resource data structure was populated correctly.

func (*PkgRes) Watch

func (obj *PkgRes) Watch() error

Watch is the primary listener for this resource and it outputs events. It uses the PackageKit UpdatesChanged signal to watch for changes. TODO: https://github.com/hughsie/PackageKit/issues/109 TODO: https://github.com/hughsie/PackageKit/issues/110

type PkgResAutoEdges

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

PkgResAutoEdges holds the state of the auto edge generator.

func (*PkgResAutoEdges) Next

func (obj *PkgResAutoEdges) Next() []engine.ResUID

Next returns the next automatic edge.

func (*PkgResAutoEdges) Test

func (obj *PkgResAutoEdges) Test(input []bool) bool

Test gets results of the earlier Next() call, & returns if we should continue!

type PkgUID

type PkgUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

PkgUID is the main UID struct for PkgRes.

func (*PkgUID) IFF

func (obj *PkgUID) IFF(uid engine.ResUID) bool

IFF aka if and only if they are equivalent, return true. If not, false.

type PrintRes

type PrintRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Groupable
	traits.Recvable
	traits.Refreshable

	Msg string `lang:"msg" yaml:"msg"` // the message to display
	// RefreshOnly is an option that causes the message to be printed only
	// when notified by another resource. When set to true, this resource
	// cannot be autogrouped.
	RefreshOnly bool `lang:"refresh_only" yaml:"refresh_only"`
	// contains filtered or unexported fields
}

PrintRes is a resource that is useful for printing a message to the screen. It will also display a message when it receives a notification. It supports automatic grouping.

func (*PrintRes) CheckApply

func (obj *PrintRes) CheckApply(apply bool) (bool, error)

CheckApply method for Print resource. Does nothing, returns happy!

func (*PrintRes) Close

func (obj *PrintRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*PrintRes) Cmp

func (obj *PrintRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*PrintRes) Compare

func (obj *PrintRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*PrintRes) Default

func (obj *PrintRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*PrintRes) GroupCmp

func (obj *PrintRes) GroupCmp(r engine.GroupableRes) error

GroupCmp returns whether two resources can be grouped together or not.

func (*PrintRes) Init

func (obj *PrintRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*PrintRes) UIDs

func (obj *PrintRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*PrintRes) UnmarshalYAML

func (obj *PrintRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*PrintRes) Validate

func (obj *PrintRes) Validate() error

Validate if the params passed in are valid data.

func (*PrintRes) Watch

func (obj *PrintRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type PrintUID

type PrintUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

PrintUID is the UID struct for PrintRes.

type SvcRes

type SvcRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Edgeable
	traits.Groupable
	traits.Refreshable

	State   string `yaml:"state"`   // state: running, stopped, undefined
	Startup string `yaml:"startup"` // enabled, disabled, undefined
	Session bool   `yaml:"session"` // user session (true) or system?
	// contains filtered or unexported fields
}

SvcRes is a service resource for systemd units.

func (*SvcRes) AutoEdges

func (obj *SvcRes) AutoEdges() (engine.AutoEdge, error)

AutoEdges returns the AutoEdge interface. In this case, systemd unit file resources and cron (systemd-timer) resources.

func (*SvcRes) CheckApply

func (obj *SvcRes) CheckApply(apply bool) (bool, error)

CheckApply checks the resource state and applies the resource if the bool input is true. It returns error info and if the state check passed or not.

func (*SvcRes) Close

func (obj *SvcRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*SvcRes) Cmp

func (obj *SvcRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*SvcRes) Compare

func (obj *SvcRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*SvcRes) Default

func (obj *SvcRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*SvcRes) Init

func (obj *SvcRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*SvcRes) UIDs

func (obj *SvcRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*SvcRes) UnmarshalYAML

func (obj *SvcRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*SvcRes) Validate

func (obj *SvcRes) Validate() error

Validate checks if the resource data structure was populated correctly.

func (*SvcRes) Watch

func (obj *SvcRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type SvcResAutoEdges

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

SvcResAutoEdges holds the state of the auto edge generator.

func (*SvcResAutoEdges) Next

func (obj *SvcResAutoEdges) Next() []engine.ResUID

Next returns the next automatic edge.

func (*SvcResAutoEdges) Test

func (obj *SvcResAutoEdges) Test(input []bool) bool

Test gets results of the earlier Next() call, & returns if we should continue!

type SvcResAutoEdgesCron

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

SvcResAutoEdgesCron holds the state of the svc -> cron auto edge generator.

func (*SvcResAutoEdgesCron) Next

func (obj *SvcResAutoEdgesCron) Next() []engine.ResUID

Next returns the next automatic edge.

func (*SvcResAutoEdgesCron) Test

func (obj *SvcResAutoEdgesCron) Test([]bool) bool

Test takes the output of the last call to Next() and outputs true if we should continue.

type SvcUID

type SvcUID struct {
	// NOTE: there is also a name variable in the BaseUID struct, this is
	// information about where this UID came from, and is unrelated to the
	// information about the resource we're matching. That data which is
	// used in the IFF function, is what you see in the struct fields here.
	engine.BaseUID
	// contains filtered or unexported fields
}

SvcUID is the UID struct for SvcRes.

func (*SvcUID) IFF

func (obj *SvcUID) IFF(uid engine.ResUID) bool

IFF aka if and only if they are equivalent, return true. If not, false.

type TestRes

type TestRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Groupable
	traits.Refreshable
	traits.Sendable
	traits.Recvable

	Bool bool   `lang:"bool" yaml:"bool"`
	Str  string `lang:"str" yaml:"str"` // can't name it String because of String()

	Int   int   `lang:"int" yaml:"int"`
	Int8  int8  `lang:"int8" yaml:"int8"`
	Int16 int16 `lang:"int16" yaml:"int16"`
	Int32 int32 `lang:"int32" yaml:"int32"`
	Int64 int64 `lang:"int64" yaml:"int64"`

	Uint   uint   `lang:"uint" yaml:"uint"`
	Uint8  uint8  `lang:"uint8" yaml:"uint8"`
	Uint16 uint16 `lang:"uint16" yaml:"uint16"`
	Uint32 uint32 `lang:"uint32" yaml:"uint32"`
	Uint64 uint64 `lang:"uint64" yaml:"uint64"`

	//Uintptr uintptr `yaml:"uintptr"`
	Byte byte `lang:"byte" yaml:"byte"` // alias for uint8
	Rune rune `lang:"rune" yaml:"rune"` // alias for int32, represents a Unicode code point

	Float32    float32    `lang:"float32" yaml:"float32"`
	Float64    float64    `lang:"float64" yaml:"float64"`
	Complex64  complex64  `lang:"complex64" yaml:"complex64"`
	Complex128 complex128 `lang:"complex128" yaml:"complex128"`

	BoolPtr   *bool   `lang:"boolptr" yaml:"bool_ptr"`
	StringPtr *string `lang:"stringptr" yaml:"string_ptr"` // TODO: tag name?
	Int64Ptr  *int64  `lang:"int64ptr" yaml:"int64ptr"`
	Int8Ptr   *int8   `lang:"int8ptr" yaml:"int8ptr"`
	Uint8Ptr  *uint8  `lang:"uint8ptr" yaml:"uint8ptr"`

	// probably makes no sense, but is legal
	Int8PtrPtrPtr ***int8 `lang:"int8ptrptrptr" yaml:"int8ptrptrptr"`

	SliceString []string          `lang:"slicestring" yaml:"slicestring"`
	MapIntFloat map[int64]float64 `lang:"mapintfloat" yaml:"mapintfloat"`
	MixedStruct struct {
		// contains filtered or unexported fields
	} `lang:"mixedstruct" yaml:"mixedstruct"`
	Interface interface{} `lang:"interface" yaml:"interface"`

	AnotherStr string `lang:"anotherstr" yaml:"anotherstr"`

	ValidateBool  bool   `lang:"validatebool" yaml:"validate_bool"`   // set to true to cause a validate error
	ValidateError string `lang:"validateerror" yaml:"validate_error"` // set to cause a validate error
	AlwaysGroup   bool   `lang:"alwaysgroup" yaml:"always_group"`     // set to true to cause auto grouping
	CompareFail   bool   `lang:"comparefail" yaml:"compare_fail"`     // will compare fail?
	SendValue     string `lang:"sendvalue" yaml:"send_value"`         // what value should we send?

	Comment string `lang:"comment" yaml:"comment"`
	// contains filtered or unexported fields
}

TestRes is a resource that is mostly harmless and is used for internal tests.

func (*TestRes) CheckApply

func (obj *TestRes) CheckApply(apply bool) (bool, error)

CheckApply method for Test resource. Does nothing, returns happy!

func (*TestRes) Close

func (obj *TestRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*TestRes) Cmp

func (obj *TestRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*TestRes) Compare

func (obj *TestRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*TestRes) Default

func (obj *TestRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*TestRes) GroupCmp

func (obj *TestRes) GroupCmp(r engine.GroupableRes) error

GroupCmp returns whether two resources can be grouped together or not.

func (*TestRes) Init

func (obj *TestRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*TestRes) Sends

func (obj *TestRes) Sends() interface{}

Sends represents the default struct of values we can send using Send/Recv.

func (*TestRes) UIDs

func (obj *TestRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*TestRes) UnmarshalYAML

func (obj *TestRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*TestRes) Validate

func (obj *TestRes) Validate() error

Validate if the params passed in are valid data.

func (*TestRes) Watch

func (obj *TestRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type TestSends

type TestSends struct {
	// Hello is some value being sent.
	Hello  *string `lang:"hello"`
	Answer int     `lang:"answer"` // some other value being sent
}

TestSends is the struct of data which is sent after a successful Apply.

type TestUID

type TestUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

TestUID is the UID struct for TestRes.

type TimerRes

type TimerRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Refreshable

	Interval uint32 `yaml:"interval"` // interval between runs in seconds
	// contains filtered or unexported fields
}

TimerRes is a timer resource for time based events. It outputs an event every interval seconds.

func (*TimerRes) CheckApply

func (obj *TimerRes) CheckApply(apply bool) (bool, error)

CheckApply method for Timer resource. Triggers a timer reset on notify.

func (*TimerRes) Close

func (obj *TimerRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*TimerRes) Cmp

func (obj *TimerRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*TimerRes) Compare

func (obj *TimerRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*TimerRes) Default

func (obj *TimerRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*TimerRes) Init

func (obj *TimerRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*TimerRes) UIDs

func (obj *TimerRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*TimerRes) UnmarshalYAML

func (obj *TimerRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*TimerRes) Validate

func (obj *TimerRes) Validate() error

Validate the params that are passed to TimerRes.

func (*TimerRes) Watch

func (obj *TimerRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type TimerUID

type TimerUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

TimerUID is the UID struct for TimerRes.

type UserRes

type UserRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Edgeable

	State             string   `yaml:"state"`             // state: exists, absent
	UID               *uint32  `yaml:"uid"`               // uid must be unique unless AllowDuplicateUID is true
	GID               *uint32  `yaml:"gid"`               // gid of the user's primary group
	Group             *string  `yaml:"group"`             // name of the user's primary group
	Groups            []string `yaml:"groups"`            // list of supplemental groups
	HomeDir           *string  `yaml:"homedir"`           // path to the user's home directory
	AllowDuplicateUID bool     `yaml:"allowduplicateuid"` // allow duplicate uid
	// contains filtered or unexported fields
}

UserRes is a user account resource.

func (*UserRes) AutoEdges

func (obj *UserRes) AutoEdges() (engine.AutoEdge, error)

AutoEdges returns edges from the user resource to each group found in its definition. The groups can be in any of the three applicable fields (GID, Group and Groups.) If the user exists, reversed ensures the edge goes from group to user, and if the user is absent the edge goes from user to group. This ensures that we don't add users to groups that don't exist or delete groups before we delete their members.

func (*UserRes) CheckApply

func (obj *UserRes) CheckApply(apply bool) (bool, error)

CheckApply method for User resource.

func (*UserRes) Close

func (obj *UserRes) Close() error

Close is run by the engine to clean up after the resource is done.

func (*UserRes) Cmp

func (obj *UserRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*UserRes) Compare

func (obj *UserRes) Compare(r engine.Res) bool

Compare two resources and return if they are equivalent.

func (*UserRes) Default

func (obj *UserRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*UserRes) Init

func (obj *UserRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*UserRes) UIDs

func (obj *UserRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*UserRes) UnmarshalYAML

func (obj *UserRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*UserRes) Validate

func (obj *UserRes) Validate() error

Validate if the params passed in are valid data.

func (*UserRes) Watch

func (obj *UserRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type UserResAutoEdges

type UserResAutoEdges struct {
	UIDs []engine.ResUID
	// contains filtered or unexported fields
}

UserResAutoEdges holds the state of the auto edge generator.

func (*UserResAutoEdges) Next

func (obj *UserResAutoEdges) Next() []engine.ResUID

Next returns the next automatic edge.

func (*UserResAutoEdges) Test

func (obj *UserResAutoEdges) Test(input []bool) bool

Test gets results of the earlier Next() call, & returns if we should continue.

type UserUID

type UserUID struct {
	engine.BaseUID
	// contains filtered or unexported fields
}

UserUID is the UID struct for UserRes.

type VirtAuth

type VirtAuth struct {
	Username string `lang:"username" yaml:"username"`
	Password string `lang:"password" yaml:"password"`
}

VirtAuth is used to pass credentials to libvirt.

func (*VirtAuth) Cmp

func (obj *VirtAuth) Cmp(auth *VirtAuth) error

Cmp compares two VirtAuth structs. It errors if they are not identical.

type VirtRes

type VirtRes struct {
	traits.Base // add the base methods without re-implementation
	traits.Refreshable

	// URI is the libvirt connection URI, eg: `qemu:///session`.
	URI string `lang:"uri" yaml:"uri"`
	// State is the desired vm state. Possible values include: `running`,
	// `paused` and `shutoff`.
	State string `lang:"state" yaml:"state"`
	// Transient is whether the vm is defined (false) or undefined (true).
	Transient bool `lang:"transient" yaml:"transient"`

	// CPUs is the desired cpu count of the machine.
	CPUs uint `lang:"cpus" yaml:"cpus"`
	// MaxCPUs is the maximum number of cpus allowed in the machine. You
	// need to set this so that on boot the `hardware` knows how many cpu
	// `slots` it might need to make room for.
	MaxCPUs uint `lang:"maxcpus" yaml:"maxcpus"`
	// HotCPUs specifies whether we can hot plug and unplug cpus.
	HotCPUs bool `lang:"hotcpus" yaml:"hotcpus"`
	// Memory is the size in KBytes of memory to include in the machine.
	Memory uint64 `lang:"memory" yaml:"memory"`

	// OSInit is the init used by lxc.
	OSInit string `lang:"osinit" yaml:"osinit"`
	// Boot is the boot order. Values are `fd`, `hd`, `cdrom` and `network`.
	Boot []string `lang:"boot" yaml:"boot"`
	// Disk is the list of disk devices to include.
	Disk []*DiskDevice `lang:"disk" yaml:"disk"`
	// CdRom is the list of cdrom devices to include.
	CDRom []*CDRomDevice `lang:"cdrom" yaml:"cdrom"`
	// Network is the list of network devices to include.
	Network []*NetworkDevice `lang:"network" yaml:"network"`
	// Filesystem is the list of file system devices to include.
	Filesystem []*FilesystemDevice `lang:"filesystem" yaml:"filesystem"`

	// Auth points to the libvirt credentials to use if any are necessary.
	Auth *VirtAuth `lang:"auth" yaml:"auth"`

	// RestartOnDiverge is the restart policy, and can be: `ignore`,
	// `ifneeded` or `error`.
	RestartOnDiverge string `lang:"restartondiverge" yaml:"restartondiverge"`
	// RestartOnRefresh specifies if we restart on refresh signal.
	RestartOnRefresh bool `lang:"restartonrefresh" yaml:"restartonrefresh"`
	// contains filtered or unexported fields
}

VirtRes is a libvirt resource. A transient virt resource, which has its state set to `shutoff` is one which does not exist. The parallel equivalent is a file resource which removes a particular path. TODO: some values inside here should be enum's!

func (*VirtRes) CheckApply

func (obj *VirtRes) CheckApply(apply bool) (bool, error)

CheckApply checks the resource state and applies the resource if the bool input is true. It returns error info and if the state check passed or not.

func (*VirtRes) Close

func (obj *VirtRes) Close() error

Close runs some cleanup code for this resource.

func (*VirtRes) Cmp

func (obj *VirtRes) Cmp(r engine.Res) error

Cmp compares two resources and returns an error if they are not equivalent.

func (*VirtRes) Default

func (obj *VirtRes) Default() engine.Res

Default returns some sensible defaults for this resource.

func (*VirtRes) Init

func (obj *VirtRes) Init(init *engine.Init) error

Init runs some startup code for this resource.

func (*VirtRes) UIDs

func (obj *VirtRes) UIDs() []engine.ResUID

UIDs includes all params to make a unique identification of this object. Most resources only return one, although some resources can return multiple.

func (*VirtRes) UnmarshalYAML

func (obj *VirtRes) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is the custom unmarshal handler for this struct. It is primarily useful for setting the defaults.

func (*VirtRes) Validate

func (obj *VirtRes) Validate() error

Validate if the params passed in are valid data.

func (*VirtRes) Watch

func (obj *VirtRes) Watch() error

Watch is the primary listener for this resource and it outputs events.

type VirtUID

type VirtUID struct {
	engine.BaseUID
}

VirtUID is the UID struct for FileRes.

Directories

Path Synopsis
Package packagekit provides an interface to interact with packagekit.
Package packagekit provides an interface to interact with packagekit.

Jump to

Keyboard shortcuts

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