Documentation ¶
Index ¶
- Constants
- Variables
- func AllPrefixes() []string
- func ArchEqual(a, b string) bool
- func DHCPOptionParser(code dhcp.OptionCode) (func(string) ([]byte, error), func([]byte) string)
- func DecodeYaml(buf []byte, ref interface{}) error
- func DrpSafeFuncMap() template.FuncMap
- func FibBackoff(thunk func() error)
- func GenPatch(source, target interface{}, paranoid bool) (jsonpatch2.Patch, error)
- func Hexaddr(addr net.IP) string
- func IsSecureData(val interface{}) bool
- func MergeTemplates(root *template.Template, tmpls []TemplateInfo, e ErrorAdder) *template.Template
- func ParseContentPrerequisites(prereqs string) (map[string]semver.Range, error)
- func RandString(n int) string
- func Remarshal(src, dest interface{}) error
- func SupportedArch(s string) (string, bool)
- func UpdateAllScopesWithRawModel(prefix string)
- func ValidEndpointName(msg, s string) error
- func ValidMachineName(msg, s string) error
- func ValidName(msg, s string) error
- func ValidNumberName(msg, s string) error
- func ValidParamName(msg, s string) error
- func ValidateIP4(e ErrorAdder, a net.IP)
- func ValidateMac(e ErrorAdder, mac string)
- func ValidateMaybeZeroIP4(e ErrorAdder, a net.IP)
- type Access
- type Accessor
- type Action
- type Actor
- type ArchInfo
- type AvailableAction
- type BlobInfo
- type BootEnv
- func (b *BootEnv) AuthKey() string
- func (b *BootEnv) BootParamsFor(arch string) string
- func (b *BootEnv) CanHaveActions() bool
- func (b *BootEnv) Fill()
- func (b *BootEnv) GetDescription() string
- func (b *BootEnv) GetDocumentation() string
- func (b *BootEnv) GetMeta() Meta
- func (b *BootEnv) InitrdsFor(arch string) []string
- func (b *BootEnv) IsoFor(arch string) string
- func (b *BootEnv) IsoUrlFor(arch string) string
- func (b *BootEnv) KernelFor(arch string) string
- func (b *BootEnv) Key() string
- func (b *BootEnv) KeyName() string
- func (b *BootEnv) MergeOverrides(overrides ...BootEnvOverride) *BootEnv
- func (b *BootEnv) NetBoot() bool
- func (b *BootEnv) Prefix() string
- func (b *BootEnv) SetMeta(d Meta)
- func (b *BootEnv) SetName(n string)
- func (b *BootEnv) ShaFor(arch string) string
- func (b *BootEnv) SliceOf() interface{}
- func (b *BootEnv) ToModels(obj interface{}) []Model
- func (b *BootEnv) Validate()
- type BootEnvOverride
- type BootEnver
- type BsdpBootOption
- type Bundled
- type Bundler
- type CatalogItem
- func (ci *CatalogItem) AuthKey() string
- func (ci *CatalogItem) Clone() *CatalogItem
- func (ci *CatalogItem) DownloadUrl(arch, os string) string
- func (ci *CatalogItem) FileName() string
- func (ci *CatalogItem) Fill()
- func (ci *CatalogItem) Key() string
- func (ci *CatalogItem) KeyName() string
- func (ci *CatalogItem) Prefix() string
- func (ci *CatalogItem) SliceOf() interface{}
- func (ci *CatalogItem) ToModels(obj interface{}) []Model
- type ChangeForcer
- type Claim
- type Claims
- type ClaimsList
- type Content
- func (c *Content) AuthKey() string
- func (c *Content) Fill()
- func (c *Content) FromStore(src store.Store) error
- func (c *Content) GenerateMetaMap() map[string]string
- func (c *Content) GetDescription() string
- func (c *Content) GetDocumentation() string
- func (c *Content) Key() string
- func (c *Content) KeyName() string
- func (c *Content) Mangle(thunk func(string, interface{}) (interface{}, error)) error
- func (c *Content) Prefix() string
- func (c *Content) ToStore(dest store.Store) error
- type ContentMetaData
- type ContentSummary
- type Context
- func (c *Context) AuthKey() string
- func (c *Context) Fill()
- func (c *Context) GetMeta() Meta
- func (c *Context) Key() string
- func (c *Context) KeyName() string
- func (c *Context) Prefix() string
- func (c *Context) SetMeta(d Meta)
- func (c *Context) SliceOf() interface{}
- func (c *Context) ToModels(obj interface{}) []Model
- type Descer
- type DhcpOption
- func (o *DhcpOption) AddToPacket(p *dhcp.Packet) error
- func (o *DhcpOption) ConvertOptionValueToByte(value string) ([]byte, error)
- func (o *DhcpOption) Fill(s string) error
- func (o *DhcpOption) FillFromPacketOpt(buf []byte)
- func (o DhcpOption) RenderToDHCP(srcOpts map[int]string) (code byte, val []byte, err error)
- func (o *DhcpOption) String() string
- type Docer
- type Element
- type ElementAction
- type Endpoint
- func (e *Endpoint) AuthKey() string
- func (e *Endpoint) CanHaveActions() bool
- func (e *Endpoint) Fill()
- func (e *Endpoint) GetDescription() string
- func (e *Endpoint) GetMeta() Meta
- func (e *Endpoint) GetParams() map[string]interface{}
- func (e *Endpoint) Key() string
- func (e *Endpoint) KeyName() string
- func (e *Endpoint) Prefix() string
- func (e *Endpoint) SetMeta(d Meta)
- func (e *Endpoint) SetName(name string)
- func (e *Endpoint) SetParams(p map[string]interface{})
- func (e *Endpoint) SliceOf() interface{}
- func (e *Endpoint) ToModels(obj interface{}) []Model
- func (e *Endpoint) Validate()
- type Error
- type ErrorAdder
- type Event
- type FileData
- type Filler
- type HaPassiveState
- type Index
- type Info
- type Interface
- type Job
- func (j *Job) AuthKey() string
- func (b *Job) CanHaveActions() bool
- func (j *Job) Fill()
- func (j *Job) GetMeta() Meta
- func (j *Job) Key() string
- func (j *Job) KeyName() string
- func (j *Job) Prefix() string
- func (j *Job) SetMeta(d Meta)
- func (b *Job) SliceOf() interface{}
- func (b *Job) ToModels(obj interface{}) []Model
- func (j *Job) Validate()
- type JobAction
- type JobActions
- type Lease
- func (l *Lease) AuthKey() string
- func (b *Lease) CanHaveActions() bool
- func (l *Lease) Expire()
- func (l *Lease) Expired() bool
- func (l *Lease) Fake() bool
- func (l *Lease) Fill()
- func (l *Lease) GetMeta() Meta
- func (l *Lease) Invalidate()
- func (l *Lease) Key() string
- func (l *Lease) KeyName() string
- func (l *Lease) Prefix() string
- func (l *Lease) SetMeta(d Meta)
- func (b *Lease) SliceOf() interface{}
- func (l *Lease) String() string
- func (b *Lease) ToModels(obj interface{}) []Model
- type License
- type LicenseBundle
- type Machine
- func (b *Machine) AddTasks(offset int, tasks ...string) error
- func (n *Machine) AuthKey() string
- func (b *Machine) CanHaveActions() bool
- func (b *Machine) DelTasks(tasks ...string)
- func (n *Machine) Fill()
- func (b *Machine) GetBootEnv() string
- func (m *Machine) GetDescription() string
- func (n *Machine) GetMeta() Meta
- func (b *Machine) GetParams() map[string]interface{}
- func (b *Machine) GetProfiles() []string
- func (b *Machine) GetTasks() []string
- func (n *Machine) IsLocked() bool
- func (n *Machine) Key() string
- func (n *Machine) KeyName() string
- func (n *Machine) Prefix() string
- func (b *Machine) RunningTask() int
- func (b *Machine) SetBootEnv(s string)
- func (n *Machine) SetMeta(d Meta)
- func (b *Machine) SetName(n string)
- func (b *Machine) SetParams(p map[string]interface{})
- func (b *Machine) SetProfiles(p []string)
- func (b *Machine) SetTasks(t []string)
- func (b *Machine) SliceOf() interface{}
- func (b *Machine) SplitTasks() (thePast []string, thePresent []string, theFuture []string)
- func (b *Machine) ToModels(obj interface{}) []Model
- func (n *Machine) UUID() string
- func (n *Machine) Validate()
- type MachineFingerprint
- type Meta
- type MetaHaver
- type ModTimeSha
- func (m *ModTimeSha) Generate(fi *os.File) error
- func (m *ModTimeSha) MarshalBinary() ([]byte, error)
- func (m *ModTimeSha) ReadFromXattr(fi *os.File) error
- func (m *ModTimeSha) Regenerate(fi *os.File) (bool, error)
- func (m *ModTimeSha) SaveToXattr(fi *os.File) error
- func (m *ModTimeSha) String() string
- func (m *ModTimeSha) UnmarshalBinary(buf []byte) error
- func (m *ModTimeSha) UpToDate(fi *os.File) bool
- type Model
- type NameSetter
- type OsInfo
- type Owned
- type Owner
- type Param
- func (p *Param) AuthKey() string
- func (p *Param) DefaultValue() (interface{}, bool)
- func (p *Param) Fill()
- func (p *Param) GetDescription() string
- func (p *Param) GetDocumentation() string
- func (p *Param) GetMeta() Meta
- func (p *Param) Key() string
- func (p *Param) KeyName() string
- func (p *Param) Prefix() string
- func (p *Param) SetMeta(d Meta)
- func (p *Param) SetName(s string)
- func (b *Param) SliceOf() interface{}
- func (b *Param) ToModels(obj interface{}) []Model
- func (p *Param) TypeValue() (interface{}, bool)
- func (p *Param) Validate()
- type Paramer
- type Partialed
- type Partialer
- type Plugin
- func (n *Plugin) AuthKey() string
- func (p *Plugin) CanHaveActions() bool
- func (n *Plugin) Fill()
- func (p *Plugin) GetDescription() string
- func (p *Plugin) GetDocumentation() string
- func (p *Plugin) GetMeta() Meta
- func (p *Plugin) GetParams() map[string]interface{}
- func (n *Plugin) Key() string
- func (n *Plugin) KeyName() string
- func (n *Plugin) Prefix() string
- func (p *Plugin) SetMeta(d Meta)
- func (p *Plugin) SetName(s string)
- func (p *Plugin) SetParams(pl map[string]interface{})
- func (p *Plugin) SliceOf() interface{}
- func (p *Plugin) ToModels(obj interface{}) []Model
- func (p *Plugin) Validate()
- type PluginProvider
- func (p *PluginProvider) AutoPlugin() *Plugin
- func (p *PluginProvider) Fill()
- func (p *PluginProvider) GetDocumentation() string
- func (p *PluginProvider) GetMeta() Meta
- func (p *PluginProvider) Key() string
- func (p *PluginProvider) KeyName() string
- func (p *PluginProvider) Prefix() string
- func (p *PluginProvider) SetMeta(d Meta)
- func (p *PluginProvider) SliceOf() interface{}
- func (p *PluginProvider) Store() (store.Store, error)
- func (p *PluginProvider) ToModels(obj interface{}) []Model
- type PluginProviderUploadInfo
- type Pool
- func (p *Pool) AuthKey() string
- func (p *Pool) CanHaveActions() bool
- func (p *Pool) Clone() *Pool
- func (p *Pool) Fill()
- func (p *Pool) GetDescription() string
- func (p *Pool) GetDocumentation() string
- func (p *Pool) Key() string
- func (p *Pool) KeyName() string
- func (p *Pool) Prefix() string
- func (p *Pool) SetName(name string)
- func (p *Pool) SliceOf() interface{}
- func (p *Pool) ToModels(obj interface{}) []Model
- func (p *Pool) Validate()
- type PoolAutoFill
- type PoolResult
- type PoolResults
- type PoolStatus
- type PoolTransitionActions
- type Pref
- type Profile
- func (p *Profile) AuthKey() string
- func (p *Profile) CanHaveActions() bool
- func (p *Profile) Fill()
- func (p *Profile) GetDescription() string
- func (p *Profile) GetDocumentation() string
- func (p *Profile) GetMeta() Meta
- func (p *Profile) GetParams() map[string]interface{}
- func (p *Profile) GetProfiles() []string
- func (p *Profile) Key() string
- func (p *Profile) KeyName() string
- func (p *Profile) Prefix() string
- func (p *Profile) SetMeta(d Meta)
- func (p *Profile) SetName(n string)
- func (p *Profile) SetParams(pl map[string]interface{})
- func (p *Profile) SetProfiles(np []string)
- func (p *Profile) SliceOf() interface{}
- func (p *Profile) ToModels(obj interface{}) []Model
- func (p *Profile) Validate()
- type Profiler
- type RawModel
- func (r *RawModel) AddError(err error)
- func (r *RawModel) AuthKey() string
- func (r *RawModel) CanHaveActions() bool
- func (r *RawModel) ChangeForced() bool
- func (r *RawModel) ClearValidation()
- func (r *RawModel) Error() string
- func (r *RawModel) Errorf(fmtStr string, args ...interface{})
- func (r *RawModel) Fill()
- func (r *RawModel) ForceChange()
- func (r *RawModel) GetEndpoint() string
- func (r *RawModel) GetMeta() Meta
- func (r *RawModel) GetParams() map[string]interface{}
- func (r *RawModel) GetStringField(field string) (string, bool)
- func (r *RawModel) HasError() error
- func (r *RawModel) IsAvailable() bool
- func (r *RawModel) IsPartial() bool
- func (r *RawModel) IsReadOnly() bool
- func (r *RawModel) Key() string
- func (r *RawModel) KeyName() string
- func (r *RawModel) MakeError(code int, errType string, obj Model) error
- func (r *RawModel) Prefix() string
- func (r *RawModel) RestoreValidation(or *RawModel)
- func (r *RawModel) SaveValidation() *Validation
- func (r *RawModel) SetAvailable() bool
- func (r *RawModel) SetBundle(name string)
- func (r *RawModel) SetEndpoint(n string)
- func (r *RawModel) SetInvalid() bool
- func (r *RawModel) SetMeta(d Meta)
- func (r *RawModel) SetParams(p map[string]interface{})
- func (r *RawModel) SetPartial()
- func (r *RawModel) SetValid() bool
- func (r *RawModel) SliceOf() interface{}
- func (r *RawModel) String() string
- func (r *RawModel) ToModels(obj interface{}) []Model
- func (r *RawModel) Useable() bool
- type Reservation
- func (r *Reservation) AuthKey() string
- func (r *Reservation) CanHaveActions() bool
- func (r *Reservation) Fill()
- func (r *Reservation) GetDescription() string
- func (r *Reservation) GetDocumentation() string
- func (r *Reservation) GetMeta() Meta
- func (r *Reservation) Key() string
- func (r *Reservation) KeyName() string
- func (r *Reservation) Prefix() string
- func (r *Reservation) SetMeta(d Meta)
- func (r *Reservation) SliceOf() interface{}
- func (r *Reservation) ToModels(obj interface{}) []Model
- type Role
- func (r *Role) AuthKey() string
- func (r *Role) Compile() Claims
- func (a *Role) Contains(b *Role) bool
- func (r *Role) Fill()
- func (r *Role) GetDescription() string
- func (r *Role) GetDocumentation() string
- func (r *Role) GetMeta() Meta
- func (r *Role) Key() string
- func (r *Role) KeyName() string
- func (r *Role) Match(scope, action, specific string) bool
- func (r *Role) Prefix() string
- func (r *Role) SetMeta(d Meta)
- func (r *Role) SliceOf() interface{}
- func (r *Role) ToModels(obj interface{}) []Model
- func (r *Role) Validate()
- type Section
- type Sections
- type SecureData
- func (s *SecureData) Marshal(peerPublicKey []byte, data interface{}) error
- func (s *SecureData) Open(targetPrivateKey *[32]byte) ([]byte, error)
- func (s *SecureData) Seal(peerPublicKey *[32]byte, data []byte) error
- func (s *SecureData) Unmarshal(targetPrivateKey []byte, res interface{}) error
- func (s *SecureData) Validate() error
- type Slicer
- type Stage
- func (s *Stage) AuthKey() string
- func (s *Stage) CanHaveActions() bool
- func (s *Stage) Fill()
- func (s *Stage) GetBootEnv() string
- func (s *Stage) GetDescription() string
- func (s *Stage) GetDocumentation() string
- func (s *Stage) GetMeta() Meta
- func (s *Stage) GetParams() map[string]interface{}
- func (s *Stage) GetProfiles() []string
- func (s *Stage) GetTasks() []string
- func (s *Stage) Key() string
- func (s *Stage) KeyName() string
- func (s *Stage) Prefix() string
- func (s *Stage) SetBootEnv(be string)
- func (s *Stage) SetMeta(d Meta)
- func (s *Stage) SetName(n string)
- func (s *Stage) SetParams(p map[string]interface{})
- func (s *Stage) SetProfiles(p []string)
- func (s *Stage) SetTasks(t []string)
- func (s *Stage) SliceOf() interface{}
- func (s *Stage) ToModels(obj interface{}) []Model
- func (s *Stage) Validate()
- type Stat
- type Subnet
- func (s *Subnet) AuthKey() string
- func (b *Subnet) CanHaveActions() bool
- func (s *Subnet) Fill()
- func (s *Subnet) GetDescription() string
- func (s *Subnet) GetDocumentation() string
- func (s *Subnet) GetMeta() Meta
- func (s *Subnet) Key() string
- func (s *Subnet) KeyName() string
- func (s *Subnet) Prefix() string
- func (s *Subnet) SetMeta(d Meta)
- func (b *Subnet) SliceOf() interface{}
- func (b *Subnet) ToModels(obj interface{}) []Model
- func (s *Subnet) Validate()
- type Task
- func (t *Task) AuthKey() string
- func (t *Task) CanHaveActions() bool
- func (t *Task) Fill()
- func (t *Task) GetDescription() string
- func (t *Task) GetDocumentation() string
- func (t *Task) GetMeta() Meta
- func (t *Task) Key() string
- func (t *Task) KeyName() string
- func (t *Task) Prefix() string
- func (t *Task) SetMeta(d Meta)
- func (t *Task) SetName(n string)
- func (t *Task) SliceOf() interface{}
- func (t *Task) ToModels(obj interface{}) []Model
- func (t *Task) Validate()
- type TaskRunner
- type TaskStack
- type Tasker
- type Template
- func (t *Template) AuthKey() string
- func (b *Template) CanHaveActions() bool
- func (t *Template) Fill()
- func (t *Template) GetDescription() string
- func (t *Template) GetMeta() Meta
- func (t *Template) Key() string
- func (t *Template) KeyName() string
- func (t *Template) Prefix() string
- func (t *Template) SetMeta(d Meta)
- func (b *Template) SliceOf() interface{}
- func (b *Template) ToModels(obj interface{}) []Model
- func (t *Template) Validate()
- type TemplateInfo
- type Tenant
- func (t *Tenant) AuthKey() string
- func (t *Tenant) Fill()
- func (t *Tenant) GetDescription() string
- func (t *Tenant) GetDocumentation() string
- func (t *Tenant) GetMeta() Meta
- func (t *Tenant) Key() string
- func (t *Tenant) KeyName() string
- func (t *Tenant) Prefix() string
- func (t *Tenant) SetMeta(d Meta)
- func (t *Tenant) SliceOf() interface{}
- func (t *Tenant) ToModels(obj interface{}) []Model
- func (t *Tenant) Validate()
- type User
- func (u *User) AuthKey() string
- func (b *User) CanHaveActions() bool
- func (u *User) ChangePassword(newPass string) error
- func (u *User) CheckPassword(pass string) bool
- func (u *User) Fill()
- func (u *User) GetDescription() string
- func (u *User) GetMeta() Meta
- func (u *User) Key() string
- func (u *User) KeyName() string
- func (u *User) Prefix() string
- func (u *User) Sanitize() Model
- func (u *User) SetMeta(d Meta)
- func (b *User) SetName(n string)
- func (b *User) SliceOf() interface{}
- func (b *User) ToModels(obj interface{}) []Model
- func (u *User) Validate()
- type UserPassword
- type UserToken
- type ValidateSetter
- type Validation
- func (v *Validation) AddError(err error)
- func (v *Validation) ChangeForced() bool
- func (v *Validation) ClearValidation()
- func (v *Validation) Error() string
- func (v *Validation) Errorf(fmtStr string, args ...interface{})
- func (v *Validation) ForceChange()
- func (v *Validation) HasError() error
- func (v *Validation) IsAvailable() bool
- func (v *Validation) MakeError(code int, errType string, obj Model) error
- func (v *Validation) RestoreValidation(ov *Validation)
- func (v *Validation) SaveValidation() *Validation
- func (v *Validation) SetAvailable() bool
- func (v *Validation) SetInvalid() bool
- func (v *Validation) SetValid() bool
- func (v *Validation) Useable() bool
- type Validator
- type VersionSet
- func (vs *VersionSet) AuthKey() string
- func (vs *VersionSet) CanHaveActions() bool
- func (vs *VersionSet) Clone() *VersionSet
- func (vs *VersionSet) Fill()
- func (vs *VersionSet) GetDescription() string
- func (vs *VersionSet) GetDocumentation() string
- func (vs *VersionSet) Key() string
- func (vs *VersionSet) KeyName() string
- func (vs *VersionSet) Merge(nvs *VersionSet)
- func (vs *VersionSet) Prefix() string
- func (vs *VersionSet) SetName(name string)
- func (vs *VersionSet) SliceOf() interface{}
- func (vs *VersionSet) ToModels(obj interface{}) []Model
- type Whoami
- type Workflow
- func (w *Workflow) AuthKey() string
- func (w *Workflow) CanHaveActions() bool
- func (w *Workflow) Fill()
- func (w *Workflow) GetDescription() string
- func (w *Workflow) GetDocumentation() string
- func (w *Workflow) GetMeta() Meta
- func (w *Workflow) Key() string
- func (w *Workflow) KeyName() string
- func (w *Workflow) Prefix() string
- func (w *Workflow) SetMeta(d Meta)
- func (w *Workflow) SliceOf() interface{}
- func (w *Workflow) ToModels(obj interface{}) []Model
- func (w *Workflow) Validate()
Constants ¶
const ( BsdpOS9 = 0 BsdpOSX = 1 BsdpOSXServer = 2 BsdpDiags = 3 )
const PS_BUILDING = "Building"
const PS_DESTROYING = "Destroying"
const PS_FREE = "Free"
const PS_HOLD_BUILD = "HoldBuild"
const PS_HOLD_DESTROY = "HoldDestroy"
const PS_HOLD_JOIN = "HoldJoin"
const PS_HOLD_LEAVE = "HoldLeave"
const PS_IN_USE = "InUse"
const PS_JOINING = "Joining"
const PS_LEAVING = "Leaving"
Variables ¶
var ( BadKey = errors.New("Key must be 32 bytes long") BadNonce = errors.New("Nonce must be 24 bytes long") Corrupt = errors.New("SecureData corrupted") )
var PoolStatuses []string = []string{
"Joining",
"HoldJoin",
"Free",
"Building",
"HoldBuild",
"InUse",
"Destroying",
"HoldDestroy",
"Leaving",
"HoldLeave",
}
PoolStatuses define the valid status for Machines in the pool
Functions ¶
func AllPrefixes ¶
func AllPrefixes() []string
AllPrefixes returns a slice containing the prefix names of all the Models.
func DHCPOptionParser ¶
DHCPOptionParser returns the appropriate string conversion and deconversion functions for a given DHCP option code.
func DecodeYaml ¶
DecodeYaml is a helper function for dealing with user input -- when accepting input from the user, we want to treat both YAML and JSON as first-class citizens. The YAML library we use makes that easier by using the json struct tags for all marshalling and unmarshalling purposes.
Note that the REST API does not use YAML as a wire protocol, so this function should never be used to decode data coming from the provision service.
func DrpSafeFuncMap ¶
func FibBackoff ¶
func FibBackoff(thunk func() error)
FibBackoff takes function and retries it in a fibonacci backup sequence
func GenPatch ¶
func GenPatch(source, target interface{}, paranoid bool) (jsonpatch2.Patch, error)
GenPatch generates a JSON patch that will transform source into target. The generated patch will have all the applicable test clauses.
func IsSecureData ¶
func IsSecureData(val interface{}) bool
func MergeTemplates ¶
func MergeTemplates(root *template.Template, tmpls []TemplateInfo, e ErrorAdder) *template.Template
func ParseContentPrerequisites ¶
ParseContentPrerequisites is a helper that parses a Prerequisites string from the content bundle metadata and returns a map containing the comparison functions that must pass in order for the content bundle's prerequisites to be satisfied.
func RandString ¶
RandString returns a random string of n characters The range of characters is limited to the base64 set
func SupportedArch ¶
SupportedArch normalizes system architectures and returns whether it is one we know how to normalize.
func UpdateAllScopesWithRawModel ¶
func UpdateAllScopesWithRawModel(prefix string)
UpdateAllScopesWithRawModel adds new role scopes for a specialized RawModel
func ValidEndpointName ¶ added in v4.4.0
ValidEndpointName validates that the string is a valid Endpoint Name
func ValidMachineName ¶
ValidMachineName validates that the string is a valid Machine Name
func ValidNumberName ¶ added in v4.4.0
func ValidParamName ¶
ValidParamName validates that the string is a valid Param Name
func ValidateIP4 ¶
func ValidateIP4(e ErrorAdder, a net.IP)
func ValidateMac ¶
func ValidateMac(e ErrorAdder, mac string)
func ValidateMaybeZeroIP4 ¶
func ValidateMaybeZeroIP4(e ErrorAdder, a net.IP)
Types ¶
type Access ¶
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 ¶
IsReadOnly returns whether the object is read-only. This will be set if the object comes from any content layer other than the working one (provided by a plugin or a content bundle, etc.)
type Accessor ¶
type Accessor interface {
IsReadOnly() bool
}
Accessor is an interface that objects that can be ReadOnly should satisfy. 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 Action ¶
type Action struct { Model interface{} Plugin string Command string CommandSet string Params map[string]interface{} }
Action is an additional command that can be added to other Models by a Plugin.
type ArchInfo ¶
type ArchInfo struct { // IsoFile is the name of the ISO file (or other archive) // that contains all the necessary information to be able to // boot into this BootEnv for a given arch. // At a minimum, it must contain a kernel and initrd that // can be booted over the network. IsoFile string // Sha256 should contain the SHA256 checksum for the IsoFile. // If it does, the IsoFile will be checked upon upload to make sure // it has not been corrupted. Sha256 string // IsoUrl is the location that IsoFile can be downloaded from, if any. // This must be a full URL, including the filename. // // swagger:strfmt url IsoUrl string // 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. If empty, this will fall back to the top-level // Kernel field in the BootEnv // // 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. If empty, this will fall back // to the top-level Initrds field in the BootEnv // // required: true Initrds []string // A template that will be expanded to create the full list of // boot parameters for the environment. If empty, this will fall back // to the top-level BootParams field in the BootEnv // // required: true BootParams string // Loader is the bootloader that should be used for this boot // environment. If left unspecified and not overridden by a subnet // or reservation option, the following boot loaders will be used: // // * lpxelinux.0 on 386-pcbios platforms that are not otherwise using ipxe. // // * ipxe.pxe on 386-pcbios platforms that already use ipxe. // // * ipxe.efi on amd64 EFI platforms. // // * ipxe-arm64.efi on arm64 EFI platforms. // // This setting will be overridden by Subnet and Reservation // options, and it will also only be in effect when dr-provision is // the DHCP server of record. Loader string }
ArchInfo tracks information required to make a BootEnv work across different system architectures. It supersedes the matching fields in the BootEnv struct and the OsInfo struct.
type AvailableAction ¶
type AvailableAction struct { Provider string Model string Command string RequiredParams []string OptionalParams []string }
AvailableAction is an Action that a Plugin instantiated by a PluginProvider. Assumes that there are parameters on the call in addition to the machine.
swagger:model
func (*AvailableAction) Fill ¶
func (a *AvailableAction) Fill()
type BootEnv ¶
type BootEnv struct { Validation Access Meta Owned Bundled // 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 // should be taken into account when using it, etc. Description string // Documentation of this boot environment. This should tell what // the boot environment is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation 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. Kernel must be non-empty for a BootEnv to be // considered net bootable. // // 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 // Loaders contains the boot loaders that should be used for various different network // boot scenarios. It consists of a map of machine type -> partial paths to the bootloaders. // Valid machine types are: // // - 386-pcbios for x86 devices using the legacy bios. // // - amd64-uefi for x86 devices operating in UEFI mode // // - arm64-uefi for arm64 devices operating in UEFI mode // // Other machine types will be added as dr-provision gains support for them. // // If this map does not contain an entry for the machine type, the DHCP server will fall back to // the following entries in this order: // // - The Loader specified in the ArchInfo struct from this BootEnv, if it exists. // // - The value specified in the bootloaders param for the machine type specified on the machine, if it exists. // // - The value specified in the bootloaders param in the global profile, if it exists. // // - The value specified in the default value for the bootloaders param. // // - One of the following vaiues: // // - lpxelinux.0 for 386-pcbios // // - ipxe.efi for amd64-uefi // // - ipxe-arm64.efi for arm64-uefi // // required: true Loaders map[string]string }
BootEnv encapsulates the machine-agnostic information needed by the provisioner to set up a boot environment.
swagger:model
func (*BootEnv) BootParamsFor ¶
func (*BootEnv) CanHaveActions ¶
func (*BootEnv) GetDescription ¶ added in v4.1.0
func (*BootEnv) GetDocumentation ¶
func (*BootEnv) InitrdsFor ¶
func (*BootEnv) IsoFor ¶
IsoFor is a helper function used by the backend to locate the ISO file that should be expanded to provide the install tree required for the bootenv to function.
func (*BootEnv) IsoUrlFor ¶
IsoUrlFor is a helper to return the upstream URL that the ISO for the BootEnv can be downloaded from. This generally points to a mirror location on the public Internet if one exists.
func (*BootEnv) MergeOverrides ¶ added in v4.4.0
func (b *BootEnv) MergeOverrides(overrides ...BootEnvOverride) *BootEnv
MergeOverrides makes a copy of b with the override values in overrides applied in order, which whould be from leaset specific (in the global profile) to the most specific (defined directly on a Machine).
func (*BootEnv) NetBoot ¶
NetBoot returns whether this bootenv is able to boot via PXE or some other network mechanism.
type BootEnvOverride ¶ added in v4.4.0
type BootEnvOverride struct { Loaders map[string]string OS OsInfo Templates []TemplateInfo }
type BsdpBootOption ¶
type BsdpBootOption struct { Index uint16 `plist:"Index"` Install bool `plist:"IsInstall"` OSType byte `plist:"Kind"` OSVersion string `plist:"osVersion"` Name string `plist:"Name"` Booter string `plist:"BootFile"` RootPath string `plist:"RootPath"` }
BsdpBootOption contains the information needed to boot their systems using the aapl BDSP boot protocol. Unless you are provisioning Mac systems, you probably don't need to care about this.
func (*BsdpBootOption) InstallType ¶
func (bo *BsdpBootOption) InstallType() string
func (*BsdpBootOption) MarshalText ¶
func (bo *BsdpBootOption) MarshalText() ([]byte, error)
func (*BsdpBootOption) OSName ¶
func (bo *BsdpBootOption) OSName() string
func (*BsdpBootOption) String ¶
func (bo *BsdpBootOption) String() string
func (*BsdpBootOption) UnmarshalText ¶
func (bo *BsdpBootOption) UnmarshalText(buf []byte) error
type Bundled ¶
type Bundled struct { // Bundle tracks the name of the store containing this object // read only: true Bundle string }
Bundle holds the object's store's name
swagger: model
type CatalogItem ¶ added in v4.0.3
type CatalogItem struct { Validation Access // Meta Items // Icon string // Color string // Author string // DisplayName string // License string // Copyright string // CodeSource string Meta Owned Id string Type string Name string ActualVersion string Version string ContentType string Source string Shasum256 map[string]string NOJQSource string Tip bool HotFix bool }
CatalogItem structure that handles RawModel instead of dealing with RawModel which is how DRP is storing it.
func (*CatalogItem) AuthKey ¶ added in v4.4.0
func (ci *CatalogItem) AuthKey() string
func (*CatalogItem) Clone ¶ added in v4.0.3
func (ci *CatalogItem) Clone() *CatalogItem
Clone the endpoint
func (*CatalogItem) DownloadUrl ¶ added in v4.0.3
func (ci *CatalogItem) DownloadUrl(arch, os string) string
DownloadUrl returns a URL that you can use to download the artifact for this catalog item. If the CatalogItem has a ContentType of `PluginProvider`, arch and os must be set appropriately for the target binary type, otherwise they can be left blank.
func (*CatalogItem) FileName ¶ added in v4.0.3
func (ci *CatalogItem) FileName() string
FileName returns the recommended filename to use when writing this catalog item to disk.
func (*CatalogItem) Fill ¶ added in v4.0.3
func (ci *CatalogItem) Fill()
func (*CatalogItem) Key ¶ added in v4.0.3
func (ci *CatalogItem) Key() string
func (*CatalogItem) KeyName ¶ added in v4.0.3
func (ci *CatalogItem) KeyName() string
func (*CatalogItem) Prefix ¶ added in v4.0.3
func (ci *CatalogItem) Prefix() string
func (*CatalogItem) SliceOf ¶ added in v4.4.0
func (ci *CatalogItem) SliceOf() interface{}
func (*CatalogItem) ToModels ¶ added in v4.4.0
func (ci *CatalogItem) ToModels(obj interface{}) []Model
type ChangeForcer ¶
type ChangeForcer interface { ForceChange() ChangeForced() bool }
type Claim ¶
type Claim struct { Scope string `json:"scope"` Action string `json:"action"` Specific string `json:"specific"` }
Claim is an individial specifier for something we are allowed access to. User is an API user of DigitalRebar Provision swagger:model
func (*Claim) Match ¶
Match tests to see if this claim allows access for the specified scope, action, and specific item.
func (*Claim) Validate ¶
func (c *Claim) Validate(e ErrorAdder)
type ClaimsList ¶
type ClaimsList []Claims
ClaimsList is a list of Claims derived from a Role.
func (ClaimsList) Match ¶
func (c ClaimsList) Match(wanted Claims) bool
Match returns true if one of the entries in c contains wanted
type Content ¶
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"` }
Content models a content bundle. It consists of the metadata describing the content bundle and the objects that the content bundle provides. Upon being sucessfully loaded into dr-provision, these objects will be present and immutable until the content bundle is removed or replaced.
swagger:model
func (*Content) GenerateMetaMap ¶
func (*Content) GetDescription ¶ added in v4.1.0
func (*Content) GetDocumentation ¶ added in v4.1.0
type ContentMetaData ¶
type ContentMetaData struct { // Name is the name of the content bundle. Name must be unique across // all content bundles loaded into a given dr-provision instance. // required: true Name string // Version is a Semver-compliant string describing the version of // the content as a whole. If left empty, the version is assumed to // be 0.0.0 Version string // Description is a one or two line description of what the content // bundle provides. Description string // Source is mostly deprecated, replaced by Author and CodeSource. // It can be left blank. Source string // Documentation should contain Sphinx RST formatted documentation // for the content bundle describing its usage. Documentation string // RequiredFeatures is a comma-seperated list of features that // dr-provision must provide for the content bundle to operate properly. // These correspond to the Features field in the Info struct. RequiredFeatures string // Prerequisites is also a comma-seperated list that contains other // (possibly version-qualified) content bundles that must be present // for this content bundle to load into dr-provision. Each entry in // the Prerequisites list should be in for format of name: version // constraints. The colon and the version constraints may be // omitted if there are no version restrictions on the required // content bundle. // // See ../doc/arch/content-package.rst for more detailed info. Prerequisites string // New descriptor fields for catalog. These are used by the UX. Color string Icon string Author string DisplayName string License string Copyright string CodeSource string Order string Tags string // Comma separated list DocUrl string // Informational Fields Type string Writable bool Overwritable bool }
ContentMetaData holds all the metadata about a content bundle that dr-provision will use to decide how to treat the content bundle.
All fields must be strings All string fields will be trimmed except Documentation.
type ContentSummary ¶
type ContentSummary struct { Meta ContentMetaData `json:"meta"` Counts map[string]int Warnings []string }
swagger:model
func (*ContentSummary) Fill ¶
func (c *ContentSummary) Fill()
func (*ContentSummary) FromStore ¶
func (c *ContentSummary) FromStore(src store.Store)
type Context ¶ added in v4.0.21
type Context struct { Validation Access Meta Owned Bundled // Name is the name of this Context. Name string // Image the OS image that jobs will execute in when running in this Context. // This is usually a Docker container, a VM image, or something similar. Image string // Engine is the system that runs the Image. This is something like // docker, kubernetes, AWS, or something similar. Engine string Description string Documentation string }
type DhcpOption ¶
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 DHCPOptionsInOrder ¶
func DHCPOptionsInOrder(p dhcp.Packet) (res []*DhcpOption, err error)
DHCPOptionsInOrder returns the DHCP options present in the passed-in Packet in the order they appeared, excluding the Pad and End options.
func (*DhcpOption) AddToPacket ¶
func (o *DhcpOption) AddToPacket(p *dhcp.Packet) error
func (*DhcpOption) ConvertOptionValueToByte ¶
func (o *DhcpOption) ConvertOptionValueToByte(value string) ([]byte, error)
func (*DhcpOption) Fill ¶
func (o *DhcpOption) Fill(s string) error
func (*DhcpOption) FillFromPacketOpt ¶
func (o *DhcpOption) FillFromPacketOpt(buf []byte)
func (DhcpOption) RenderToDHCP ¶
func (*DhcpOption) String ¶
func (o *DhcpOption) String() string
type ElementAction ¶ added in v4.4.0
ElementAction defines an action to take on an Element
func (*ElementAction) String ¶ added in v4.4.0
func (ea *ElementAction) String() string
type Endpoint ¶ added in v4.4.0
type Endpoint struct { Validation Access Meta Owned Bundled Id string Description string `json:"Description,omitempty"` Documentation string `json:"Documentation,omitempty"` // Holds the access parameters. Params map[string]interface{} `json:"Params,omitempty"` ConnectionStatus string `json:"ConnectionStatus,omitempty"` // Deprecated VersionSet string `json:"VersionSet,omitempty"` // VersionSets replaces VersionSet - code processes both VersionSets []string `json:"VersionSets,omitempty"` Apply bool `json:"Apply,omitempty"` HaId string `json:"HaId,omitempty"` Arch string `json:"Arch,omitempty"` Os string `json:"Os,omitempty"` DRPVersion string `json:"DRPVersion,omitempty"` DRPUXVersion string `json:"DRPUXVersion,omitempty"` Components []*Element `json:"Components,omitempty"` Plugins []*Plugin `json:"Plugins,omitempty"` Prefs map[string]string `json:"Prefs,omitempty"` Global map[string]interface{} `json:"Global,omitempty"` Actions []*ElementAction `json:"Actions,omitempty"` }
Endpoint represents a managed Endpoint swagger:model
func (*Endpoint) CanHaveActions ¶ added in v4.4.0
CanHaveActions indicates that the model can have actions
func (*Endpoint) GetDescription ¶ added in v4.4.0
GetDescription returns the models Description
func (*Endpoint) GetParams ¶ added in v4.4.0
GetParams returns the parameters on the Endpoint The returned map is a shallow copy.
func (*Endpoint) KeyName ¶ added in v4.4.0
KeyName returns the name of the field that is the key for this object
func (*Endpoint) SetParams ¶ added in v4.4.0
SetParams replaces the current parameters with a shallow copy of the input map.
func (*Endpoint) SliceOf ¶ added in v4.4.0
func (e *Endpoint) SliceOf() interface{}
SliceOf returns a slice of the model
type Error ¶
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 the API returns for any error conditions.
swagger:model
func (*Error) ContainsError ¶
type ErrorAdder ¶
ErrorAdder is an interface that the various models that can collect errors for later repoting can satisfy.
type Event ¶
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 // Principal - the user or subsystem that caused the event to be emitted Principal string // Object - the data of the object. Object interface{} // Original - the data of the object before the operation (update and save only) Original interface{} }
Event represents an action in the system. In general, the event generates for a subject of the form: type.action.key
swagger:model
type Filler ¶
type Filler interface { Model Fill() }
Filler interface defines if a model can be filled/initialized
type HaPassiveState ¶ added in v4.3.0
type HaPassiveState struct { // required: true Id string `json:"id"` // required: true Address string `json:"address"` // required: true State string `json:"state"` }
HaPassiveState the state of the passive node
swagger:model
type Index ¶
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 // Unordered tells you whether this index cannot be sorted. Unordered bool // Regex indecates whether you can use the Re filter with this index Regex bool }
Index holds details on the index swagger:model
type Info ¶
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 LocalId string `json:"local_id"` // required: true HaId string `json:"ha_id"` // required: true ApiPort int `json:"api_port"` // required: true FilePort int `json:"file_port"` // required: true DhcpPort int `json:"dhcp_port"` // required: true BinlPort int `json:"binl_port"` // required: true TftpPort int `json:"tftp_port"` // required: true TftpEnabled bool `json:"tftp_enabled"` // required: true DhcpEnabled bool `json:"dhcp_enabled"` // required: true BinlEnabled bool `json:"binl_enabled"` // required: true ProvisionerEnabled bool `json:"prov_enabled"` // required: true Address net.IP `json:"address"` // required: true Manager bool `json:"manager"` // required: true Stats []Stat `json:"stats"` Features []string `json:"features"` Scopes map[string]map[string]struct{} `json:"scopes"` License LicenseBundle // Errors returns the current system errors. // required: true Errors []string `json:"errors"` // HaEnabled indicates if High Availability is enabled HaEnabled bool `json:"ha_enabled"` // HaVirtualAddress is the Virtual IP Address of the systems HaVirtualAddress string `json:"ha_virtual_address"` // HaIsActive indicates Active (true) or Passive (false) // required: true HaIsActive bool `json:"ha_is_active"` // HaStatus indicates current state // For Active, Up is the only value. // For Passive, Connecting, Syncing, In-Sync // required: true HaStatus string `json:"ha_status"` // HaActiveId is the id of current active node HaActiveId string `json:"ha_active_id"` // HaPassiveState is a list of passive node's and their current state // This is only valid from the Active node HaPassiveState []*HaPassiveState `json:"ha_passive_state"` }
Info contains information on how the running instance of dr-provision is configured.
For passive nodes, the license, scopes, and stats are not filled in.
swagger:model
func (*Info) AddUpdatePassive ¶ added in v4.3.0
func (*Info) HasFeature ¶
HasFeature is a helper function to determine if a requested feature is present.
func (*Info) RemovePassive ¶ added in v4.3.0
type Interface ¶
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 // Possible gateway for this interface Gateway string // Possible DNS for this interface DnsServers []string // Possible DNS for domain for this interface DnsDomain string }
Interface represents a network interface that is present on the server running dr-provision. It is primarily used by the UX to help generate Subnets.
swagger:model
type Job ¶
type Job struct { Validation Access Meta Owned Bundled // 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 // Context is the context the job was created to run in. Context 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 started running. StartTime time.Time // The time the job failed or finished. EndTime time.Time // Archived indicates whether the complete log for the job can be // retrieved via the API. If Archived is true, then the log cannot // be retrieved. // // required: true Archived bool // Whether the job is the "current one" for the machine or if it has been superceded. // // required: true Current bool // The current index is the machine CurrentTask that created this job. // // required: true // read only: true CurrentIndex int // The next task index that should be run when this job finishes. It is used // in conjunction with the machine CurrentTask to implement the server side of the // machine agent state machine. // // required: true // read only: true NextIndex int // The workflow that the task was created in. // read only: true Workflow string // The bootenv that the task was created in. // read only: true BootEnv string // ExtraClaims is the expanded list of extra Claims that were added to the // default machine Claims via the ExtraRoles field on the Task that the Job // was created to run. ExtraClaims []*Claim `json:"ExtraClaims,omitempty"` // Token is the JWT token that should be used when running this Job. If not // present or empty, the Agent running the Job will use its ambient Token // instead. If set, the Token will only be valid for the current Job. Token string `json:"Token, omitempty"` }
Job contains information on a Job that is running for a specific Task on a Machine.
swagger:model
func (*Job) CanHaveActions ¶
type JobAction ¶
type JobAction struct { // required: true Name string // required: true Path string // required: true Content string // required: true Meta map[string]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
func (*JobAction) ValidForOS ¶
type JobActions ¶
type JobActions []*JobAction
func (JobActions) FilterOS ¶
func (ja JobActions) FilterOS(forOS string) JobActions
type Lease ¶
type Lease struct { Validation Access Meta Owned Bundled // Addr is the IP address that the lease handed out. // // required: true // swagger:strfmt ipv4 Addr net.IP // NextServer is the IP address that we should have the machine talk to // next. In most cases, this will be our address. // // required: false // swagger:strfmt ipv4 NextServer net.IP // Via is the IP address used to select which subnet the lease belongs to. // It is either an address present on a local interface that dr-provision is // listening on, or the GIADDR field of the DHCP request. // // required: false // swagger:strfmt ipv4 Via net.IP // Token is the unique token for this lease based on the // Strategy this lease used. // // required: true Token string // Duration is the time in seconds for which a lease can be valid. // ExpireTime is calculated from Duration. Duration int32 // 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 // Options are the DHCP options that the Lease is running with. Options []DhcpOption // ProvidedOptions are the DHCP options the last Discover or Offer packet // for this lease provided to us. ProvidedOptions []DhcpOption // SkipBoot indicates that the DHCP system is allowed to offer // boot options for whatever boot protocol the machine wants to // use. // // read only: true SkipBoot bool }
Lease tracks DHCP leases. swagger:model
func (*Lease) CanHaveActions ¶
func (*Lease) Invalidate ¶
func (l *Lease) Invalidate()
type License ¶
type License struct { Name string Version string Data interface{} PurchaseDate time.Time StartDate time.Time SoftExpireDate time.Time HardExpireDate time.Time ShortLicense string LongLicense string Active, Expired bool }
License is used to authorize acess to extended dr-provision features and functionality.
type LicenseBundle ¶
type LicenseBundle struct { Contact string ContactEmail string ContactId string Owner string OwnerEmail string OwnerId string Grantor string GrantorEmail string Version string GenerationVersion string Endpoints []string `json:",omitempty"` // MaxDrpVersion is the highest major/minor version to allow. // For example, v4.3 would mean any v4.3.* release or previous. MaxDrpVersion string Licenses []License }
LicenseBundle is a collection of Licenses.
type Machine ¶
type Machine struct { Validation Access Meta Owned Bundled Partialed // 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. // Address is updated automatically by the DHCP system if // HardwareAddrs is filled out. // // swagger:strfmt ipv4 Address net.IP // The stage that the Machine is currently in. If Workflow is also // set, this field is read-only, otherwise changing it will change // the Stage the system is in. 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 Parameters that have been directly set on the Machine. Params map[string]interface{} // The tasks this machine has to run. Tasks []string // The index into the Tasks list for the task that is currently // running (if a task is running) or the next task that will run (if // no task is currently running). If -1, then the first task will // run next, and if it is equal to the length of the Tasks list then // all the tasks have finished running. // // required: true CurrentTask int // This tracks the number of retry attempts for the current task. // When a task succeeds, the retry value is reset. RetryTaskAttempt int // This list of previous task lists and current tasks to handle errors. // Upon completing the list, the previous task list will be executed. // // This will be capped to a depth of 1. Error failures are not handled can not be handled. TaskErrorStacks []*TaskStack // 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. It is updated by Sledgehammer and by // the various OS install tasks. // OS string // HardwareAddrs is a list of MAC addresses we expect that the system might boot from. // This must be filled out to enable MAC address based booting from the various bootenvs, // and must be updated if the MAC addresses for a system change for whatever reason. // HardwareAddrs []string // Workflow is the workflow that is currently responsible for processing machine tasks. // // required: true Workflow string // Arch is the machine architecture. It should be an arch that can // be fed into $GOARCH. // // required: true Arch string // Locked indicates that changes to the Machine by users are not // allowed, except for unlocking the machine, which will always // generate an Audit event. // // required: true Locked bool // Contexts contains the name of the current execution context for the machine. // An empty string indicates that the agent running on the machine should be executing tasks, // and any other value means that an agent running with its context set for this value should // be executing tasks. Context string // Fingerprint is a collection of data that can (in theory) be used to uniquely identify // a machine based on various DMI information. This (in conjunction with HardwareAddrs) // is used to uniquely identify a Machine using a score based on how many total items in the Fingerprint // match. Fingerprint MachineFingerprint // Pool contains the pool the machine is in. // Unset machines will join the default Pool Pool string // PoolAllocated defines if the machine is allocated in this pool // This is a calculated field. PoolAllocated bool // PoolStatus contains the status of this machine in the Pool. // Values are defined in Pool.PoolStatuses PoolStatus PoolStatus // WorkflowCopmlete indicates if the workflow is complete WorkflowComplete bool }
Machine represents a single bare-metal system that the provisioner should manage the boot environment for. swagger:model
func (*Machine) AddTasks ¶
AddTasks is a helper for adding tasks to the machine Tasks list in the mutable present.
func (*Machine) CanHaveActions ¶
func (*Machine) GetDescription ¶ added in v4.1.0
func (*Machine) RunningTask ¶
func (*Machine) SetBootEnv ¶
func (*Machine) SetProfiles ¶
func (*Machine) SplitTasks ¶
SplitTasks slits the machine's Tasks list into 3 subsets:
1. the immutable past, which cannot be chnaged by task list modification
2. The mutable present, which contains tasks that can be deleted, and where tasks can be added.
3. The immutable future, which also cannot be changed.
type MachineFingerprint ¶ added in v4.3.0
type MachineFingerprint struct { // DMI.System.Manufacturer + DMI.System.ProductName + DMI.System.SerialNumber, SHA256 hashed // Hash must not be zero-length to match. 25 points SSNHash []byte // DMI.System.Manufacturer + DMI.System.ProductName + DMI.Chassis[0].SerialNumber, SHA256 hashed // Hash must not be zero-length to match. 25 points CSNHash []byte // DMI.System.UUID, not hashed. Must be non zero length and must be a non-zero UUID. 50 point match SystemUUID string // MemoryIds is an array of SHA256sums if the following fields in each // entry of the DMI.Memory.Devices array concatenated together: // * Manufacturer // * PartNumber // * SerialNumber // Each hash must not be zero length // Score is % matched. MemoryIds [][]byte }
func (*MachineFingerprint) Fill ¶ added in v4.3.0
func (m *MachineFingerprint) Fill()
type Meta ¶
Meta holds information about arbitrary things. Initial usage will be for UX elements.
swagger: model
func (Meta) AddFeature ¶
func (Meta) ClearFeatures ¶
func (m Meta) ClearFeatures()
func (Meta) HasFeature ¶
func (Meta) MergeFeatures ¶
func (Meta) RemoveFeature ¶
type ModTimeSha ¶ added in v4.3.0
func (*ModTimeSha) MarshalBinary ¶ added in v4.3.0
func (m *ModTimeSha) MarshalBinary() ([]byte, error)
func (*ModTimeSha) ReadFromXattr ¶ added in v4.3.0
func (m *ModTimeSha) ReadFromXattr(fi *os.File) error
func (*ModTimeSha) Regenerate ¶ added in v4.4.0
func (m *ModTimeSha) Regenerate(fi *os.File) (bool, error)
func (*ModTimeSha) SaveToXattr ¶ added in v4.3.0
func (m *ModTimeSha) SaveToXattr(fi *os.File) error
func (*ModTimeSha) String ¶ added in v4.3.0
func (m *ModTimeSha) String() string
func (*ModTimeSha) UnmarshalBinary ¶ added in v4.3.0
func (m *ModTimeSha) UnmarshalBinary(buf []byte) error
type Model ¶
Model is the interface that pretty much all non-Error objects returned by the API satisfy.
type NameSetter ¶
NameSetter interface if the model can change names
type OsInfo ¶
type OsInfo struct { // The name of the OS this BootEnv has. It should be formatted as // family-version. // // 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. If // non-empty, this is assumed to be for the amd64 hardware // architecture. IsoFile string // The SHA256 of the ISO file. Used to check for corrupt downloads. // If non-empty, this is assumed to be for the amd64 hardware // architecture. IsoSha256 string // The URL that the ISO can be downloaded from, if any. If // non-empty, this is assumed to be for the amd64 hardware // architecture. // // swagger:strfmt uri IsoUrl string // SupportedArchitectures maps from hardware architecture (named // according to the distro architecture naming scheme) to the // architecture-specific parameters for this OS. If // SupportedArchitectures is left empty, then the system assumes // that the BootEnv only supports amd64 platforms. SupportedArchitectures map[string]ArchInfo }
OsInfo holds information about the operating system this BootEnv maps to. Most of this information is optional for now. swagger:model
func (OsInfo) FamilyName ¶
FamilyName is a helper that figures out the family (read: distro name) of the OS. It uses Family if set, the first part of the Name otherwise.
func (OsInfo) FamilyType ¶
FamilyType figures out the lineage of the OS. If the OS is descended from RHEL, then "rhel" is returned. If the OS is descended from Debian, then "debian" is returned, otherwise FamilyName() is returned. Return values of this function are subject to change as support for new distros is brought onboard.
func (OsInfo) FamilyVersion ¶
FamilyVersion figures out the version of the OS. It returns the Version field if set, and the second part of the OS name if not set. This should be a Semver-ish version string, not a codename, release name, or similar item.
type Owned ¶
type Owned struct { // Endpoint tracks the owner of the object amoung DRP endpoints // read only: true Endpoint string }
Owned holds the info about which DRP Endpoint owns this object
swagger: model
func (*Owned) GetEndpoint ¶
GetEndpoint returns the name of the owning DRP Endpoint
func (*Owned) SetEndpoint ¶
SetEndpoint sets the model's Endpoint
type Owner ¶
model object may define a GetEndpoint() method that can be used to return the owner for the object
type Param ¶
type Param struct { Validation Access Meta Owned Bundled // 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 // Secure implies that any API interactions with this Param // will deal with SecureData values. // // required: true Secure bool // 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) DefaultValue ¶
func (*Param) GetDescription ¶ added in v4.1.0
func (*Param) GetDocumentation ¶
type Paramer ¶
type Paramer interface { Model GetParams() map[string]interface{} SetParams(map[string]interface{}) }
Paramer interface defines if the model has parameters
type Partialed ¶
type Partialed struct { // Partial tracks if the object is not complete when returned. // read only: true Partial bool }
Partialed holds if the object is partially filled in.
swagger: model
func (*Partialed) IsPartial ¶
IsPartial returns whether the object is partially returned. This will be set if the object has been slimmed or partially returned.
func (*Partialed) SetPartial ¶
func (p *Partialed) SetPartial()
type Partialer ¶
type Partialer interface { IsPartial() bool SetPartial() }
Partialer is an interface that objects that are partially returned.
type Plugin ¶
type Plugin struct { Validation Access Meta Owned Bundled Partialed // 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 // Documentation of this plugin. This should tell what // the plugin is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation 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) CanHaveActions ¶
func (*Plugin) GetDescription ¶ added in v4.1.0
func (*Plugin) GetDocumentation ¶
type PluginProvider ¶
type PluginProvider struct { Meta // Name is the unique name of the PluginProvider. // Each Plugin provider must have a unique Name. Name string // The version of the PluginProvider. This is a semver compatible string. Version string // This is used to indicate what version the plugin is built for // This is effectively the API version of the protocol that // plugin providers use to communicate with dr-provision. // Right now, all plugin providers must set this to version 4, // which is the only supported protocol version. PluginVersion int // If AutoStart is true, a Plugin will be created for this // Provider at provider definition time, if one is not already present. AutoStart bool // HasPlugin is deprecated, plugin provider binaries should use a websocket // event stream instead. HasPublish bool // AvailableActions lists the actions that this PluginProvider // can take. AvailableActions []AvailableAction // RequiredParams and OptionalParams // are Params that must be present on a Plugin for the Provider // to operate. RequiredParams []string OptionalParams []string // Object prefixes that can be accessed by this plugin. // The interface can be empty struct{} or a JSONSchema draft v4 // This allows PluginProviders to define custom Object types that dr-provision will // store and check the validity of. StoreObjects map[string]interface{} // Documentation of this plugin provider. This should tell what // the plugin provider is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation string // 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) AutoPlugin ¶
func (p *PluginProvider) AutoPlugin() *Plugin
AutoPlugin - builds a plugin model if auto start is true, otherwise nil
func (*PluginProvider) Fill ¶
func (p *PluginProvider) Fill()
func (*PluginProvider) GetDocumentation ¶
func (p *PluginProvider) GetDocumentation() string
func (*PluginProvider) GetMeta ¶
func (p *PluginProvider) GetMeta() Meta
func (*PluginProvider) Key ¶
func (p *PluginProvider) Key() string
func (*PluginProvider) KeyName ¶
func (p *PluginProvider) KeyName() string
func (*PluginProvider) Prefix ¶
func (p *PluginProvider) Prefix() string
func (*PluginProvider) SetMeta ¶
func (p *PluginProvider) SetMeta(d Meta)
func (*PluginProvider) SliceOf ¶
func (p *PluginProvider) SliceOf() interface{}
func (*PluginProvider) Store ¶
func (p *PluginProvider) Store() (store.Store, error)
Store extracts the content bundle in the Content field of the PluginProvider into a Store.
func (*PluginProvider) ToModels ¶
func (p *PluginProvider) ToModels(obj interface{}) []Model
type PluginProviderUploadInfo ¶
swagger:model
type Pool ¶ added in v4.4.0
type Pool struct { Validation Access Meta Owned Bundled Id string Description string `json:",omitempty"` Documentation string `json:",omitempty"` ParentPool string `json:",omitempty"` EnterActions *PoolTransitionActions `json:",omitempty"` ExitActions *PoolTransitionActions `json:",omitempty"` AllocateActions *PoolTransitionActions `json:",omitempty"` ReleaseActions *PoolTransitionActions `json:",omitempty"` AutoFill *PoolAutoFill `json:",omitempty"` }
* Pool defines the basics of the pool. This is a static object * that can be shared through content packs and version sets. * * Membership is dynamic and truth is from the machines' state. * * The transition actions are used on machines moving through the * pool (into and out of, allocated and released). * EnterActions * ExitActions * AllocateActions * ReleaseActions * * Params are used to provide default values. * * AutoFill Parameters are: * UseAutoFill bool * MinFree int32 * MaxFree int32 * CreateParameters map[string]interface{} * AcquirePool string
func (*Pool) CanHaveActions ¶ added in v4.4.0
func (*Pool) GetDescription ¶ added in v4.4.0
func (*Pool) GetDocumentation ¶ added in v4.4.0
type PoolAutoFill ¶ added in v4.4.0
type PoolAutoFill struct { UseAutoFill bool `json:"UseAutoFill,omitempty"` MinFree int32 `json:"MinFree,omitempty"` MaxFree int32 `json:"MaxFree,omitempty"` CreateParameters map[string]interface{} `json:"CreateParameters,omitempty"` AcquirePool string `json:"AcquirePool,omitempty"` ReturnPool string `json:"ReturnPool,omitempty"` }
PoolAutoFill are rules for dynamic pool sizing
type PoolResult ¶ added in v4.4.0
type PoolResult struct { Name string Uuid string Allocated bool Status PoolStatus }
PoolResult is the common return structure most operations
type PoolResults ¶ added in v4.4.0
type PoolResults map[PoolStatus][]*PoolResult
PoolResults is dynamically built provide membership and status.
type PoolStatus ¶ added in v4.4.0
type PoolStatus string
type PoolTransitionActions ¶ added in v4.4.0
type PoolTransitionActions struct { Workflow string `json:",omitempty"` AddProfiles []string `json:",omitempty"` AddParameters map[string]interface{} `json:",omitempty"` RemoveProfiles []string `json:",omitempty"` RemoveParameters []string `json:",omitempty"` }
PoolTransitionActions define the default actions that should happen to a machine upon movement through the pool.
type Pref ¶
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.
type Profile ¶
type Profile struct { Validation Access Meta Owned Bundled Partialed // 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 // Documentation of this profile. This should tell what // the profile is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation 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{} // Additional Profiles that should be considered for parameters Profiles []string }
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) CanHaveActions ¶
CanHaveActions indicates if the object is allowed to have actions
func (*Profile) GetDescription ¶ added in v4.1.0
GetDescription returns the object's description
func (*Profile) GetDocumentation ¶ added in v4.1.0
GetDocumentation returns the object's documentation
func (*Profile) GetParams ¶
GetParams returns the current parameters for this profile matches Paramer interface
func (*Profile) GetProfiles ¶ added in v4.0.18
GetProfiles returns the profiles on this profile
func (*Profile) SetParams ¶
SetParams sets the current parameters for this profile matches Paramer interface
func (*Profile) SetProfiles ¶ added in v4.0.18
SetProfiles sets the profiles on this profile
func (*Profile) SliceOf ¶
func (p *Profile) SliceOf() interface{}
SliceOf returns an empty slice of this type of objects
type RawModel ¶
type RawModel map[string]interface{}
RawModel is a raw model that Plugins can specialize to save custom data in the dr-provision backing store.
func (*RawModel) CanHaveActions ¶
func (*RawModel) ChangeForced ¶
func (*RawModel) ClearValidation ¶
func (r *RawModel) ClearValidation()
func (*RawModel) ForceChange ¶
func (r *RawModel) ForceChange()
func (*RawModel) GetStringField ¶
Helpers to get fields
func (*RawModel) IsAvailable ¶
func (*RawModel) RestoreValidation ¶
func (*RawModel) SaveValidation ¶
func (r *RawModel) SaveValidation() *Validation
Validator Interface
func (*RawModel) SetAvailable ¶
func (*RawModel) SetEndpoint ¶
func (*RawModel) SetInvalid ¶
func (*RawModel) SetPartial ¶
func (r *RawModel) SetPartial()
type Reservation ¶
type Reservation struct { Validation Access Meta Owned Bundled // Addr is the IP address permanently assigned to the strategy/token combination. // // required: true // swagger:strfmt ipv4 Addr net.IP // A description of this Reservation. This should tell what it is for, // any special considerations that should be taken into account when // using it, etc. Description string // Documentation of this reservation. This should tell what // the reservation is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation string // Token is the unique identifier that the strategy for this Reservation should use. // // required: true Token string // Subnet is the name of the Subnet that this Reservation is associated with. // This property is read-only. // Subnet string // NextServer is the address the server should contact next. You // should only set this if you want to talk to a DHCP or TFTP server // other than the one provided by dr-provision. // // 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 // Scoped indicates that this reservation is tied to a particular Subnet, // as determined by the reservation's Addr. // // required: true Scoped bool // Duration is the time in seconds for which a lease can be valid. // ExpireTime is calculated from Duration. Duration int32 }
Reservation tracks persistent DHCP IP address reservations.
swagger:model
func (*Reservation) AuthKey ¶
func (r *Reservation) AuthKey() string
func (*Reservation) CanHaveActions ¶
func (r *Reservation) CanHaveActions() bool
func (*Reservation) Fill ¶
func (r *Reservation) Fill()
func (*Reservation) GetDescription ¶ added in v4.1.0
func (r *Reservation) GetDescription() string
GetDescription returns the object's description
func (*Reservation) GetDocumentation ¶
func (r *Reservation) GetDocumentation() string
GetDocumentation returns the object's documentation
func (*Reservation) GetMeta ¶
func (r *Reservation) GetMeta() Meta
func (*Reservation) Key ¶
func (r *Reservation) Key() string
func (*Reservation) KeyName ¶
func (r *Reservation) KeyName() string
func (*Reservation) Prefix ¶
func (r *Reservation) Prefix() string
func (*Reservation) SetMeta ¶
func (r *Reservation) SetMeta(d Meta)
func (*Reservation) SliceOf ¶
func (r *Reservation) SliceOf() interface{}
func (*Reservation) ToModels ¶
func (r *Reservation) ToModels(obj interface{}) []Model
type Role ¶
type Role struct { Validation Access Meta Owned Bundled // Name is the name of the user // // required: true Name string // Claims that the role support. Claims []*Claim // Description of role Description string // Documentation of this role. This should tell what // the role is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation string }
Role is used to determine which operations on which API endpoints are permitted.
swagger:model
func (*Role) Contains ¶
Role a contains role b if a can be used to satisfy all requests b can satisfy
func (*Role) GetDescription ¶ added in v4.1.0
GetDescription returns the object's Description
func (*Role) GetDocumentation ¶
GetDocumentaiton returns the object's Documentation
type SecureData ¶
type SecureData struct { // Key is the ephemeral public key created by Seal(). It must not // be modified after Seal() has completed, and it must be 32 bytes // long. Key []byte // Nonce must be 24 bytes of cryptographically random numbers. It is // populated by Seal(), and must not be modified afterwards. Nonce []byte // Payload is the encrypted payload generated by Seal(). It must // not be modified, and will be 16 bytes longer than the unencrypted // data. Payload []byte }
SecureData is used to store and send access controlled Param values to the locations they are needed at. SecureData uses a simple encryption mechanism based on the NACL Box API (as implemented by libsodium, golang.org/x/crypto/nacl/box, and many others).
All fields in this struct will be marshalled into JSON as base64 encoded strings.
swagger:model
func (*SecureData) Marshal ¶
func (s *SecureData) Marshal(peerPublicKey []byte, data interface{}) error
Marshal marshals the passed-in data into JSON and calls Seal() with peerPublicKey and the marshalled data.
func (*SecureData) Open ¶
func (s *SecureData) Open(targetPrivateKey *[32]byte) ([]byte, error)
Open opens a sealed SecureData item. It takes the private key that matches the peerPublicKey passed to the Seal() operation. If the SecureData object has not been corrupted or tampered with, Open() will return the decrypted data , otherwise it will return an error.
Open performs the following operations internally:
- Validate that the lengths of all the fields of the SecureData struct are within expected ranges. This is not required for correctness, but it alows us to return nicer errors.
- Extract the stored ephemeral public key and nonce from the SecureData object.
- Decrypt Payload using the extracted nonce, the extracted public key, and the passed-in private key.
- If any errors were returned in the decrypt process, return a Corrupt error, otherwise return the decrypted data.
func (*SecureData) Seal ¶
func (s *SecureData) Seal(peerPublicKey *[32]byte, data []byte) error
Seal takes curve25519 public key advertised by where the payload should be stored, and fills in the SecureData with the data required for the Open operation to succeed.
Seal performs the following operations internally:
- Generate ephemeral cuve25519 public and private keys from the system's cryptographically secure random number generator.
- Generate a 24 byte nonce from the same random number generator used to create the keys.
- Encrypt the data using the peer public key, the ephemeral private key, and the generated nonce.
- Populate s.Key with the ephemeral public key, s.Nonce with the generated nonce, and s.Payload with the encrypted data.
func (*SecureData) Unmarshal ¶
func (s *SecureData) Unmarshal(targetPrivateKey []byte, res interface{}) error
func (*SecureData) Validate ¶
func (s *SecureData) Validate() error
Validate makes sure that the lengths we expect for the Key and Nonce are correct.
type Stage ¶
type Stage struct { Validation Access Meta Owned Bundled Partialed // The name of the stage. // // required: true Name string // A description of this stage. This should tell what it is for, // any special considerations that should be taken into account when // using it, etc. Description string // Documentation of this stage. This should tell what // the stage is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation string // The templates that should be expanded into files for the stage. // // required: true Templates []TemplateInfo // The list of extra required parameters for this // stage. They should be present as Machine.Params when // the stage is applied to the machine. // // required: true RequiredParams []string // The list of extra optional parameters for this // stage. They can be present as Machine.Params when // the stage is applied to the machine. These are more // other consumers of the stage to know what parameters // could additionally be applied to the stage by the // renderer based upon the Machine.Params // OptionalParams []string // Params contains parameters for the stage. // This allows the machine to access these values while in this stage. Params map[string]interface{} // 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 // This flag is deprecated and will always be TRUE. RunnerWait bool }
Stage encapsulates a set of tasks and profiles to apply to a Machine in a BootEnv.
swagger:model
func (*Stage) CanHaveActions ¶
CanHaveActions returns if the object can have actions from plugins
func (*Stage) GetBootEnv ¶
GetBootEnv gets the name of the bootenv on this stage
func (*Stage) GetDescription ¶ added in v4.1.0
GetDescription returns the object's Description
func (*Stage) GetDocumentation ¶
GetDocumentaiton returns the object's Documentation
func (*Stage) GetProfiles ¶
GetProfiles gets the profiles on this stage
func (*Stage) SetBootEnv ¶
SetBootEnv sets the bootenv on the stage
func (*Stage) SetProfiles ¶
SetProfiles sets the profiles on this stage
func (*Stage) SliceOf ¶
func (s *Stage) SliceOf() interface{}
SliceOf returns an empty slice of this type of objects
type Stat ¶
type Stat struct { // required: true Name string `json:"name"` // required: true Count int `json:"count"` }
Stat contains a basic statistic sbout dr-provision
swagger:model
type Subnet ¶
type Subnet struct { Validation Access Meta Owned Bundled // Name is the name of the subnet. // Subnet names must be unique // // required: true Name string // A description of this Subnet. This should tell what it is for, // any special considerations that should be taken into account when // using it, etc. Description string // Documentation of this subnet. This should tell what // the subnet is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation 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. It is an error for Proxy and Unmanaged to be // true. // // required: true Proxy bool // Unmanaged indicates that dr-provision will never send // boot-related options to machines that get leases from this // subnet. If false, dr-provision will send whatever boot-related // options it would normally send. It is an error for Unmanaged and // Proxy to both be true. // // required: true Unmanaged 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 in the DHCP/TFTP/PXE // chain. You should only set this if you want to transfer control // to a different DHCP or TFTP 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 any // remaining 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) CanHaveActions ¶
func (*Subnet) GetDescription ¶ added in v4.1.0
GetDescription returns the object's Description
func (*Subnet) GetDocumentation ¶
GetDocumentaiton returns the object's Documentation
type Task ¶
type Task struct { Validation Access Meta Owned Bundled // 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 // Prerequisites are tasks that must have been run in the current // BootEnv before this task can be run. Prerequisites []string // ExtraRoles is a list of Roles whose Claims should be added to the default // set of allowable Claims when a Job based on this task is running. ExtraRoles []string `json:"ExtraRoles,omitempty"` // ExtraClaims is a raw list of Claims that should be added to the default // set of allowable Claims when a Job based on this task is running. // Any extra claims added here will be added _after_ any added by ExtraRoles ExtraClaims []*Claim `json:"ExtraClaims,omitempty"` }
Task is a thing that can run on a Machine.
swagger:model
func (*Task) CanHaveActions ¶
func (*Task) GetDescription ¶ added in v4.1.0
GetDescription returns the object's Description
func (*Task) GetDocumentation ¶
GetDocumentaiton returns the object's Documentation
type TaskRunner ¶
TaskRunner interface defines if the object can run tasks
type TaskStack ¶ added in v4.3.1
TaskStack contains an task stack for a machine. This is used by the error handling code pieces.
type Template ¶
type Template struct { Validation Access Meta Owned Bundled // 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) CanHaveActions ¶
func (*Template) GetDescription ¶ added in v4.1.0
GetDescription returns the object's Description
type TemplateInfo ¶
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 // Link optionally references another file to put at // the path location. Link string // ID of the template that should be expanded. Either // this or Contents should be set // // required: false ID string // Contents that should be used when this template needs // to be expanded. Either this or ID should be set. // // required: false Contents string // Meta for the TemplateInfo. This can be used by the job running // system and the bootenvs to handle OS, arch, and firmware differences. // // required: false Meta map[string]string PathTmpl *template.Template `json:"-"` LinkTmpl *template.Template `json:"-"` }
TemplateInfo holds information on the templates in the boot environment that will be expanded into files.
swagger:model
func (*TemplateInfo) Id ¶
func (ti *TemplateInfo) Id() string
func (*TemplateInfo) LinkTemplate ¶ added in v4.3.0
func (ti *TemplateInfo) LinkTemplate() *template.Template
func (*TemplateInfo) PathTemplate ¶
func (ti *TemplateInfo) PathTemplate() *template.Template
func (*TemplateInfo) SanityCheck ¶
func (ti *TemplateInfo) SanityCheck(idx int, e ErrorAdder, missingPathOK bool)
type Tenant ¶
type Tenant struct { Validation Access Meta Owned Bundled Name string Description string // Documentation of this tenant. This should tell what // the tenant is for, any special considerations that // should be taken into account when using it, etc. in rich structured text (rst). Documentation string Members map[string][]string Users []string }
swagger:model
func (*Tenant) GetDescription ¶ added in v4.1.0
GetDescription returns the object's Description
func (*Tenant) GetDocumentation ¶
GetDocumentaiton returns the object's Documentation
type User ¶
type User struct { Validation Access Meta Owned Bundled // Name is the name of the user // // required: true Name string // Description of user Description 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 // Roles is a list of Roles this User has. // Roles []string }
User is an API user of DigitalRebar Provision swagger:model
func (*User) CanHaveActions ¶
func (*User) ChangePassword ¶
func (*User) CheckPassword ¶
func (*User) GetDescription ¶ added in v4.1.0
GetDescription returns the object's Description
type UserToken ¶
UserToken is an auth token for a specific User. The Token section can be used for bearer authentication.
swagger:model
type ValidateSetter ¶
type Validation ¶
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 ¶
func (v *Validation) AddError(err error)
func (*Validation) ChangeForced ¶
func (v *Validation) ChangeForced() bool
func (*Validation) ClearValidation ¶
func (v *Validation) ClearValidation()
func (*Validation) Error ¶
func (v *Validation) Error() string
func (*Validation) Errorf ¶
func (v *Validation) Errorf(fmtStr string, args ...interface{})
func (*Validation) ForceChange ¶
func (v *Validation) ForceChange()
func (*Validation) HasError ¶
func (v *Validation) HasError() error
func (*Validation) IsAvailable ¶
func (v *Validation) IsAvailable() bool
func (*Validation) MakeError ¶
func (v *Validation) MakeError(code int, errType string, obj Model) error
func (*Validation) RestoreValidation ¶
func (v *Validation) RestoreValidation(ov *Validation)
func (*Validation) SaveValidation ¶
func (v *Validation) SaveValidation() *Validation
func (*Validation) SetAvailable ¶
func (v *Validation) SetAvailable() bool
func (*Validation) SetInvalid ¶
func (v *Validation) SetInvalid() bool
func (*Validation) SetValid ¶
func (v *Validation) SetValid() bool
func (*Validation) Useable ¶
func (v *Validation) Useable() bool
type Validator ¶
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.
type VersionSet ¶ added in v4.4.0
type VersionSet struct { Validation Access Meta Owned Bundled Id string Documentation string Description string Apply bool DRPVersion string DRPUXVersion string Components []*Element Plugins []*Plugin Prefs map[string]string Files []*FileData Global map[string]interface{} }
VersionSet structure that handles RawModel instead of dealing with RawModel which is how DRP is storing it.
An element with Version = ignore means leave it loaded.
func (*VersionSet) AuthKey ¶ added in v4.4.0
func (vs *VersionSet) AuthKey() string
func (*VersionSet) CanHaveActions ¶ added in v4.4.0
func (vs *VersionSet) CanHaveActions() bool
func (*VersionSet) Clone ¶ added in v4.4.0
func (vs *VersionSet) Clone() *VersionSet
Clone the VersionSet
func (*VersionSet) Fill ¶ added in v4.4.0
func (vs *VersionSet) Fill()
func (*VersionSet) GetDescription ¶ added in v4.4.0
func (vs *VersionSet) GetDescription() string
GetDescription returns the object's Description
func (*VersionSet) GetDocumentation ¶ added in v4.4.0
func (vs *VersionSet) GetDocumentation() string
GetDocumentaiton returns the object's Documentation
func (*VersionSet) Key ¶ added in v4.4.0
func (vs *VersionSet) Key() string
func (*VersionSet) KeyName ¶ added in v4.4.0
func (vs *VersionSet) KeyName() string
func (*VersionSet) Merge ¶ added in v4.4.0
func (vs *VersionSet) Merge(nvs *VersionSet)
func (*VersionSet) Prefix ¶ added in v4.4.0
func (vs *VersionSet) Prefix() string
func (*VersionSet) SetName ¶ added in v4.4.0
func (vs *VersionSet) SetName(name string)
SetName sets the name. In this case, it sets Id.
func (*VersionSet) SliceOf ¶ added in v4.4.0
func (vs *VersionSet) SliceOf() interface{}
func (*VersionSet) ToModels ¶ added in v4.4.0
func (vs *VersionSet) ToModels(obj interface{}) []Model
type Whoami ¶ added in v4.3.0
type Whoami struct { Result struct { Score int `json:",omitempty"` Uuid uuid.UUID `json:",omitempty"` Token string `json:",omitempty"` } Fingerprint MachineFingerprint MacAddrs []string OnDiskUUID string }
Whoami contains the elements used toi fingerprint a machine, along with the results of the fingerprint comparison request
func (*Whoami) Fill ¶ added in v4.3.0
Fill fills out the MacAddrs list and the MachineFingerprint from the DMI information on the machine.
func (*Whoami) FromMachine ¶ added in v4.3.0
FromMachine extracts the Fingerprint and HardwareAddrs fields from a Machine and populates Whoami with it.
func (*Whoami) Score ¶ added in v4.3.0
Score calculates how closely the passed in Whoami matches a candidate Machine. In the current implementation, Score awards points based on the following criteria:
* 25 points if the Machine has an SSNHash that matches the one in the Whoami
* 25 points if the Machine has a CSNHash that matches the one in the Whoami
* 50 points if the Machine has a SystemUUID that matches the one in the Whoami
- 0 to 100 points varying depending on how many memory DIMMs from the machine fingerprint are present in Whoami.
- 0 to 100 points varying depending on how many HardwareAddrs from the Machine are present in Whoami.
* 1000 points if the machine UUID matches OnDiskUUID
If the score is less than 100 at the end of the scoring process, it is rounded down to zero. The intent is to be resilient in the face of hardware changes:
* SSNHash, CSNHash, and SystemUUID come from the motherboard.
* MemoryIds are generated deterministically from the DIMMs installed in the system
* MacAddrs comes from the physical Ethernet devices in the system.
type Workflow ¶
type Workflow struct { Validation Access Meta Owned Bundled Name string Description string Documentation string Stages []string }
Workflow contains a list of Stages. When it is applied to a Machine, that machine's Tasks list is populated with the contents of the Stages in the Workflow.
swagger:model
func (*Workflow) CanHaveActions ¶
func (*Workflow) GetDescription ¶ added in v4.1.0
GetDescription returns the object's Description
func (*Workflow) GetDocumentation ¶
GetDocumentaiton returns the object's Documentation
Source Files ¶
- aaplbsdp.go
- access.go
- bootenv.go
- bundle.go
- catalogItem.go
- content.go
- context.go
- dhcpOption.go
- endpoint.go
- errors.go
- event.go
- index.go
- info.go
- interface.go
- job.go
- lease.go
- license.go
- machine.go
- meta.go
- modtimesha.go
- owner.go
- param.go
- partial.go
- plugin.go
- plugin_provider.go
- pool.go
- preference.go
- profile.go
- raw_model.go
- reservation.go
- role.go
- secureData.go
- stage.go
- subnet.go
- task.go
- template.go
- templateInfo.go
- tenant.go
- token.go
- user.go
- utils.go
- validate.go
- version_set.go
- whoami.go
- workflow.go