provision: github.com/digitalrebar/provision/models Index | Files

package models

import "github.com/digitalrebar/provision/models"

Index

Package Files

access.go bootenv.go content.go dhcpOption.go errors.go event.go index.go info.go interface.go job.go lease.go machine.go meta.go param.go plugin.go plugin_provider.go preference.go profile.go reservation.go stage.go subnet.go task.go template.go templateInfo.go token.go user.go utils.go validate.go

func All Uses

func All() []Model

func Hexaddr Uses

func Hexaddr(addr net.IP) string

func MergeTemplates Uses

func MergeTemplates(root *template.Template, tmpls []TemplateInfo, e ErrorAdder) *template.Template

func ValidName Uses

func ValidName(msg, s string) error

func ValidParamName Uses

func ValidParamName(msg, s string) error

type Access Uses

type Access struct {
    // ReadOnly tracks if the store for this object is read-only
    // read only: true
    ReadOnly bool
}

Access holds if the object is read-only or not

swagger: model

func (*Access) IsReadOnly Uses

func (a *Access) IsReadOnly() bool

type Accessor Uses

type Accessor interface {
    IsReadOnly() bool
}

model object may define a Validate method that can be used to return errors about if the model is valid in the current datatracker.

type AvailableAction Uses

type AvailableAction struct {
    Provider       string
    Command        string
    RequiredParams []string
    OptionalParams []string
}

Plugins can provide actions for machines Assumes that there are parameters on the call in addition to the machine.

swagger:model

func (*AvailableAction) Fill Uses

func (a *AvailableAction) Fill()

type BlobInfo Uses

type BlobInfo struct {
    Path string
    Size int64
}

swagger:model

type BootEnv Uses

type BootEnv struct {
    Validation
    Access
    Meta
    // The name of the boot environment.  Boot environments that install
    // an operating system must end in '-install'.
    //
    // required: true
    Name string
    // A description of this boot environment.  This should tell what
    // the boot environment is for, any special considerations that
    // shoudl be taken into account when using it, etc.
    Description string
    // The OS specific information for the boot environment.
    OS  OsInfo
    // The templates that should be expanded into files for the
    // boot environment.
    //
    // required: true
    Templates []TemplateInfo
    // The partial path to the kernel for the boot environment.  This
    // should be path that the kernel is located at in the OS ISO or
    // install archive.
    //
    // required: true
    Kernel string
    // Partial paths to the initrds that should be loaded for the boot
    // environment. These should be paths that the initrds are located
    // at in the OS ISO or install archive.
    //
    // required: true
    Initrds []string
    // A template that will be expanded to create the full list of
    // boot parameters for the environment.
    //
    // required: true
    BootParams string
    // The list of extra required parameters for this
    // bootstate. They should be present as Machine.Params when
    // the bootenv is applied to the machine.
    //
    // required: true
    RequiredParams []string
    // The list of extra optional parameters for this
    // bootstate. They can be present as Machine.Params when
    // the bootenv is applied to the machine.  These are more
    // other consumers of the bootenv to know what parameters
    // could additionally be applied to the bootenv by the
    // renderer based upon the Machine.Params
    //
    OptionalParams []string
    // OnlyUnknown indicates whether this bootenv can be used without a
    // machine.  Only bootenvs with this flag set to `true` be used for
    // the unknownBootEnv preference.
    //
    // required: true
    OnlyUnknown bool
}

BootEnv encapsulates the machine-agnostic information needed by the provisioner to set up a boot environment.

swagger:model

func (*BootEnv) AuthKey Uses

func (b *BootEnv) AuthKey() string

func (*BootEnv) Fill Uses

func (b *BootEnv) Fill()

func (*BootEnv) Key Uses

func (b *BootEnv) Key() string

func (*BootEnv) Prefix Uses

func (b *BootEnv) Prefix() string

func (*BootEnv) SetName Uses

func (b *BootEnv) SetName(n string)

func (*BootEnv) SliceOf Uses

func (b *BootEnv) SliceOf() interface{}

func (*BootEnv) ToModels Uses

func (b *BootEnv) ToModels(obj interface{}) []Model

func (*BootEnv) Validate Uses

func (b *BootEnv) Validate()

type BootEnver Uses

type BootEnver interface {
    Model
    GetBootEnv() string
    SetBootEnv(string)
}

type Content Uses

type Content struct {
    // required: true
    Meta ContentMetaData `json:"meta"`

    /*
    	These are the sections:
    	tasks        map[string]*models.Task
    	bootenvs     map[string]*models.BootEnv
    	stages       map[string]*models.Stage
    	templates    map[string]*models.Template
    	profiles     map[string]*models.Profile
    	params       map[string]*models.Param
    	reservations map[string]*models.Reservation
    	subnets      map[string]*models.Subnet
    	users        map[string]*models.User
    	preferences  map[string]*models.Pref
    	plugins      map[string]*models.Plugin
    	machines     map[string]*models.Machine
    	leases       map[string]*models.Lease
    */
    Sections Sections `json:"sections"`
}

Isos??? Files??

swagger:model

func (*Content) AuthKey Uses

func (c *Content) AuthKey() string

func (*Content) Fill Uses

