distro

package
v0.0.0-...-a204096 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserDataFormatFormURLEncoded = "x-www-form-urlencoded"
	UserDataFormatJSON           = "json"
	UserDataFormatYAML           = "yaml"
)

UserData validation formats

View Source
const Collection = "distro"

Variables

View Source
var (
	// bson fields for the Distro struct
	IdKey               = bsonutil.MustHaveTag(Distro{}, "Id")
	ArchKey             = bsonutil.MustHaveTag(Distro{}, "Arch")
	PoolSizeKey         = bsonutil.MustHaveTag(Distro{}, "PoolSize")
	ProviderKey         = bsonutil.MustHaveTag(Distro{}, "Provider")
	ProviderSettingsKey = bsonutil.MustHaveTag(Distro{}, "ProviderSettings")
	SetupAsSudoKey      = bsonutil.MustHaveTag(Distro{}, "SetupAsSudo")
	SetupKey            = bsonutil.MustHaveTag(Distro{}, "Setup")
	UserKey             = bsonutil.MustHaveTag(Distro{}, "User")
	SSHKeyKey           = bsonutil.MustHaveTag(Distro{}, "SSHKey")
	SSHOptionsKey       = bsonutil.MustHaveTag(Distro{}, "SSHOptions")
	WorkDirKey          = bsonutil.MustHaveTag(Distro{}, "WorkDir")

	UserDataKey = bsonutil.MustHaveTag(Distro{}, "UserData")

	SpawnAllowedKey = bsonutil.MustHaveTag(Distro{}, "SpawnAllowed")
	ExpansionsKey   = bsonutil.MustHaveTag(Distro{}, "Expansions")

	// bson fields for the UserData struct
	UserDataFileKey     = bsonutil.MustHaveTag(UserData{}, "File")
	UserDataValidateKey = bsonutil.MustHaveTag(UserData{}, "Validate")
)
View Source
var All = db.Query(nil)

All is a query that returns all distros.

Functions

func ById

func ById(id string) db.Q

ById returns a query that contains an Id selector on the string, id.

func ByProvider

func ByProvider(p string) db.Q

ByProvider returns a query that contains a Provider selector on the string, p.

func BySpawnAllowed

func BySpawnAllowed() db.Q

BySpawnAllowed returns a query that contains the SpawnAllowed selector.

func Remove

func Remove(id string) error

Remove removes one distro.

Types

type Distro

type Distro struct {
	Id               string                  `bson:"_id" json:"_id,omitempty" mapstructure:"_id,omitempty"`
	Arch             string                  `bson:"arch" json:"arch,omitempty" mapstructure:"arch,omitempty"`
	WorkDir          string                  `bson:"work_dir" json:"work_dir,omitempty" mapstructure:"work_dir,omitempty"`
	PoolSize         int                     `bson:"pool_size,omitempty" json:"pool_size,omitempty" mapstructure:"pool_size,omitempty" yaml:poolsize`
	Provider         string                  `bson:"provider" json:"provider,omitempty" mapstructure:"provider,omitempty"`
	ProviderSettings *map[string]interface{} `bson:"settings" json:"settings,omitempty" mapstructure:"settings,omitempty"`

	SetupAsSudo bool     `bson:"setup_as_sudo,omitempty" json:"setup_as_sudo,omitempty" mapstructure:"setup_as_sudo,omitempty"`
	Setup       string   `bson:"setup,omitempty" json:"setup,omitempty" mapstructure:"setup,omitempty"`
	Teardown    string   `bson:"teardown,omitempty" json:"teardown,omitempty" mapstructure:"teardown,omitempty"`
	User        string   `bson:"user,omitempty" json:"user,omitempty" mapstructure:"user,omitempty"`
	SSHKey      string   `bson:"ssh_key,omitempty" json:"ssh_key,omitempty" mapstructure:"ssh_key,omitempty"`
	SSHOptions  []string `bson:"ssh_options,omitempty" json:"ssh_options,omitempty" mapstructure:"ssh_options,omitempty"`
	UserData    UserData `bson:"user_data,omitempty" json:"user_data,omitempty" mapstructure:"user_data,omitempty"`

	SpawnAllowed bool        `bson:"spawn_allowed" json:"spawn_allowed,omitempty" mapstructure:"spawn_allowed,omitempty"`
	Expansions   []Expansion `bson:"expansions,omitempty" json:"expansions,omitempty" mapstructure:"expansions,omitempty"`
}

func Find

func Find(query db.Q) ([]Distro, error)

Find gets every Distro matching the given query.

func FindOne

func FindOne(query db.Q) (*Distro, error)

FindOne gets one Distro for the given query.

func (*Distro) Insert

func (d *Distro) Insert() error

Insert writes the distro to the database.

func (*Distro) Update

func (d *Distro) Update() error

Update updates one distro.

type Expansion

type Expansion struct {
	Key   string `bson:"key,omitempty" json:"key,omitempty"`
	Value string `bson:"value,omitempty" json:"value,omitempty"`
}

type UserData

type UserData struct {
	File     string         `bson:"file,omitempty" json:"file,omitempty"`
	Validate ValidateFormat `bson:"validate,omitempty" json:"validate,omitempty"`
}

type ValidateFormat

type ValidateFormat string

Jump to

Keyboard shortcuts

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