func (c *Content) Fill()

func (*Content) FromStore Uses

func (c *Content) FromStore(src store.Store) error

func (*Content) Key Uses

func (c *Content) Key() string

func (*Content) Prefix Uses

func (c *Content) Prefix() string

func (*Content) ToStore Uses

func (c *Content) ToStore(dest store.Store) error

type ContentMetaData Uses

type ContentMetaData struct {
    Meta

    // required: true
    Name        string
    Source      string
    Description string
    Version     string

    // Informational Fields
    Writable     bool
    Type         string
    Overwritable bool
}

type ContentSummary Uses

type ContentSummary struct {
    Meta     ContentMetaData `json:"meta"`
    Counts   map[string]int
    Warnings []string
}

swagger:model

func (*ContentSummary) Fill Uses

func (c *ContentSummary) Fill()

type DhcpOption Uses

type DhcpOption struct {
    // Code is a DHCP Option Code.
    //
    // required: true
    Code byte
    // Value is a text/template that will be expanded
    // and then converted into the proper format
    // for the option code
    //
    // required: true
    Value string
}

DhcpOption is a representation of a specific DHCP option. swagger:model

func (*DhcpOption) ConvertOptionValueToByte Uses

func (o *DhcpOption) ConvertOptionValueToByte(value string) ([]byte, error)

func (*DhcpOption) RenderToDHCP Uses

func (o *DhcpOption) RenderToDHCP(srcOpts map[int]string) (code byte, val []byte, err error)

type Error Uses

type Error struct {
    Object Model `json:"-"`
    Model  string
    Key    string
    Type   string
    // Messages are any additional messages related to this Error
    Messages []string
    // code is the HTTP status code that should be used for this Error
    Code int
}

Error is the common Error type we should return for any errors. swagger:model

func NewError Uses

func NewError(t string, code int, m string) *Error

func (*Error) AddError Uses

func (e *Error) AddError(src error)

func (*Error) ContainsError Uses

func (e *Error) ContainsError() bool

func (*Error) Error Uses

func (e *Error) Error() string

func (*Error) Errorf Uses

func (e *Error) Errorf(s string, args ...interface{})

func (*Error) HasError Uses

func (e *Error) HasError() error

type ErrorAdder Uses

type ErrorAdder interface {
    Errorf(string, ...interface{})
    AddError(error)
    HasError() error
}

type Event Uses

type Event struct {
    // Time of the event.
    // swagger:strfmt date-time
    Time time.Time

    // Type - object type
    Type string

    // Action - what happened
    Action string

    // Key - the id of the object
    Key string

    // Object - the data of the object.
    Object interface{}
}

Event represents an action in the system. In general, the event generates for a subject of the form: type.action.key

swagger:model

func EventFor Uses

func EventFor(obj Model, action string) *Event

func (*Event) Message Uses

func (e *Event) Message() string

func (*Event) Model Uses

func (e *Event) Model() (Model, error)

func (*Event) Text Uses

func (e *Event) Text() string

type Filler Uses

type Filler interface {
    Model
    Fill()
}

type Index Uses

type Index struct {
    // Type gives you a rough idea of how the string used to query
    // this index should be formatted.
    Type string
    // Unique tells you whether there can be mutiple entries in the
    // index for the same key that refer to different items.
    Unique bool
}

Index holds details on the index swagger:model

type Info Uses

type Info struct {
    // required: true
    Arch string `json:"arch"`
    // required: true
    Os  string `json:"os"`
    // required: true
    Version string `json:"version"`
    // required: true
    Id  string `json:"id"`
    // required: true
    ApiPort int `json:"api_port"`
    // required: true
    FilePort int `json:"file_port"`
    // required: true
    TftpEnabled bool `json:"tftp_enabled"`
    // required: true
    DhcpEnabled bool `json:"dhcp_enabled"`
    // required: true
    ProvisionerEnabled bool `json:"prov_enabled"`
    // required: true
    Stats    []*Stat  `json:"stats"`
    Features []string `json:"features"`
}

swagger:model

type Interface Uses

type Interface struct {
    Access
    Meta
    // Name of the interface
    //
    // required: true
    Name string
    // Index of the interface
    //
    Index int
    // A List of Addresses on the interface (CIDR)
    //
    // required: true
    Addresses []string
    // The interface to use for this interface when
    // advertising or claiming access (CIDR)
    //
    ActiveAddress string
}

swagger:model

func (*Interface) Fill Uses

func (i *Interface) Fill()

func (*Interface) Key Uses

func (i *Interface) Key() string

func (*Interface) Prefix Uses

func (i *Interface) Prefix() string

func (*Interface) SliceOf Uses

func (b *Interface) SliceOf() interface{}

func (*Interface) ToModels Uses

func (b *Interface) ToModels(obj interface{}) []Model

type Job Uses

type Job struct {
    Validation
    Access
    Meta
    // The UUID of the job.  The primary key.
    // required: true
    // swagger:strfmt uuid
    Uuid uuid.UUID
    // The UUID of the previous job to run on this machine.
    // swagger:strfmt uuid
    Previous uuid.UUID
    // The machine the job was created for.  This field must be the UUID of the machine.
    // required: true
    // swagger:strfmt uuid
    Machine uuid.UUID
    // The task the job was created for.  This will be the name of the task.
    // read only: true
    Task string
    // The stage that the task was created in.
    // read only: true
    Stage string
    // The state the job is in.  Must be one of "created", "running", "failed", "finished", "incomplete"
    // required: true
    State string
    // The final disposition of the job.
    // Can be one of "reboot","poweroff","stop", or "complete"
    // Other substates may be added as time goes on
    ExitState string
    // The time the job entered running.
    StartTime time.Time
    // The time the job entered failed or finished.
    EndTime time.Time
    // required: true
    Archived bool
    // Whether the job is the "current one" for the machine or if it has been superceded.
    //
    // required: true
    Current bool
}

swagger:model

func (*Job) AuthKey Uses

func (j *Job) AuthKey() string

func (*Job) Fill Uses

func (j *Job) Fill()

func (*Job) Key Uses

func (j *Job) Key() string

func (*Job) Prefix Uses

func (j *Job) Prefix() string

func (*Job) SliceOf Uses

func (b *Job) SliceOf() interface{}

func (*Job) ToModels Uses

func (b *Job) ToModels(obj interface{}) []Model

func (*Job) Validate Uses

func (j *Job) Validate()

type JobAction Uses

type JobAction struct {
    // required: true
    Name string
    // required: true
    Path string
    // required: true
    Content string
}

Job Action is something that job runner will need to do. If path is specified, then the runner will place the contents into that location. If path is not specified, then the runner will attempt to bash exec the contents. swagger:model

type Lease Uses

type Lease struct {
    Validation
    Access
    Meta
    // Addr is the IP address that the lease handed out.
    //
    // required: true
    // swagger:strfmt ipv4
    Addr net.IP
    // Token is the unique token for this lease based on the
    // Strategy this lease used.
    //
    // required: true
    Token string
    // ExpireTime is the time at which the lease expires and is no
    // longer valid The DHCP renewal time will be half this, and the
    // DHCP rebind time will be three quarters of this.
    //
    // required: true
    // swagger:strfmt date-time
    ExpireTime time.Time
    // Strategy is the leasing strategy that will be used determine what to use from
    // the DHCP packet to handle lease management.
    //
    // required: true
    Strategy string
    // State is the current state of the lease.  This field is for informational
    // purposes only.
    //
    // read only: true
    // required: true
    State string
}

swagger:model

func (*Lease) AuthKey Uses

func (l *Lease) AuthKey() string

func (*Lease) Fill Uses

func (l *Lease) Fill()

func (*Lease) Key Uses

func (l *Lease) Key() string

func (*Lease) Prefix Uses

func (l *Lease) Prefix() string

func (*Lease) SliceOf Uses

func (b *Lease) SliceOf() interface{}

func (*Lease) ToModels Uses

func (b *Lease) ToModels(obj interface{}) []Model

type Machine Uses

type Machine struct {
    Validation
    Access
    Meta
    // The name of the machine.  THis must be unique across all
    // machines, and by convention it is the FQDN of the machine,
    // although nothing enforces that.
    //
    // required: true
    // swagger:strfmt hostname
    Name string
    // A description of this machine.  This can contain any reference
    // information for humans you want associated with the machine.
    Description string
    // The UUID of the machine.
    // This is auto-created at Create time, and cannot change afterwards.
    //
    // required: true
    // swagger:strfmt uuid
    Uuid uuid.UUID
    // The UUID of the job that is currently running on the machine.
    //
    // swagger:strfmt uuid
    CurrentJob uuid.UUID
    // The IPv4 address of the machine that should be used for PXE
    // purposes.  Note that this field does not directly tie into DHCP
    // leases or reservations -- the provisioner relies solely on this
    // address when determining what to render for a specific machine.
    //
    // swagger:strfmt ipv4
    Address net.IP
    // An optional value to indicate tasks and profiles to apply.
    Stage string
    // The boot environment that the machine should boot into.  This
    // must be the name of a boot environment present in the backend.
    // If this field is not present or blank, the global default bootenv
    // will be used instead.
    BootEnv string
    // An array of profiles to apply to this machine in order when looking
    // for a parameter during rendering.
    Profiles []string
    //
    // The Machine specific Profile Data - only used for the map (name and other
    // fields not used - THIS IS DEPRECATED AND WILL GO AWAY.
    // Data will migrated from this struct to Params and then cleared.
    Profile Profile
    // Replaces the Profile.
    Params map[string]interface{}
    // The tasks this machine has to run.
    Tasks []string
    // required: true
    CurrentTask int
    // Indicates if the machine can run jobs or not.  Failed jobs mark the machine
    // not runnable.
    //
    // required: true
    Runnable bool

    // Secret for machine token revocation.  Changing the secret will invalidate
    // all existing tokens for this machine
    Secret string
    // OS is the operating system that the node is running in
    //
    OS  string
}

Machine represents a single bare-metal system that the provisioner should manage the boot environment for. swagger:model

func (*Machine) AddTasks Uses

func (b *Machine) AddTasks(offset int, tasks ...string) error

func (*Machine) AuthKey Uses

func (n *Machine) AuthKey() string

func (*Machine) DelTasks Uses

func (b *Machine) DelTasks(tasks ...string)

func (*Machine) Fill Uses

func (n *Machine) Fill()

func (*Machine) GetBootEnv Uses

func (b *Machine) GetBootEnv() string

match BootEnver interface

func (*Machine) GetParams Uses

func (b *Machine) GetParams() map[string]interface{}

match Paramer interface

func (*Machine) GetProfiles Uses

func (b *Machine) GetProfiles() []string

match Profiler interface

func (*Machine) GetTasks Uses

func (b *Machine) GetTasks() []string

match TaskRunner interface

func (*Machine) Key Uses

func (n *Machine) Key() string

func (*Machine) Prefix Uses

func (n *Machine) Prefix() string

func (*Machine) RunningTask Uses

func (b *Machine) RunningTask() int

func (*Machine) SetBootEnv Uses

func (b *Machine) SetBootEnv(s string)

func (*Machine) SetName Uses

func (b *Machine) SetName(n string)

func (*Machine) SetParams Uses

func (b *Machine) SetParams(p map[string]interface{})

func (*Machine) SetProfiles Uses

func (b *Machine) SetProfiles(p []string)

func (*Machine) SetTasks Uses

func (b *Machine) SetTasks(t []string)

func (*Machine) SliceOf Uses

func (b *Machine) SliceOf() interface{}

func (*Machine) ToModels Uses

func (b *Machine) ToModels(obj interface{}) []Model

func (*Machine) UUID Uses

func (n *Machine) UUID() string

func (*Machine) Validate Uses

func (n *Machine) Validate()

type MachineAction Uses

type MachineAction struct {
    Name    string
    Uuid    uuid.UUID
    Address net.IP
    BootEnv string
    Command string
    Params  map[string]interface{}
}

Params is built from the caller, plus the machine, plus profiles, plus global.

This is used by the frontend to talk to the plugin.

func (*MachineAction) Fill Uses

func (m *MachineAction) Fill()

type Meta Uses

type Meta map[string]string

Meta holds information about arbritary things. Initial usage will be for UX elements.

swagger: model

func (Meta) AddFeature Uses

func (m Meta) AddFeature(flag string)

func (Meta) ClearFeatures Uses

func (m Meta) ClearFeatures()

func (Meta) Features Uses

func (m Meta) Features() []string

func (Meta) HasFeature Uses

func (m Meta) HasFeature(flag string) bool

func (Meta) MergeFeatures Uses

func (m Meta) MergeFeatures(other []string)

func (Meta) RemoveFeature Uses

func (m Meta) RemoveFeature(flag string)

type Model Uses

type Model interface {
    Prefix() string
    Key() string
}

func Clone Uses

func Clone(m Model) Model

type NameSetter Uses

type NameSetter interface {
    Model
    SetName(string)
}

type OsInfo Uses

type OsInfo struct {
    // The name of the OS this BootEnv has.
    //
    // required: true
    Name string
    // The family of operating system (linux distro lineage, etc)
    Family string
    // The codename of the OS, if any.
    Codename string
    // The version of the OS, if any.
    Version string
    // The name of the ISO that the OS should install from.
    IsoFile string
    // The SHA256 of the ISO file.  Used to check for corrupt downloads.
    IsoSha256 string
    // The URL that the ISO can be downloaded from, if any.
    //
    // swagger:strfmt uri
    IsoUrl string
}

OsInfo holds information about the operating system this BootEnv maps to. Most of this information is optional for now. swagger:model

type Param Uses

type Param struct {
    Validation
    Access
    Meta
    // Name is the name of the param.  Params must be uniquely named.
    //
    // required: true
    Name string
    // Description is a one-line description of the parameter.
    Description string
    // Documentation details what the parameter does, what values it can
    // take, what it is used for, etc.
    Documentation string
    // Schema must be a valid JSONSchema as of draft v4.
    //
    // required: true
    Schema interface{}
}

Param represents metadata about a Parameter or a Preference. Specifically, it contains a description of what the information is for, detailed documentation about the param, and a JSON schema that the param must match to be considered valid. swagger:model

func (*Param) AuthKey Uses

func (p *Param) AuthKey() string

func (*Param) DefaultValue Uses

func (p *Param) DefaultValue() (interface{}, bool)

func (*Param) Fill Uses

func (p *Param) Fill()

func (*Param) Key Uses

func (p *Param) Key() string

func (*Param) Prefix Uses

func (p *Param) Prefix() string

func (*Param) SetName Uses

func (p *Param) SetName(s string)

func (*Param) SliceOf Uses

func (b *Param) SliceOf() interface{}

func (*Param) ToModels Uses

func (b *Param) ToModels(obj interface{}) []Model

func (*Param) Validate Uses

func (p *Param) Validate()

type Paramer Uses

type Paramer interface {
    Model
    GetParams() map[string]interface{}
    SetParams(map[string]interface{})
}

type Plugin Uses

type Plugin struct {
    Validation
    Access
    Meta
    // The name of the plugin instance.  THis must be unique across all
    // plugins.
    //
    // required: true
    Name string
    // A description of this plugin.  This can contain any reference
    // information for humans you want associated with the plugin.
    Description string
    // Any additional parameters that may be needed to configure
    // the plugin.
    Params map[string]interface{}
    // The plugin provider for this plugin
    //
    // required: true
    Provider string
    // Error unrelated to the object validity, but the execution
    // of the plugin.
    PluginErrors []string
}

Plugin represents a single instance of a running plugin. This contains the configuration need to start this plugin instance. swagger:model

func (*Plugin) AuthKey Uses

func (n *Plugin) AuthKey() string

func (*Plugin) Fill Uses

func (n *Plugin) Fill()

func (*Plugin) GetParams Uses

func (b *Plugin) GetParams() map[string]interface{}

match Paramer interface

func (*Plugin) Key Uses

func (n *Plugin) Key() string

func (*Plugin) Prefix Uses

func (n *Plugin) Prefix() string

func (*Plugin) SetName Uses

func (p *Plugin) SetName(s string)

func (*Plugin) SetParams Uses

func (b *Plugin) SetParams(p map[string]interface{})

func (*Plugin) SliceOf Uses

func (b *Plugin) SliceOf() interface{}

func (*Plugin) ToModels Uses

func (b *Plugin) ToModels(obj interface{}) []Model

func (*Plugin) Validate Uses

func (p *Plugin) Validate()

type PluginClientReply Uses

type PluginClientReply struct {
    Id   int
    Code int
    Data []byte
}

If code == 0,2xx, then success and call should json decode. If code != 0,2xx, then error and data is Error.

func (*PluginClientReply) Error Uses

func (r *PluginClientReply) Error() *Error

func (*PluginClientReply) HasError Uses

func (r *PluginClientReply) HasError() bool

type PluginClientRequest Uses

type PluginClientRequest struct {
    Id     int
    Action string
    Data   []byte
}

Id of request, and JSON blob

type PluginProvider Uses

type PluginProvider struct {
    Meta

    Name    string
    Version string

    HasPublish       bool
    AvailableActions []*AvailableAction

    RequiredParams []string
    OptionalParams []string

    // Ensure that these are in the system.
    // This should be deprecated and should be converted to content.
    Parameters []*Param

    // Content Bundle Yaml string - can be optional or empty
    Content string
}

Plugin Provider describes the available functions that could be instantiated by a plugin. swagger:model

func (*PluginProvider) Fill Uses

func (p *PluginProvider) Fill()

func (*PluginProvider) Key Uses

func (p *PluginProvider) Key() string

func (*PluginProvider) Prefix Uses

func (p *PluginProvider) Prefix() string

func (*PluginProvider) SliceOf Uses

func (p *PluginProvider) SliceOf() interface{}

func (*PluginProvider) ToModels Uses

func (p *PluginProvider) ToModels(obj interface{}) []Model

type PluginProviderUploadInfo Uses

type PluginProviderUploadInfo struct {
    Path string `json:"path"`
    Size int64  `json:"size"`
}

swagger:model

type Pref Uses

type Pref struct {
    Meta
    Name string
    Val  string
}

Pref tracks a global DigitalRebar Provision preference -- things like the bootenv to use for unknown systems trying to PXE boot to us, the default bootenv for known systems, etc.

func (*Pref) AuthKey Uses

func (p *Pref) AuthKey() string

func (*Pref) Fill Uses

func (p *Pref) Fill()

func (*Pref) Key Uses

func (p *Pref) Key() string

func (*Pref) Prefix Uses

func (p *Pref) Prefix() string

func (*Pref) SliceOf Uses

func (b *Pref) SliceOf() interface{}

func (*Pref) ToModels Uses

func (b *Pref) ToModels(obj interface{}) []Model

type Profile Uses

type Profile struct {
    Validation
    Access
    Meta
    // The name of the profile.  This must be unique across all
    // profiles.
    //
    // required: true
    Name string
    // A description of this profile.  This can contain any reference
    // information for humans you want associated with the profile.
    Description string
    // Any additional parameters that may be needed to expand templates
    // for BootEnv, as documented by that boot environment's
    // RequiredParams and OptionalParams.
    Params map[string]interface{}
}

Profile represents a set of key/values to use in template expansion.

There is one special profile named 'global' that acts as a global set of parameters for the system.

These can be assigned to a machine's profile list. swagger:model

func (*Profile) AuthKey Uses

func (p *Profile) AuthKey() string

func (*Profile) Fill Uses

func (p *Profile) Fill()

func (*Profile) GetParams Uses

func (b *Profile) GetParams() map[string]interface{}

match Paramer interface

func (*Profile) Key Uses

func (p *Profile) Key() string

func (*Profile) Prefix Uses

func (p *Profile) Prefix() string

func (*Profile) SetName Uses

func (b *Profile) SetName(n string)

func (*Profile) SetParams Uses

func (b *Profile) SetParams(p map[string]interface{})

func (*Profile) SliceOf Uses

func (b *Profile) SliceOf() interface{}

func (*Profile) ToModels Uses

func (b *Profile) ToModels(obj interface{}) []Model

func (*Profile) Validate Uses

func (p *Profile) Validate()

type Profiler Uses

type Profiler interface {
    Model
    GetProfiles() []string
    SetProfiles([]string)
}

type Reservation Uses

type Reservation struct {
    Validation
    Access
    Meta
    // Addr is the IP address permanently assigned to the strategy/token combination.
    //
    // required: true
    // swagger:strfmt ipv4
    Addr net.IP
    // Token is the unique identifier that the strategy for this Reservation should use.
    //
    // required: true
    Token string
    // NextServer is the address the server should contact next.
    //
    // required: false
    // swagger:strfmt ipv4
    NextServer net.IP
    // Options is the list of DHCP options that apply to this Reservation
    Options []DhcpOption
    // Strategy is the leasing strategy that will be used determine what to use from
    // the DHCP packet to handle lease management.
    //
    // required: true
    Strategy string
}

Reservation tracks persistent DHCP IP address reservations.

swagger:model

func (*Reservation) AuthKey Uses

func (r *Reservation) AuthKey() string

func (*Reservation) Fill Uses

func (r *Reservation) Fill()

func (*Reservation) Key Uses

func (r *Reservation) Key() string

func (*Reservation) Prefix Uses

func (r *Reservation) Prefix() string

func (*Reservation) SliceOf Uses

func (b *Reservation) SliceOf() interface{}

func (*Reservation) ToModels Uses

func (b *Reservation) ToModels(obj interface{}) []Model

type Section Uses

type Section map[string]interface{}

type Sections Uses

type Sections map[string]Section

type Slicer Uses

type Slicer interface {
    Filler
    SliceOf() interface{}
    ToModels(interface{}) []Model
}

func New Uses

func New(kind string) (Slicer, error)

type Stage Uses

type Stage struct {
    Validation
    Access
    Meta
    // The name of the boot environment.  Boot environments that install
    // an operating system must end in '-install'.
    //
    // required: true
    Name string
    // A description of this boot environment.  This should tell what
    // the boot environment is for, any special considerations that
    // shoudl be taken into account when using it, etc.
    Description string
    // The templates that should be expanded into files for the stage.
    //
    // required: true
    Templates []TemplateInfo
    // The list of extra required parameters for this
    // bootstate. They should be present as Machine.Params when
    // the bootenv is applied to the machine.
    //
    // required: true
    RequiredParams []string
    // The list of extra optional parameters for this
    // bootstate. They can be present as Machine.Params when
    // the bootenv is applied to the machine.  These are more
    // other consumers of the bootenv to know what parameters
    // could additionally be applied to the bootenv by the
    // renderer based upon the Machine.Params
    //
    OptionalParams []string
    // The BootEnv the machine should be in to run this stage.
    // If the machine is not in this bootenv, the bootenv of the
    // machine will be changed.
    //
    // required: true
    BootEnv string
    // The list of initial machine tasks that the stage should run
    Tasks []string
    // The list of profiles a machine should use while in this stage.
    // These are used after machine profiles, but before global.
    Profiles []string
    // Flag to indicate if a node should be PXE booted on this
    // transition into this Stage.  The nextbootpxe and reboot
    // machine actions will be called if present and Reboot is true
    Reboot bool
    // Flag to indicate if the runner should wait for more tasks
    // while in this stage.
    RunnerWait bool
}

Stage encapsulates a set of tasks and profiles to apply to a Machine in a BootEnv.

swagger:model

func (*Stage) AuthKey Uses

func (s *Stage) AuthKey() string

func (*Stage) Fill Uses

func (s *Stage) Fill()

func (*Stage) GetBootEnv Uses

func (b *Stage) GetBootEnv() string

match BootEnver interface

func (*Stage) GetProfiles Uses

func (b *Stage) GetProfiles() []string

match Profiler interface

func (*Stage) GetTasks Uses

func (b *Stage) GetTasks() []string

match TaskRunner interface

func (*Stage) Key Uses

func (s *Stage) Key() string

func (*Stage) Prefix Uses

func (s *Stage) Prefix() string

func (*Stage) SetBootEnv Uses

func (b *Stage) SetBootEnv(s string)

func (*Stage) SetName Uses

func (b *Stage) SetName(n string)

func (*Stage) SetProfiles Uses

func (b *Stage) SetProfiles(p []string)

func (*Stage) SetTasks Uses

func (b *Stage) SetTasks(t []string)

func (*Stage) SliceOf Uses

func (b *Stage) SliceOf() interface{}

func (*Stage) ToModels Uses

func (b *Stage) ToModels(obj interface{}) []Model

func (*Stage) Validate Uses

func (s *Stage) Validate()

type Stat Uses

type Stat struct {
    // required: true
    Name string `json:"name"`
    // required: true
    Count int `json:"count"`
}

swagger:model

type Subnet Uses

type Subnet struct {
    Validation
    Access
    Meta
    // Name is the name of the subnet.
    // Subnet names must be unique
    //
    // required: true
    Name string
    // Enabled indicates if the subnet should hand out leases or continue operating
    // leases if already running.
    //
    // required: true
    Enabled bool
    // Proxy indicates if the subnet should act as a proxy DHCP server.
    // If true, the subnet will not manage ip addresses but will send
    // offers to requests.
    //
    // required: true
    Proxy bool
    // Subnet is the network address in CIDR form that all leases
    // acquired in its range will use for options, lease times, and NextServer settings
    // by default
    //
    // required: true
    // pattern: ^([0-9]+\.){3}[0-9]+/[0-9]+$
    Subnet string
    // NextServer is the address of the next server
    //
    // required: true
    // swagger:strfmt ipv4
    NextServer net.IP
    // ActiveStart is the first non-reserved IP address we will hand
    // non-reserved leases from.
    //
    // required: true
    // swagger:strfmt ipv4
    ActiveStart net.IP
    // ActiveEnd is the last non-reserved IP address we will hand
    // non-reserved leases from.
    //
    // required: true
    // swagger:strfmt ipv4
    ActiveEnd net.IP
    // ActiveLeaseTime is the default lease duration in seconds
    // we will hand out to leases that do not have a reservation.
    //
    // required: true
    ActiveLeaseTime int32
    // ReservedLeasTime is the default lease time we will hand out
    // to leases created from a reservation in our subnet.
    //
    // required: true
    ReservedLeaseTime int32
    // OnlyReservations indicates that we will only allow leases for which
    // there is a preexisting reservation.
    //
    // required: true
    OnlyReservations bool
    Options          []*DhcpOption
    // Strategy is the leasing strategy that will be used determine what to use from
    // the DHCP packet to handle lease management.
    //
    // required: true
    Strategy string
    // Pickers is list of methods that will allocate IP addresses.
    // Each string must refer to a valid address picking strategy.  The current ones are:
    //
    // "none", which will refuse to hand out an address and refuse
    // to try any remaining strategies.
    //
    // "hint", which will try to reuse the address that the DHCP
    // packet is requesting, if it has one.  If the request does
    // not have a requested address, "hint" will fall through to
    // the next strategy. Otherwise, it will refuse to try ant
    // reamining strategies whether or not it can satisfy the
    // request.  This should force the client to fall back to
    // DHCPDISCOVER with no requsted IP address. "hint" will reuse
    // expired leases and unexpired leases that match on the
    // requested address, strategy, and token.
    //
    // "nextFree", which will try to create a Lease with the next
    // free address in the subnet active range.  It will fall
    // through to the next strategy if it cannot find a free IP.
    // "nextFree" only considers addresses that do not have a
    // lease, whether or not the lease is expired.
    //
    // "mostExpired" will try to recycle the most expired lease in the subnet's active range.
    //
    // All of the address allocation strategies do not consider
    // any addresses that are reserved, as lease creation will be
    // handled by the reservation instead.
    //
    // We will consider adding more address allocation strategies in the future.
    //
    // required: true
    Pickers []string
}

Subnet represents a DHCP Subnet

swagger:model

func (*Subnet) AuthKey Uses

func (s *Subnet) AuthKey() string

func (*Subnet) Fill Uses

func (s *Subnet) Fill()

func (*Subnet) Key Uses

func (s *Subnet) Key() string

func (*Subnet) Prefix Uses

func (s *Subnet) Prefix() string

func (*Subnet) SliceOf Uses

func (b *Subnet) SliceOf() interface{}

func (*Subnet) ToModels Uses

func (b *Subnet) ToModels(obj interface{}) []Model

func (*Subnet) Validate Uses

func (s *Subnet) Validate()

type Task Uses

type Task struct {
    Validation
    Access
    Meta
    // Name is the name of this Task.  Task names must be globally unique
    //
    // required: true
    Name string
    // Description is a one-line description of this Task.
    Description string
    // Documentation should describe in detail what this task should do on a machine.
    Documentation string
    // Templates lists the templates that need to be rendered for the Task.
    //
    // required: true
    Templates []TemplateInfo
    // RequiredParams is the list of parameters that are required to be present on
    // Machine.Params or in a profile attached to the machine.
    //
    // required: true
    RequiredParams []string
    // OptionalParams are extra optional parameters that a template rendered for
    // the Task may use.
    //
    // required: true
    OptionalParams []string
}

Task is a thing that can run on a Machine.

swagger:model

func (*Task) AuthKey Uses

func (t *Task) AuthKey() string

func (*Task) Fill Uses

func (t *Task) Fill()

func (*Task) Key Uses

func (t *Task) Key() string

func (*Task) Prefix Uses

func (t *Task) Prefix() string

func (*Task) SetName Uses

func (b *Task) SetName(n string)

func (*Task) SliceOf Uses

func (b *Task) SliceOf() interface{}

func (*Task) ToModels Uses

func (b *Task) ToModels(obj interface{}) []Model

func (*Task) Validate Uses

func (t *Task) Validate()

type TaskRunner Uses

type TaskRunner interface {
    Tasker
    RunningTask() int
}

type Tasker Uses

type Tasker interface {
    Model
    GetTasks() []string
    SetTasks([]string)
}

type Template Uses

type Template struct {
    Validation
    Access
    Meta
    // ID is a unique identifier for this template.  It cannot change once it is set.
    //
    // required: true
    ID  string
    // A description of this template
    Description string
    // Contents is the raw template.  It must be a valid template
    // according to text/template.
    //
    // required: true
    Contents string
}

Template represents a template that will be associated with a boot environment.

swagger:model

func (*Template) AuthKey Uses

func (t *Template) AuthKey() string

func (*Template) Fill Uses

func (t *Template) Fill()

func (*Template) Key Uses

func (t *Template) Key() string

func (*Template) Prefix Uses

func (t *Template) Prefix() string

func (*Template) SliceOf Uses

func (b *Template) SliceOf() interface{}

func (*Template) ToModels Uses

func (b *Template) ToModels(obj interface{}) []Model

func (*Template) Validate Uses

func (t *Template) Validate()

type TemplateInfo Uses

type TemplateInfo struct {
    // Name of the template
    //
    // required: true
    Name string
    // A text/template that specifies how to create
    // the final path the template should be
    // written to.
    //
    // required: true
    Path string
    // The ID of the template that should be expanded.  Either
    // this or Contents should be set
    //
    // required: false
    ID  string
    // The contents that should be used when this template needs
    // to be expanded.  Either this or ID should be set.
    //
    // required: false
    Contents string
    // contains filtered or unexported fields
}

TemplateInfo holds information on the templates in the boot environment that will be expanded into files.

swagger:model

func (*TemplateInfo) Id Uses

func (ti *TemplateInfo) Id() string

func (*TemplateInfo) PathTemplate Uses

func (ti *TemplateInfo) PathTemplate() *template.Template

func (*TemplateInfo) SanityCheck Uses

func (ti *TemplateInfo) SanityCheck(idx int, e ErrorAdder, missingPathOK bool)

type User Uses

type User struct {
    Validation
    Access
    Meta
    // Name is the name of the user
    //
    // required: true
    Name string
    // PasswordHash is the scrypt-hashed version of the user's Password.
    //
    PasswordHash []byte `json:",omitempty"`
    // Token secret - this is used when generating user token's to
    // allow for revocation by the grantor or the grantee.  Changing this
    // will invalidate all existing tokens that have this user as a user
    // or a grantor.
    Secret string
}

User is an API user of DigitalRebar Provision swagger:model

func (*User) AuthKey Uses

func (u *User) AuthKey() string

func (*User) CheckPassword Uses

func (u *User) CheckPassword(pass string) bool

func (*User) Fill Uses

func (u *User) Fill()

func (*User) Key Uses

func (u *User) Key() string

func (*User) Prefix Uses

func (u *User) Prefix() string

func (*User) Sanitize Uses

func (u *User) Sanitize() Model

func (*User) SetName Uses

func (b *User) SetName(n string)

func (*User) SliceOf Uses

func (b *User) SliceOf() interface{}

func (*User) ToModels Uses

func (b *User) ToModels(obj interface{}) []Model

func (*User) Validate Uses

func (u *User) Validate()

type UserPassword Uses

type UserPassword struct {
    Password string
}

swagger:model

type UserToken Uses

type UserToken struct {
    Token string
    Info  Info
}

swagger:model

type ValidateSetter Uses

type ValidateSetter interface {
    SetValid() bool
    SetAvailable() bool
}

type Validation Uses

type Validation struct {
    // Validated tracks whether or not the model has been validated.
    // read only: true
    Validated bool
    // Available tracks whether or not the model passed validation.
    // read only: true
    Available bool
    // If there are any errors in the validation process, they will be
    // available here.
    // read only: true
    Errors []string
    // contains filtered or unexported fields
}

Validation holds information about whether the current model is valid or not. It is designed to be embedded into structs that need post-operation validation.

swagger: model

func (*Validation) AddError Uses

func (v *Validation) AddError(err error)

func (*Validation) ChangeForced Uses

func (v *Validation) ChangeForced() bool

func (*Validation) ClearValidation Uses

func (v *Validation) ClearValidation()

func (*Validation) Error Uses

func (v *Validation) Error() string

func (*Validation) Errorf Uses

func (v *Validation) Errorf(fmtStr string, args ...interface{})

func (*Validation) ForceChange Uses

func (v *Validation) ForceChange()

func (*Validation) HasError Uses

func (v *Validation) HasError() error

func (*Validation) IsAvailable Uses

func (v *Validation) IsAvailable() bool

func (*Validation) MakeError Uses

func (v *Validation) MakeError(code int, errType string, obj Model) error

func (*Validation) RestoreValidation Uses

func (v *Validation) RestoreValidation(ov *Validation)

func (*Validation) SaveValidation Uses

func (v *Validation) SaveValidation() *Validation

func (*Validation) SetAvailable Uses

func (v *Validation) SetAvailable() bool

func (*Validation) SetInvalid Uses

func (v *Validation) SetInvalid() bool

func (*Validation) SetValid Uses

func (v *Validation) SetValid() bool

func (*Validation) Useable Uses

func (v *Validation) Useable() bool

type Validator Uses

type Validator interface {
    Validate()
    ClearValidation()
    Useable() bool
    IsAvailable() bool
    HasError() error
}

model object may define a Validate method that can be used to return errors about if the model is valid in the current datatracker.

Package models imports 20 packages (graph) and is imported by 7 packages. Updated 2017-12-11. Refresh now. Tools for package owners.