models

package
v4.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 43 Imported by: 20

Documentation

Index

Constants

View Source
const (
	BsdpOS9       = 0
	BsdpOSX       = 1
	BsdpOSXServer = 2
	BsdpDiags     = 3
)
View Source
const PS_BUILDING = "Building"
View Source
const PS_DESTROYING = "Destroying"
View Source
const PS_FREE = "Free"
View Source
const PS_HOLD_BUILD = "HoldBuild"
View Source
const PS_HOLD_DESTROY = "HoldDestroy"
View Source
const PS_HOLD_JOIN = "HoldJoin"
View Source
const PS_HOLD_LEAVE = "HoldLeave"
View Source
const PS_IN_USE = "InUse"
View Source
const PS_JOINING = "Joining"
View Source
const PS_LEAVING = "Leaving"

Variables

View Source
var (
	BadKey   = errors.New("Key must be 32 bytes long")
	BadNonce = errors.New("Nonce must be 24 bytes long")
	Corrupt  = errors.New("SecureData corrupted")
)
View Source
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 ArchEqual

func ArchEqual(a, b string) bool

ArchEqual returns whether two arches are equal.

func DHCPOptionParser

func DHCPOptionParser(code dhcp.OptionCode) (func(string) ([]byte, error), func([]byte) string)

DHCPOptionParser returns the appropriate string conversion and deconversion functions for a given DHCP option code.

func DecodeYaml

func DecodeYaml(buf []byte, ref interface{}) error

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 DrpSafeFuncMap() template.FuncMap

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 Hexaddr

func Hexaddr(addr net.IP) string

func IsSecureData

func IsSecureData(val interface{}) bool

func MergeTemplates

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

func ParseContentPrerequisites

func ParseContentPrerequisites(prereqs string) (map[string]semver.Range, error)

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 ParseDuration added in v4.6.0

func ParseDuration(s, unit string) (time.Duration, error)

func RandString

func RandString(n int) string

RandString returns a random string of n characters The range of characters is limited to the base64 set

func Remarshal

func Remarshal(src, dest interface{}) error

Remarshal remarshals src onto dest.

func SetHaState added in v4.6.0

func SetHaState(base string, state *CurrentHAState) error

SetHaState saves state into base/ha-state.json. Any error in the process will leave the current file untouched.

func SupportedArch

func SupportedArch(s string) (string, bool)

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

func ValidEndpointName(msg, s string) error

ValidEndpointName validates that the string is a valid Endpoint Name

func ValidMachineName

func ValidMachineName(msg, s string) error

ValidMachineName validates that the string is a valid Machine Name

func ValidName

func ValidName(msg, s string) error

ValidName validates that the string is a valid Name

func ValidNumberName added in v4.4.0

func ValidNumberName(msg, s string) error

func ValidParamName

func ValidParamName(msg, s string) error

ValidParamName validates that the string is a valid Param Name

func ValidUserName added in v4.6.2

func ValidUserName(msg, s string) error

ValidUserName validates that the string is a valid Username

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.
	// This flag is informational, and cannot be changed via the API.
	//
	// read only: true
	ReadOnly bool
}

Access holds if the object is read-only or not

swagger: model

func (*Access) IsReadOnly

func (a *Access) IsReadOnly() bool

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.)

func (*Access) SetReadOnly added in v4.6.0

func (a *Access) SetReadOnly(v bool)

SetReadOnly sets the ReadOnly field of the model. Doing this will have no effect on the client side.

type Accessor

type Accessor interface {
	IsReadOnly() bool
	SetReadOnly(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.

func (*Action) Fill

func (m *Action) Fill()

type Actor

type Actor interface {
	Model
	CanHaveActions() bool
}

Actor interface should be implemented this if you want actions

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.  dr-provision does
	// not use this field internally.  drpcli and the UX use this field to
	// provide a default source for downloading the IsoFile.
	//
	// 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.  It will also be overridden by the corresponding
	// entry in the Loaders field of the BootEnv, if present and secure boot is enabled by
	// the license.
	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.

func (*ArchInfo) Fill

func (a *ArchInfo) Fill()

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 BlobInfo

type BlobInfo struct {
	Path string
	Size int64
}

BlobInfo contains information on an uploaded file or ISO. swagger:model

type BootEnv

type BootEnv struct {
	Validation
	Access
	Meta
	Owned
	Bundled
	// Name is the name of the boot environment.  Boot environments that install
	// an operating system must end in '-install'.  All boot environment names must be unique.
	//
	// required: true
	Name string `index:",key"`
	// Description is a one-line 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 for 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
	// OS is the operating system specific information for the boot environment.
	OS OsInfo
	// Templates contains a list of templates that should be expanded into files for the
	// boot environment.  These expanded templates will be available via TFTP and static HTTP
	// from dr-provision.  You should take care that the final paths for the temmplates do not
	// overlap with ones provided by other boot environments.
	//
	// 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.  This list will generally be passed as commmand line
	// arguments to the Kernel as it boots up.
	//
	// required: true
	BootParams string
	// The list of extra required parameters for this
	// boot environment. 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
	// boot environment. 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.  If this flag is set to True, then the
	// Templates provided byt this boot environment must take care to be able
	// to chainload into the appropriate boot environments for other machines
	// if the bootlaoder that machine is using does not support it natively.
	// The built-in ignore boot environment and the discovery boot environment
	// provided by the community content bundle should be used as references for
	// satisfying that requirement.
	//
	// 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) AuthKey

func (b *BootEnv) AuthKey() string

func (*BootEnv) BootParamsFor

func (b *BootEnv) BootParamsFor(arch string) string

func (*BootEnv) CanHaveActions

func (b *BootEnv) CanHaveActions() bool

func (*BootEnv) Fill

func (b *BootEnv) Fill()

func (*BootEnv) GetDescription added in v4.1.0

func (b *BootEnv) GetDescription() string

func (*BootEnv) GetDocumentation

func (b *BootEnv) GetDocumentation() string

func (*BootEnv) GetMeta

func (b *BootEnv) GetMeta() Meta

func (*BootEnv) InitrdsFor

func (b *BootEnv) InitrdsFor(arch string) []string

func (*BootEnv) IsoFor

func (b *BootEnv) IsoFor(arch string) string

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

func (b *BootEnv) IsoUrlFor(arch string) string

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) KernelFor

func (b *BootEnv) KernelFor(arch string) string

func (*BootEnv) Key

func (b *BootEnv) Key() string

func (*BootEnv) KeyName

func (b *BootEnv) KeyName() string

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

func (b *BootEnv) NetBoot() bool

NetBoot returns whether this bootenv is able to boot via PXE or some other network mechanism.

func (*BootEnv) Prefix

func (b *BootEnv) Prefix() string

func (*BootEnv) SetMeta

func (b *BootEnv) SetMeta(d Meta)

func (*BootEnv) SetName

func (b *BootEnv) SetName(n string)

func (*BootEnv) ShaFor

func (b *BootEnv) ShaFor(arch string) string

ShaFor is a helper to return the right SHA256 sum for the ISO that provides files for the BootEnv.

func (*BootEnv) SliceOf

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

func (*BootEnv) ToModels

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

func (*BootEnv) Validate

func (b *BootEnv) Validate()

type BootEnvOverride added in v4.4.0

type BootEnvOverride struct {
	// Loaders contains the boot loaders that should be used.  Any entries
	// here will override matching entries in the BootEnv that is being overridden.
	Loaders map[string]string
	// Override for the OSInfo field of the BootEnv that is being overridden.
	OS OsInfo
	// Additional templates that should also be rendered for the overridden BootEnv.
	// TemplateInfo fields with an identical Name will override the ones in the original
	// BootEnv.
	Templates []TemplateInfo
}

BootEnvOverride is used to allow a BootEnv to be customized on a per-machine basis. Every entry in a bootenv-customize Param must be one of these.

type BootEnver

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

BootEnver interface defines if the model has a boot env

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 legacy Mac systems, you probably don't care about this. Apple has formally deprecated the underlying NetBoot protocol that these options enumerate: https://support.apple.com/en-us/HT208312 There does not appear to be a replacement set of protocols.

func (*BsdpBootOption) InstallType

func (bo *BsdpBootOption) InstallType() string

InstallType defines the specific type of netboot is nbeing attempted.

func (*BsdpBootOption) MarshalText

func (bo *BsdpBootOption) MarshalText() ([]byte, error)

func (*BsdpBootOption) OSName

func (bo *BsdpBootOption) OSName() string

OSName maps the associated BSDP version flag to a useful 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.
	// This field is read-only, and cannot be changed via the API.
	//
	// read only: true
	Bundle string
}

Bundled holds the object's store's name

swagger: model

func (*Bundled) GetBundle

func (b *Bundled) GetBundle() string

GetBundle gets the name of the content layer holding this object.

func (*Bundled) SetBundle

func (b *Bundled) SetBundle(name string)

SetBundle sets the name of the content layer holding this object.

type Bundler

type Bundler interface {
	SetBundle(string)
	GetBundle() string
}

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 is the unique ID for this catalog item.
	Id string `index:",key"`
	// Type is the type of catalog item this is.
	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.

swagger:model

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 Cert added in v4.6.0

type Cert struct {
	Data [][]byte
	Key  ed25519.PrivateKey
	// contains filtered or unexported fields
}

Cert is one of the self-signed root CA entries used to secure communication between consensus cluster members. Members will trust any key signed with one of these.

func (*Cert) TLS added in v4.6.0

func (c *Cert) TLS() *tls.Certificate

TLS converts the Cert into a TLS compatible certificate.

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) Contains

func (a *Claim) Contains(b *Claim) bool

func (*Claim) Match

func (c *Claim) Match(scope, action, specific string) bool

Match tests to see if this claim allows access for the specified scope, action, and specific item.

func (*Claim) String

func (c *Claim) String() string

func (*Claim) Validate

func (c *Claim) Validate(e ErrorAdder)

type Claims

type Claims []claim

Claims is a compiled list of claims from a Role.

func (Claims) Contains

func (a Claims) Contains(b Claims) bool

Claims returns true if all of the claims in a are a superset of b

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 CloudInit added in v4.7.0

type CloudInit struct {
	V1 CloudInitv1 `json:"v1,omitempty"`
}

Minimal Cloud Init JSON needed for Fill to collect Cloud ID

type CloudInitv1 added in v4.7.0

type CloudInitv1 struct {
	CloudName  string `json:"cloud_name,omitempty"`
	InstanceID string `json:"instance_id,omitempty"`
}

type ClusterState added in v4.6.0

type ClusterState struct {
	GlobalHaState
	Nodes []NodeInfo
}

ClusterState is the overall state of a consensus cluster.

type Content

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

	// Sections is a nested map of object types to object unique identifiers to the objects
	// that are provided by this content bundle.
	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) AuthKey

func (c *Content) AuthKey() string

func (*Content) Fill

func (c *Content) Fill()

func (*Content) FromStore

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

FromStore loads the contents of a Store into a content bundle.

func (*Content) GenerateMetaMap

func (c *Content) GenerateMetaMap() map[string]string

func (*Content) GetDescription added in v4.1.0

func (c *Content) GetDescription() string

func (*Content) GetDocumentation added in v4.1.0

func (c *Content) GetDocumentation() string

func (*Content) Key

func (c *Content) Key() string

func (*Content) KeyName

func (c *Content) KeyName() string

func (*Content) Mangle

func (c *Content) Mangle(thunk func(string, interface{}) (interface{}, error)) error

func (*Content) Prefix

func (c *Content) Prefix() string

func (*Content) ToStore

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

ToStore saves a Content bundle into a format that can be used but the stackable store system dr-provision uses to save its working data.

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

	// Color is the color the Icon should show up as in the UX.  Color names
	// must be one of the ones available from https://react.semantic-ui.com/elements/button/#types-basic-shorthand
	Color string
	// Icon is the icon that should be used to represent this content bundle.
	// We use icons from https://react.semantic-ui.com/elements/icon/
	Icon string
	// Author should contain the name of the author along with their email address.
	Author string
	// DisplayName is the froiendly name the UX will use by default.
	DisplayName string
	// License should be the name of the license that governs the terms the content is made available under.
	License string
	// Copyright is the copyright terms for this content.
	Copyright string
	// CodeSource should be a URL to the repository that this content was built from, if applicable.
	CodeSource string
	// Order gives a hint about the relaitve importance of this content when the UX is rendering
	// it.  Deprecated, can be left blank.
	Order string
	// Tags is used in the UX to categorize content bundles according to various criteria.  It should
	// be a comma-separated list of single words.
	Tags string
	// DocUrl should contain a link to external documentation for this content, if available.
	DocUrl string

	// Type contains what type of content bundle this is.  It is read-only, and cannot be changed voa the API.
	Type string
	// Writable controls wheter objects provided by this content can be modified independently via the API.
	// This will be false for everything but the BackingStore.  It is read-only, and cannot be changed via
	// the API.
	Writable bool
	// Overwritable controls whether objects provided by this content store can be overridden by identically identified
	// objects from another content bundle.  This will be false for everything but the BasicStore.
	// This field is read-only, and cannot be changed via the API.
	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
}

ContentSummary is a summary view of a content bundle, consisting of the content metadata, a count of each type of object the content bundle provides, and any warnings that were recorded when attempting to load the content bundle.

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.  It must be unique.
	Name string `index:",key"`
	// Image is the name of the prebuilt execution environment that the Engine should use to create
	// specific execution environments for this Context when Tasks should run on behalf
	// of a Machine.  Images must contain all the tools needed to run the Tasks
	// that are designed to run in them, as well as a version of drpcli
	// with a context-aware `machines processjobs` command.
	Image string
	// Engine is the name of the Plugin that provides the functionality
	// needed to manage the execution environment that Tasks run in on
	// behalf of a given Machine in the Context.  An Engine could be a
	// Plugin that interfaces with Docker or Podman locally, Kubernetes,
	// Rancher, vSphere, AWS, or any number of other things.
	Engine string

	// Description is a one-line summary of the purpose of this Context
	Description string
	// Documentation should contain any special notes or caveats to keep in mind
	// when using this Context.
	Documentation string
}

Context defines an alternate task execution environment for a machine. This allows Digital Rebar to manage and run tasks against machines that mey not be able to run the Agent. See https://provision.readthedocs.io/en/latest/doc/arch/provision.html#context for more detailed information on how to make an environment for a Context.

swagger:model

func (*Context) AuthKey added in v4.0.21

func (c *Context) AuthKey() string

func (*Context) Fill added in v4.0.21

func (c *Context) Fill()

func (*Context) GetMeta added in v4.0.21

func (c *Context) GetMeta() Meta

func (*Context) Key added in v4.0.21

func (c *Context) Key() string

func (*Context) KeyName added in v4.0.21

func (c *Context) KeyName() string

func (*Context) Prefix added in v4.0.21

func (c *Context) Prefix() string

func (*Context) SetMeta added in v4.0.21

func (c *Context) SetMeta(d Meta)

func (*Context) SliceOf added in v4.0.21

func (c *Context) SliceOf() interface{}

func (*Context) ToModels added in v4.0.21

func (c *Context) ToModels(obj interface{}) []Model

type CurrentHAState added in v4.6.0

type CurrentHAState struct {
	GlobalHaState
	NodeHaState
}

CurrentHAState is the GlobalHaState and the NodeHaState for a particular node.

func GetHaState added in v4.6.0

func GetHaState(base string) (*CurrentHAState, error)

GetHaState loads a serialized version of the CurrentHAState for a node from the directory passed in as Base. It always attempts to read from a file named ha-state.json

func (*CurrentHAState) EndpointCert added in v4.6.0

func (c *CurrentHAState) EndpointCert(templateMaker func() (*x509.Certificate, error)) (*tls.Certificate, error)

func (*CurrentHAState) OurIp added in v4.6.0

func (c *CurrentHAState) OurIp() (string, error)

OurIp returns the IP address that should be set in an endpoint certificate for host validation.

func (*CurrentHAState) Validate added in v4.6.0

func (cOpts *CurrentHAState) Validate() error

Validate validates CurrentHAState to make sure is it sane.

type Descer added in v4.1.0

type Descer interface {
	Model
	GetDescription() string
}

Descer interface defines if the object has a description field

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 (o DhcpOption) RenderToDHCP(srcOpts map[int]string) (code byte, val []byte, err error)

func (*DhcpOption) String

func (o *DhcpOption) String() string

type Docer

type Docer interface {
	Model
	GetDocumentation() string
}

Docer interface defines if the object has a documentation field

type Element added in v4.4.0

type Element struct {
	// Type defines the type of element
	// This can be:
	//   DRP, DRPUX, File, Global, Plugin, Pref, PluginProvider, ContentPackage
	Type string
	// Version defines the short or reference version of the element.
	// e.g. tip, stable, v4.3.6
	Version string
	// Name defines the name of the element.  Normally, this is the
	// name of the the DRP, DRPUX, filename, plugin, ContentPackage, or PluginProvider Name.
	// For Global and Pref, these are the name of the global parameter or preference.
	Name string
	// ActualVersion is the actual catalog version referenced by this element.
	// This is used for translating tip and stable into a real version.
	// This is the source of the file element.  This can be a relative or absolute path or an URL.
	ActualVersion string
}

Element define a part of the endpoint This can be a file, a pref, global profile parameter, DRP itself, content packages, plugin_providers, or plugins.

type ElementAction added in v4.4.0

type ElementAction struct {
	Element
	// Action defines what is to be done to this element.
	// These can be Set for Pref, Global.
	// These can be AddOrUpdate and Delete for the reset of the elements.
	// This field is ignored for the DRP and DRPUX element.  It is assumed AddOrUpdate.
	Action string
	// Value defines what should be set or applied.  This field is used
	// for the  plugin, pref, global, and file elements.
	//
	// Plugin, Pref, and Global elements use this as the value for the element.
	// File elements use this field to determine if it should be exploded.
	Value interface{}
}

ElementAction defines an action to take on an Element

func (*ElementAction) String added in v4.4.0

func (ea *ElementAction) String() string

String prints a user-friendly format of an ElementAction

type Endpoint added in v4.4.0

type Endpoint struct {
	Validation
	Access
	Meta
	Owned
	Bundled

	// Id is the name of the DRP endpoint this should match the HA pair's ID or the DRP ID of a single node.
	Id string `index:",key"`

	// Description is a string for providing a simple description
	Description string `json:"Description,omitempty"`
	// Documentation is a string for providing additional in depth information.
	Documentation string `json:"Documentation,omitempty"`

	// Params holds the access parameters - these should be secure parameters.
	// They are:
	//   manager/username
	//   manager/password
	//   manager/url
	Params map[string]interface{} `json:"Params,omitempty"`

	// ConnectionStatus reflects the manager's state of interaction with the endpoint
	ConnectionStatus string `json:"ConnectionStatus,omitempty"`

	// VersionSet - Deprecated - was a single version set.
	// This should be specified within the VersionSets list
	VersionSet string `json:"VersionSet,omitempty"`

	// VersionSets replaces VersionSet - code processes both
	// This is the list of version sets to apply.  These are merged
	// with the first in the list having priority over later elements in the list.
	VersionSets []string `json:"VersionSets,omitempty"`

	// Apply toggles whether the manager should update the endpoint.
	Apply bool `json:"Apply,omitempty"`
	// HaId is the HaId of the endpoint
	HaId string `json:"HaId,omitempty"`
	// Arch is the arch of the endpoint - Golang arch format.
	Arch string `json:"Arch,omitempty"`
	// Os is the os of the endpoint - Golang os format.
	Os string `json:"Os,omitempty"`
	// DRPVersion is the version of the drp endpoint running.
	DRPVersion string `json:"DRPVersion,omitempty"`
	// DRPUXVersion is the version of the ux installed on the endpoint.
	DRPUXVersion string `json:"DRPUXVersion,omitempty"`
	// Components is the list of ContentPackages and PluginProviders installed
	// and their versions
	Components []*Element `json:"Components,omitempty"`
	// Plugins is the list of Plugins configured on the endpoint.
	Plugins []*Plugin `json:"Plugins,omitempty"`
	// Prefs is the value of all the prefs on the endpoint.
	Prefs map[string]string `json:"Prefs,omitempty"`
	// Global is the Parameters of the global profile.
	Global map[string]interface{} `json:"Global,omitempty"`
	// Actions is the list of actions to take to make the endpoint
	// match the version sets on in the endpoint object.
	Actions []*ElementAction `json:"Actions,omitempty"`
}

Endpoint represents a managed Endpoint

This object is used to reflect the current state of a downstream endpoint.

It also shows the desired configuration state of the downstream endpoint through the applied versions sets.

It acts as the control point for applying updates through the Apply field. A user can also "dry-run" a set of changes to see what would happen by viewing the Actions field. This also shows remaining work while Apply is set to true.

It is similar to a machine object in that it has parameters that define how to access the endpoint and its state.

swagger:model

func (*Endpoint) AuthKey added in v4.4.0

func (e *Endpoint) AuthKey() string

AuthKey returns the value of the key for auth purposes

func (*Endpoint) CanHaveActions added in v4.4.0

func (e *Endpoint) CanHaveActions() bool

CanHaveActions indicates that the model can have actions

func (*Endpoint) Fill added in v4.4.0

func (e *Endpoint) Fill()

Fill initials an Endpoint

func (*Endpoint) GetDescription added in v4.4.0

func (e *Endpoint) GetDescription() string

GetDescription returns the models Description

func (*Endpoint) GetMeta added in v4.4.0

func (e *Endpoint) GetMeta() Meta

GetMeta get the meta data from the model

func (*Endpoint) GetParams added in v4.4.0

func (e *Endpoint) GetParams() map[string]interface{}

GetParams returns the parameters on the Endpoint The returned map is a shallow copy.

func (*Endpoint) Key added in v4.4.0

func (e *Endpoint) Key() string

Key returns the key for this object

func (*Endpoint) KeyName added in v4.4.0

func (e *Endpoint) KeyName() string

KeyName returns the name of the field that is the key for this object

func (*Endpoint) Prefix added in v4.4.0

func (e *Endpoint) Prefix() string

Prefix returns the type of object

func (*Endpoint) SetMeta added in v4.4.0

func (e *Endpoint) SetMeta(d Meta)

SetMeta set the meta data on the model

func (*Endpoint) SetName added in v4.4.0

func (e *Endpoint) SetName(name string)

SetName sets the name. In this case, it sets Id.

func (*Endpoint) SetParams added in v4.4.0

func (e *Endpoint) SetParams(p map[string]interface{})

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

func (*Endpoint) ToModels added in v4.4.0

func (e *Endpoint) ToModels(obj interface{}) []Model

ToModels converts a slice of Endpoints into a slice of Model

func (*Endpoint) Validate added in v4.4.0

func (e *Endpoint) Validate()

Validate validates the object

type Error

type Error struct {
	Object Model `json:"-"`
	// Model is the type of object to which the error refers.  It is generally
	// whatever thing.Prefix() would return.
	Model string
	// Key is the unique per-model identifier of the object to which the error refers.
	// It is generally whatever thing.Key() would return.
	Key string
	// Type is the type of error this is.  There is no set definition for what this us.
	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 NewError

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

NewError creates a new Error with a few key parameters pre-populated.

func (*Error) AddError

func (e *Error) AddError(src error)

func (*Error) ContainsError

func (e *Error) ContainsError() bool

func (*Error) Error

func (e *Error) Error() string

Error satifies the global error interface.

func (*Error) Errorf

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

Errorf appends a new error message into the Messages tracked by the Error.

func (*Error) HasError

func (e *Error) HasError() error

type ErrorAdder

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

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

func EventFor

func EventFor(obj Model, action string) *Event

func (*Event) Message

func (e *Event) Message() string

func (*Event) Model

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

func (*Event) Text

func (e *Event) Text() string

type FileData added in v4.4.0

type FileData struct {
	Path      string // Including name e.g. files/raid/jjj
	Sha256Sum string // sha256sum of the item
	Source    string // Location to get file from - self://path is this DRP
	Explode   bool
}

type Filler

type Filler interface {
	Model
	Fill()
}

Filler interface defines if a model can be filled/initialized

type GlobalHaState added in v4.6.0

type GlobalHaState struct {
	// LoadBalanced indicates that an external service is responsible for
	// routing traffic destined to VirtAddr to a cluster node.
	LoadBalanced bool
	// Enabled indicates whether either HA mode is operating on this cluster.
	// If just Enabled is set, the cluster is using the synchronous replication
	// protocol with manual failover.
	Enabled bool
	// ConsensusEnabled indicates that this cluster is operating on the Raft
	// based replication protocol with automatic failover.
	ConsensusEnabled bool
	// ConsensusJoin is the API URL of the current active node in a consensus
	// cluster.  It may be unset if the cluster nodes cannot agree who should
	// be the active node, or if the cluster is operating using the sync replication
	// protocol.
	ConsensusJoin string
	// VirtAddr is the IP address that the cluster should appear to have from the
	// perspective of clients and third parties.
	VirtAddr string
	// ServerHostname is the DNS name for the DRP endpoint that managed systems should use.
	ServerHostname string
	// ActiveUri is the API URL of cthe cluster as built from the virtual addr.
	ActiveUri string
	// Token is an API authentication token that can be sued to perform cluster operations.
	Token string
	// HaID is the ID of the cluster as a whole.
	HaID string
	// Valid indicates that this state is valid and has been consistency checked.
	Valid bool
	// Roots is a list of self-signed trust roots that consensus nodes will use
	// to verify communication.  These roots are automatically created and rotated
	// on a regular basis.
	Roots []Cert
}

GlobalHaState is the consensus state shared by all members of a consensus cluster.

func (*GlobalHaState) FillTls added in v4.6.0

func (g *GlobalHaState) FillTls() error

func (*GlobalHaState) RotateRoot added in v4.6.0

func (g *GlobalHaState) RotateRoot(templateMaker func() (*x509.Certificate, error)) (err error)

RotateRoot adds a new self-signed root certificate to the beginning of g.Roots, and removes any expired certificates.

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"`
	// required: true
	Electable bool `json:"electable"`
}

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 multiple 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 indicates 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 {
	// Arch is the system architecture of the running dr-provision endpoint.
	// It is the same value that would be return by runtime.GOARCH
	// required: true
	Arch string `json:"arch"`
	// Os is the operating system the dr-provision endpoint is running on.
	// It is the same value returned by runtime.GOARCH
	// required: true
	Os string `json:"os"`
	// Version is the full version of dr-provision.
	// required: true
	Version string `json:"version"`
	// Id is the local ID for this dr-provision.  If not overridden by
	// an environment variable or a command line argument, it will
	// be the lowest MAC address of all the physical nics attached to the system.
	// required: true
	Id string `json:"id"`
	// LocalId is the same as Id, except it is always the MAC address form.
	// required: true
	LocalId string `json:"local_id"`
	// HaId is the user-assigned high-availability ID for this endpoint.
	// All endpoints in the same HA cluster must have the same HaId.
	// required: true
	HaId string `json:"ha_id"`
	// ApiPort is the TCP port that the API lives on.  Defaults to 8092
	// required: true
	ApiPort int `json:"api_port"`
	// FilePort is the TCP port that the static file HTTP server lives on.
	// Defaults to 8091
	// required: true
	FilePort int `json:"file_port"`
	// SecureFilePort is the TCP port that the static file HTTPS server lives on.
	// Defaults to 8090
	// required: true
	SecureFilePort int `json:"secure_file_port"`
	// DhcpPort is the UDP port that the DHCPv4 server listens on.
	// Defaults to 67
	// required: true
	DhcpPort int `json:"dhcp_port"`
	// BinlPort is the UDP port that the BINL server listens on.
	// Defaults to 4011
	// required: true
	BinlPort int `json:"binl_port"`
	// TftpPort is the UDP port that the TFTP server listens on.
	// Defaults to 69, dude.
	// required: true
	TftpPort int `json:"tftp_port"`
	// TftpEnabled is true if the TFTP server is enabled.
	// required: true
	TftpEnabled bool `json:"tftp_enabled"`
	// DhcpEnabled is true if the DHCP server is enabled.
	// required: true
	DhcpEnabled bool `json:"dhcp_enabled"`
	// BinlEnabled is true if the BINL server is enabled.
	// required: true
	BinlEnabled bool `json:"binl_enabled"`
	// ProvisionerEnabled is true if the static file HTTP server is enabled.
	// required: true
	ProvisionerEnabled bool `json:"prov_enabled"`
	// SecureProvisionerEnabled is true if the static file HTTPS server is enabled.
	// required: true
	SecureProvisionerEnabled bool `json:"secure_prov_enabled"`
	// Address is the IP address that the system appears to listen on.
	// If a default address was assigned via environment variable or command line,
	// it will be that address, otherwise it will be the IP address of the interface
	// that has the default IPv4 route.
	// required: true
	Address net.IP `json:"address"`
	// ServerHostname is the DNS name for the DRP endpoint that managed systems should use.
	// If a default hostname was assigned via environment variable or command line,
	// it will be that hostname, otherwise it will be an empty string
	ServerHostname string `json:"server_hostname"`
	// Manager indicates whether this dr-provision can act as a manager of
	// other dr-provision instances.
	// required: true
	Manager bool `json:"manager"`
	// Stats lists some basic object statistics.
	// required: true
	Stats []Stat `json:"stats"`
	// Features is a list of features implemented in this dr-provision endpoint.
	// Clients should use this field when determining what features are available
	// on anu given dr-provision instance.
	Features []string `json:"features"`
	// Scopes lists all static permission scopes available.
	Scopes map[string]map[string]struct{} `json:"scopes"`
	// License is an embedded copy of the licenses present on the system.
	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"`

	// ClusterState is the current state of the consensus cluster that this
	// node is a member of.  As of v4.6, all nodes are in at least a single-node cluster
	ClusterState ClusterState
}

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) Fill

func (i *Info) Fill()

func (*Info) HasFeature

func (i *Info) HasFeature(f string) bool

HasFeature is a helper function to determine if a requested feature is present.

type Interface

type Interface struct {
	Access
	Meta
	// Name of the interface
	//
	// required: true
	Name string
	// Index of the interface.  This is OS specific.
	Index int
	// Addresses contains the IPv4 and IPv6 addresses bound to this interface in no particular order.
	//
	// required: true
	Addresses []string
	// ActiveAddress is our best guess at the address that should be used for "normal" incoming traffic
	// on this interface.
	ActiveAddress string
	// Gateway is our best guess about the IP address that traffic forwarded through this interface should
	// be sent to.
	Gateway string
	// DnsServers is a list of DNS server that hsould be used when resolving addresses via this interface.
	DnsServers []string
	// DnsDomain is the domain that this system appears to be in on 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

func (*Interface) Fill

func (i *Interface) Fill()

func (*Interface) Key

func (i *Interface) Key() string

func (*Interface) KeyName

func (i *Interface) KeyName() string

func (*Interface) Prefix

func (i *Interface) Prefix() string

func (*Interface) SliceOf

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

func (*Interface) ToModels

func (b *Interface) ToModels(obj interface{}) []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 `index:",key"`
	// 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) AuthKey

func (j *Job) AuthKey() string

func (*Job) CanHaveActions

func (b *Job) CanHaveActions() bool

func (*Job) Fill

func (j *Job) Fill()

func (*Job) GetMeta

func (j *Job) GetMeta() Meta

func (*Job) Key

func (j *Job) Key() string

func (*Job) KeyName

func (j *Job) KeyName() string

func (*Job) Prefix

func (j *Job) Prefix() string

func (*Job) SetMeta

func (j *Job) SetMeta(d Meta)

func (*Job) SliceOf

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

func (*Job) ToModels

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

func (*Job) Validate

func (j *Job) Validate()

type JobAction

type JobAction struct {
	// Name is the name of this particular JobAction.  It is taken from
	// the name of the corresponding Template on the Task this Action was rendered from.
	// required: true
	Name string
	// Path is the location that Content should be written to on disk.
	//
	// If Path is absolute, it will be written in that location.
	//
	// If Path is relative, it will be written relative to the temporary direcory created
	// for running the Job in.
	//
	// If Path is empty, then Content is interpreted as a script to be run.
	// required: true
	Path string
	// Content is the rendered version of the Template on the Task corresponding to this
	// JobAction.
	// required: true
	Content string
	// Meta is a copt of the Meta field of the corresponding Template from the Task this Job was built from.
	// required: true
	Meta map[string]string
}

JobAction 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.

JobAction is generated by rendering a Template on a Task against a specific Machine. swagger:model

func (*JobAction) ValidForOS

func (ja *JobAction) ValidForOS(target string) bool

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 `index:",key"`
	// 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) AuthKey

func (l *Lease) AuthKey() string

func (*Lease) CanHaveActions

func (b *Lease) CanHaveActions() bool

func (*Lease) Expire

func (l *Lease) Expire()

func (*Lease) Expired

func (l *Lease) Expired() bool

func (*Lease) Fake

func (l *Lease) Fake() bool

func (*Lease) Fill

func (l *Lease) Fill()

func (*Lease) GetMeta

func (l *Lease) GetMeta() Meta

func (*Lease) Invalidate

func (l *Lease) Invalidate()

func (*Lease) Key

func (l *Lease) Key() string

func (*Lease) KeyName

func (l *Lease) KeyName() string

func (*Lease) Prefix

func (l *Lease) Prefix() string

func (*Lease) SetMeta

func (l *Lease) SetMeta(d Meta)

func (*Lease) SliceOf

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

func (*Lease) String

func (l *Lease) String() string

func (*Lease) ToModels

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

type License

type License struct {
	Name                    string
	Version                 string
	Data                    interface{}
	PurchaseDate            time.Time
	StartDate               time.Time
	SoftExpireDate          time.Time
	HardExpireDate          time.Time
	ContractTerminationDate time.Time
	ShortLicense            string
	LongLicense             string
	Active, Expired         bool
}

License is used to authorize acess to extended dr-provision features and functionality.

func (*License) Check

func (l *License) Check(ref time.Time) (active, expired bool)

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 `index:",uniq"`
	// 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 `index:",key"`
	// 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 `index:",ignore"`
	// 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 `index:",ignore"`
	// 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

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

AddTasks is a helper for adding tasks to the machine Tasks list in the mutable present.

func (*Machine) AuthKey

func (n *Machine) AuthKey() string

func (*Machine) CanHaveActions

func (b *Machine) CanHaveActions() bool

func (*Machine) DelTasks

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

DelTasks allows you to delete tasks in the mutable present.

func (*Machine) Fill

func (n *Machine) Fill()

func (*Machine) GetBootEnv

func (b *Machine) GetBootEnv() string

match BootEnver interface

func (*Machine) GetDescription added in v4.1.0

func (m *Machine) GetDescription() string

func (*Machine) GetMeta

func (n *Machine) GetMeta() Meta

func (*Machine) GetParams

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

match Param interface

func (*Machine) GetProfiles

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

match Profiler interface

func (*Machine) GetTasks

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

match TaskRunner interface

func (*Machine) IsLocked

func (n *Machine) IsLocked() bool

func (*Machine) Key

func (n *Machine) Key() string

func (*Machine) KeyName

func (n *Machine) KeyName() string

func (*Machine) Prefix

func (n *Machine) Prefix() string

func (*Machine) RunningTask

func (b *Machine) RunningTask() int

func (*Machine) SetBootEnv

func (b *Machine) SetBootEnv(s string)

func (*Machine) SetMeta

func (n *Machine) SetMeta(d Meta)

func (*Machine) SetName

func (b *Machine) SetName(n string)

func (*Machine) SetParams

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

func (*Machine) SetProfiles

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

func (*Machine) SetTasks

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

func (*Machine) SliceOf

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

func (*Machine) SplitTasks

func (b *Machine) SplitTasks() (thePast []string, thePresent []string, theFuture []string)

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.

func (*Machine) ToModels

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

func (*Machine) UUID

func (n *Machine) UUID() string

func (*Machine) Validate

func (n *Machine) Validate()

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
	// Cloud-init file in /run/cloud-init/instance-data.json
	// String from ID of '.v1.cloud_name' + '.v1.instance_id'. 500 point match
	CloudInstanceID string
	// 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

type Meta map[string]string

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

swagger: model

func (Meta) AddFeature

func (m Meta) AddFeature(flag string)

func (Meta) ClearFeatures

func (m Meta) ClearFeatures()

func (Meta) Features

func (m Meta) Features() []string

func (Meta) HasFeature

func (m Meta) HasFeature(flag string) bool

func (Meta) MergeFeatures

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

func (Meta) RemoveFeature

func (m Meta) RemoveFeature(flag string)

type MetaHaver

type MetaHaver interface {
	Model
	GetMeta() Meta
	SetMeta(Meta)
}

type ModTimeSha added in v4.3.0

type ModTimeSha struct {
	ModTime time.Time
	ShaSum  []byte
}

func (*ModTimeSha) Generate added in v4.3.0

func (m *ModTimeSha) Generate(fi *os.File) error

func (*ModTimeSha) GenerateStat added in v4.6.2

func (m *ModTimeSha) GenerateStat(fi *os.File, stat os.FileInfo) error

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

func (*ModTimeSha) UpToDate added in v4.3.0

func (m *ModTimeSha) UpToDate(fi *os.File) bool

type Model

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

Model is the interface that pretty much all non-Error objects returned by the API satisfy.

func All

func All() []Model

All returns a slice containing a single blank instance of all the Models.

func Clone

func Clone(m Model) Model

Clone returns a deep copy of the passed-in Model

type NameSetter

type NameSetter interface {
	Model
	SetName(string)
}

NameSetter interface if the model can change names

type NodeHaState added in v4.6.0

type NodeHaState struct {
	// ConsensusID us the unique autogenerated ID for this node.
	// Once set, it must not be changed, or else other nodes in
	// a cluster will not recognize this node.
	ConsensusID uuid.UUID
	// VirtInterface is the network interface that the global VirtAddr
	// will be added on when this node si the active node, and removed from
	// when this node is no longer the active node.
	VirtInterface string
	// VirtInterfaceScript will be called whenever VirtAddr must be added
	// or removed from VirtInterface.  If empty, a default set of scripts
	// will be sued that are appropriate to the OS type dr-provision is running on.
	VirtInterfaceScript string
	// ConsensusAddr is the addr:port that other nodes should attempt to contact
	// this node no when operating in consensus mode.  All communication over these
	// ports will be secured using TLS 1.3 using per-node short-lived certs signed
	// by the certs in the global Roots field.
	ConsensusAddr string
	// ApiUrl is the URL that can be used to contact this node's API directly.
	ApiUrl string
	// Passive indicates that this node is not responsible for handling client connections
	// or writes via the API.
	Passive bool
	// Observer indicates that this node cannot become the active node.  It is used when
	// a node should act as a live backup and a consensus tiebreaker.
	Observer bool
}

NodeHaState tracks the HA state for an individual node.

type NodeInfo added in v4.6.0

type NodeInfo struct {
	NodeHaState
	// Offline indicates that leadership could not be transferred to
	// this node in the most recent election, despite it being the best candidate.
	// If a node is markes as Offline, it will stay that way until the node
	// updates its state with the current leader.
	Offline bool
	// LastArtifactCommitHandled tracks how up to date a node is compared to the current
	// cluster leader.  Artifact handling is allowed to happen asynchronusly from the rest
	// of Raft based replication due to the potentially large size of artifacts.  In the event
	// of a leadership transfer, the first node that is not Offline with the highest
	// LastArtifactCommitHandled value will be chosen as the new cluster leader.  If that
	// node is not also an Observer, it will become the new active dr-provision node.  If
	// it is an Observer, it will wait for one of the operating Passive nodes to catch up to it,
	// and then transfer leadership to it.
	LastArtifactCommitHandled uint64
}

NodeInfo is used to associate an URI to be used to talk to the dr-provision API for a particular Raft node.

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

func (o OsInfo) FamilyName() string

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

func (o OsInfo) FamilyType() string

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

func (o OsInfo) FamilyVersion() string

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.

func (OsInfo) VersionEq

func (o OsInfo) VersionEq(other string) bool

VersionEq returns true of this OS version is equal to the degree of accuracy implied by other -- o.Version(7.3) is VersionEq to 7 and 7.3, but not 7.3.11

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

func (o *Owned) GetEndpoint() string

GetEndpoint returns the name of the owning DRP Endpoint

func (*Owned) SetEndpoint

func (o *Owned) SetEndpoint(n string)

SetEndpoint sets the model's Endpoint

type Owner

type Owner interface {
	GetEndpoint() string
	SetEndpoint(string)
}

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 `index:",key"`
	// 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) AuthKey

func (p *Param) AuthKey() string

func (*Param) DefaultValue

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

func (*Param) Fill

func (p *Param) Fill()

func (*Param) GetDescription added in v4.1.0

func (p *Param) GetDescription() string

func (*Param) GetDocumentation

func (p *Param) GetDocumentation() string

func (*Param) GetMeta

func (p *Param) GetMeta() Meta

func (*Param) Key

func (p *Param) Key() string

func (*Param) KeyName

func (p *Param) KeyName() string

func (*Param) Prefix

func (p *Param) Prefix() string

func (*Param) SetMeta

func (p *Param) SetMeta(d Meta)

func (*Param) SetName

func (p *Param) SetName(s string)

func (*Param) SliceOf

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

func (*Param) ToModels

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

func (*Param) TypeValue

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

func (*Param) Validate

func (p *Param) Validate()

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

func (p *Partialed) IsPartial() bool

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 `index:",key"`
	// 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) AuthKey

func (n *Plugin) AuthKey() string

func (*Plugin) CanHaveActions

func (p *Plugin) CanHaveActions() bool

func (*Plugin) Fill

func (n *Plugin) Fill()

func (*Plugin) GetDescription added in v4.1.0

func (p *Plugin) GetDescription() string

func (*Plugin) GetDocumentation

func (p *Plugin) GetDocumentation() string

func (*Plugin) GetMeta

func (p *Plugin) GetMeta() Meta

func (*Plugin) GetParams

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

match Paramer interface

func (*Plugin) Key

func (n *Plugin) Key() string

func (*Plugin) KeyName

func (n *Plugin) KeyName() string

func (*Plugin) Prefix

func (n *Plugin) Prefix() string

func (*Plugin) SetMeta

func (p *Plugin) SetMeta(d Meta)

func (*Plugin) SetName

func (p *Plugin) SetName(s string)

func (*Plugin) SetParams

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

func (*Plugin) SliceOf

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

func (*Plugin) ToModels

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

func (*Plugin) Validate

func (p *Plugin) Validate()

type PluginProvider

type PluginProvider struct {
	Meta

	// Name is the unique name of the PluginProvider.
	// Each Plugin provider must have a unique Name.
	Name string `index:",key"`

	// 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

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

swagger:model

type Pool added in v4.4.0

type Pool struct {
	Validation
	Access
	Meta
	Owned
	Bundled

	Id            string `index:",key"`
	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) AuthKey added in v4.4.0

func (p *Pool) AuthKey() string

func (*Pool) CanHaveActions added in v4.4.0

func (p *Pool) CanHaveActions() bool

func (*Pool) Clone added in v4.4.0

func (p *Pool) Clone() *Pool

Clone the pool

func (*Pool) Fill added in v4.4.0

func (p *Pool) Fill()

func (*Pool) GetDescription added in v4.4.0

func (p *Pool) GetDescription() string

func (*Pool) GetDocumentation added in v4.4.0

func (p *Pool) GetDocumentation() string

func (*Pool) Key added in v4.4.0

func (p *Pool) Key() string

func (*Pool) KeyName added in v4.4.0

func (p *Pool) KeyName() string

func (*Pool) Prefix added in v4.4.0

func (p *Pool) Prefix() string

func (*Pool) SetName added in v4.4.0

func (p *Pool) SetName(name string)

SetName sets the name. In this case, it sets Id.

func (*Pool) SliceOf added in v4.4.0

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

func (*Pool) ToModels added in v4.4.0

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

func (*Pool) Validate added in v4.4.0

func (p *Pool) Validate()

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

type Pref struct {
	Meta
	Name string
	Val  string
}

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

func (*Pref) AuthKey

func (p *Pref) AuthKey() string

func (*Pref) Fill

func (p *Pref) Fill()

func (*Pref) Key

func (p *Pref) Key() string

func (*Pref) KeyName

func (p *Pref) KeyName() string

func (*Pref) Prefix

func (p *Pref) Prefix() string

func (*Pref) SliceOf

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

func (*Pref) ToModels

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

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 `index:",key"`
	// 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) AuthKey

func (p *Profile) AuthKey() string

AuthKey returns the value that should be validated against claims

func (*Profile) CanHaveActions

func (p *Profile) CanHaveActions() bool

CanHaveActions indicates if the object is allowed to have actions

func (*Profile) Fill

func (p *Profile) Fill()

Fill initializes the object

func (*Profile) GetDescription added in v4.1.0

func (p *Profile) GetDescription() string

GetDescription returns the object's description

func (*Profile) GetDocumentation added in v4.1.0

func (p *Profile) GetDocumentation() string

GetDocumentation returns the object's documentation

func (*Profile) GetMeta

func (p *Profile) GetMeta() Meta

GetMeta returns the meta data for this profile

func (*Profile) GetParams

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

GetParams returns the current parameters for this profile matches Paramer interface

func (*Profile) GetProfiles added in v4.0.18

func (p *Profile) GetProfiles() []string

GetProfiles returns the profiles on this profile

func (*Profile) Key

func (p *Profile) Key() string

Key returns the primary index for this object

func (*Profile) KeyName

func (p *Profile) KeyName() string

KeyName returns the field of the object that is used as the primary key

func (*Profile) Prefix

func (p *Profile) Prefix() string

Prefix returns the object type

func (*Profile) SetMeta

func (p *Profile) SetMeta(d Meta)

SetMeta sets the meta data for this profile

func (*Profile) SetName

func (p *Profile) SetName(n string)

SetName changes the name of the profile

func (*Profile) SetParams

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

SetParams sets the current parameters for this profile matches Paramer interface

func (*Profile) SetProfiles added in v4.0.18

func (p *Profile) SetProfiles(np []string)

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

func (*Profile) ToModels

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

ToModels converts a slice of these specific objects to a slice of Model interfaces

func (*Profile) Validate

func (p *Profile) Validate()

Validate makes sure that the object is valid (outside of references)

type Profiler

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

Profiler interface defines if the model has profiles

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) AddError

func (r *RawModel) AddError(err error)

func (*RawModel) AuthKey

func (r *RawModel) AuthKey() string

func (*RawModel) CanHaveActions

func (r *RawModel) CanHaveActions() bool

func (*RawModel) ChangeForced

func (r *RawModel) ChangeForced() bool

func (*RawModel) ClearValidation

func (r *RawModel) ClearValidation()

func (*RawModel) Error

func (r *RawModel) Error() string

func (*RawModel) Errorf

func (r *RawModel) Errorf(fmtStr string, args ...interface{})

func (*RawModel) Fill

func (r *RawModel) Fill()

func (*RawModel) ForceChange

func (r *RawModel) ForceChange()

func (*RawModel) GetEndpoint

func (r *RawModel) GetEndpoint() string

Owner Interface

func (*RawModel) GetMeta

func (r *RawModel) GetMeta() Meta

MetaHaver Interface

func (*RawModel) GetParams

func (r *RawModel) GetParams() map[string]interface{}

match Paramer interface

func (*RawModel) GetStringField

func (r *RawModel) GetStringField(field string) (string, bool)

Helpers to get fields

func (*RawModel) HasError

func (r *RawModel) HasError() error

func (*RawModel) IsAvailable

func (r *RawModel) IsAvailable() bool

func (*RawModel) IsPartial

func (r *RawModel) IsPartial() bool

func (*RawModel) IsReadOnly

func (r *RawModel) IsReadOnly() bool

Access Interface

func (*RawModel) Key

func (r *RawModel) Key() string

func (*RawModel) KeyName

func (r *RawModel) KeyName() string

func (*RawModel) MakeError

func (r *RawModel) MakeError(code int, errType string, obj Model) error

func (*RawModel) Prefix

func (r *RawModel) Prefix() string

func (*RawModel) RestoreValidation

func (r *RawModel) RestoreValidation(or *RawModel)

func (*RawModel) SaveValidation

func (r *RawModel) SaveValidation() *Validation

Validator Interface

func (*RawModel) SetAvailable

func (r *RawModel) SetAvailable() bool

func (*RawModel) SetBundle

func (r *RawModel) SetBundle(name string)

func (*RawModel) SetEndpoint

func (r *RawModel) SetEndpoint(n string)

func (*RawModel) SetInvalid

func (r *RawModel) SetInvalid() bool

func (*RawModel) SetMeta

func (r *RawModel) SetMeta(d Meta)

func (*RawModel) SetParams

func (r *RawModel) SetParams(p map[string]interface{})

func (*RawModel) SetPartial

func (r *RawModel) SetPartial()

func (*RawModel) SetReadOnly added in v4.6.0

func (r *RawModel) SetReadOnly(v bool)

func (*RawModel) SetValid

func (r *RawModel) SetValid() bool

func (*RawModel) SliceOf

func (r *RawModel) SliceOf() interface{}

func (*RawModel) String

func (r *RawModel) String() string

func (*RawModel) ToModels

func (r *RawModel) ToModels(obj interface{}) []Model

func (*RawModel) Useable

func (r *RawModel) Useable() bool

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 `index:",key"`
	// 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 `index:",key"`
	// 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 MakeRole

func MakeRole(name string, claims ...string) *Role

func (*Role) AuthKey

func (r *Role) AuthKey() string

func (*Role) Compile

func (r *Role) Compile() Claims

func (*Role) Contains

func (a *Role) Contains(b *Role) bool

Role a contains role b if a can be used to satisfy all requests b can satisfy

func (*Role) Fill

func (r *Role) Fill()

func (*Role) GetDescription added in v4.1.0

func (r *Role) GetDescription() string

GetDescription returns the object's Description

func (*Role) GetDocumentation

func (r *Role) GetDocumentation() string

GetDocumentaiton returns the object's Documentation

func (*Role) GetMeta

func (r *Role) GetMeta() Meta

func (*Role) Key

func (r *Role) Key() string

func (*Role) KeyName

func (r *Role) KeyName() string

func (*Role) Match

func (r *Role) Match(scope, action, specific string) bool

func (*Role) Prefix

func (r *Role) Prefix() string

func (*Role) SetMeta

func (r *Role) SetMeta(d Meta)

func (*Role) SliceOf

func (r *Role) SliceOf() interface{}

func (*Role) ToModels

func (r *Role) ToModels(obj interface{}) []Model

func (*Role) Validate

func (r *Role) Validate()

type Section

type Section map[string]interface{}

type Sections

type Sections map[string]Section

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 Slicer

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

Slicer interface defines is a model can be operated on as slices

func New

func New(prefix string) (Slicer, error)

New returns a new blank instance of the Model with the passed-in prefix.

type Stage

type Stage struct {
	Validation
	Access
	Meta
	Owned
	Bundled
	Partialed
	// The name of the stage.
	//
	// required: true
	Name string `index:",key"`
	// 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) AuthKey

func (s *Stage) AuthKey() string

AuthKey returns the value that should be validated against claims

func (*Stage) CanHaveActions

func (s *Stage) CanHaveActions() bool

CanHaveActions returns if the object can have actions from plugins

func (*Stage) Fill

func (s *Stage) Fill()

Fill initializes the object

func (*Stage) GetBootEnv

func (s *Stage) GetBootEnv() string

GetBootEnv gets the name of the bootenv on this stage

func (*Stage) GetDescription added in v4.1.0

func (s *Stage) GetDescription() string

GetDescription returns the object's Description

func (*Stage) GetDocumentation

func (s *Stage) GetDocumentation() string

GetDocumentaiton returns the object's Documentation

func (*Stage) GetMeta

func (s *Stage) GetMeta() Meta

GetMeta gets the meta data for this object

func (*Stage) GetParams

func (s *Stage) GetParams() map[string]interface{}

GetParams gets the parameters on this stage

func (*Stage) GetProfiles

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

GetProfiles gets the profiles on this stage

func (*Stage) GetTasks

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

GetTasks returns the tasks associated with this stage

func (*Stage) Key

func (s *Stage) Key() string

Key returns the primary index for this object

func (*Stage) KeyName

func (s *Stage) KeyName() string

KeyName returns the field of the object that is used as the primary key

func (*Stage) Prefix

func (s *Stage) Prefix() string

Prefix returns the object type

func (*Stage) SetBootEnv

func (s *Stage) SetBootEnv(be string)

SetBootEnv sets the bootenv on the stage

func (*Stage) SetMeta

func (s *Stage) SetMeta(d Meta)

SetMeta sets the meta data for this object

func (*Stage) SetName

func (s *Stage) SetName(n string)

SetName sets the name of the object

func (*Stage) SetParams

func (s *Stage) SetParams(p map[string]interface{})

SetParams sets the parameters on this stage

func (*Stage) SetProfiles

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

SetProfiles sets the profiles on this stage

func (*Stage) SetTasks

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

SetTasks sets the tasks in this stage

func (*Stage) SliceOf

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

SliceOf returns an empty slice of this type of objects

func (*Stage) ToModels

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

ToModels converts a slice of these specific objects to a slice of Model interfaces

func (*Stage) Validate

func (s *Stage) Validate()

Validate makes sure that the object is valid (outside of references)

type Stat

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

Stat contains a basic statistic about 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 `index:",key"`
	// 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) AuthKey

func (s *Subnet) AuthKey() string

func (*Subnet) CanHaveActions

func (b *Subnet) CanHaveActions() bool

func (*Subnet) Fill

func (s *Subnet) Fill()

func (*Subnet) GetDescription added in v4.1.0

func (s *Subnet) GetDescription() string

GetDescription returns the object's Description

func (*Subnet) GetDocumentation

func (s *Subnet) GetDocumentation() string

GetDocumentaiton returns the object's Documentation

func (*Subnet) GetMeta

func (s *Subnet) GetMeta() Meta

func (*Subnet) Key

func (s *Subnet) Key() string

func (*Subnet) KeyName

func (s *Subnet) KeyName() string

func (*Subnet) Prefix

func (s *Subnet) Prefix() string

func (*Subnet) SetMeta

func (s *Subnet) SetMeta(d Meta)

func (*Subnet) SliceOf

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

func (*Subnet) ToModels

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

func (*Subnet) Validate

func (s *Subnet) Validate()

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 `index:",key"`
	// 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) AuthKey

func (t *Task) AuthKey() string

func (*Task) CanHaveActions

func (t *Task) CanHaveActions() bool

func (*Task) Fill

func (t *Task) Fill()

func (*Task) GetDescription added in v4.1.0

func (t *Task) GetDescription() string

GetDescription returns the object's Description

func (*Task) GetDocumentation

func (t *Task) GetDocumentation() string

GetDocumentaiton returns the object's Documentation

func (*Task) GetMeta

func (t *Task) GetMeta() Meta

func (*Task) Key

func (t *Task) Key() string

func (*Task) KeyName

func (t *Task) KeyName() string

func (*Task) Prefix

func (t *Task) Prefix() string

func (*Task) SetMeta

func (t *Task) SetMeta(d Meta)

func (*Task) SetName

func (t *Task) SetName(n string)

func (*Task) SliceOf

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

func (*Task) ToModels

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

func (*Task) Validate

func (t *Task) Validate()

type TaskRunner

type TaskRunner interface {
	Tasker
	RunningTask() int
}

TaskRunner interface defines if the object can run tasks

type TaskStack added in v4.3.1

type TaskStack struct {
	CurrentTask int
	TaskList    []string
}

TaskStack contains an task stack for a machine. This is used by the error handling code pieces.

type Tasker

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

Tasker interface defines if the model has a task list

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 `index:",key"`
	// A description of this template
	Description string
	// Contents is the raw template.  It must be a valid template
	// according to text/template.
	//
	// required: true
	Contents string
}

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

swagger:model

func (*Template) AuthKey

func (t *Template) AuthKey() string

func (*Template) CanHaveActions

func (b *Template) CanHaveActions() bool

func (*Template) Fill

func (t *Template) Fill()

func (*Template) GetDescription added in v4.1.0

func (t *Template) GetDescription() string

GetDescription returns the object's Description

func (*Template) GetMeta

func (t *Template) GetMeta() Meta

func (*Template) Key

func (t *Template) Key() string

func (*Template) KeyName

func (t *Template) KeyName() string

func (*Template) Prefix

func (t *Template) Prefix() string

func (*Template) SetMeta

func (t *Template) SetMeta(d Meta)

func (*Template) SliceOf

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

func (*Template) ToModels

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

func (*Template) Validate

func (t *Template) Validate()

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 `index:",key"`
	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) AuthKey

func (t *Tenant) AuthKey() string

func (*Tenant) Fill

func (t *Tenant) Fill()

func (*Tenant) GetDescription added in v4.1.0

func (t *Tenant) GetDescription() string

GetDescription returns the object's Description

func (*Tenant) GetDocumentation

func (t *Tenant) GetDocumentation() string

GetDocumentaiton returns the object's Documentation

func (*Tenant) GetMeta

func (t *Tenant) GetMeta() Meta

func (*Tenant) Key

func (t *Tenant) Key() string

func (*Tenant) KeyName

func (t *Tenant) KeyName() string

func (*Tenant) Prefix

func (t *Tenant) Prefix() string

func (*Tenant) SetMeta

func (t *Tenant) SetMeta(d Meta)

func (*Tenant) SliceOf

func (t *Tenant) SliceOf() interface{}

func (*Tenant) ToModels

func (t *Tenant) ToModels(obj interface{}) []Model

func (*Tenant) Validate

func (t *Tenant) Validate()

type User

type User struct {
	Validation
	Access
	Meta
	Owned
	Bundled
	// Name is the name of the user
	//
	// required: true
	Name string `index:",key"`
	// Description of user
	Description string
	// PasswordHash is the scrypt-hashed version of the user's Password.
	//
	PasswordHash []byte `json:",omitempty" index:",ignore"`
	// 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 `index:",ignore"`
	// Roles is a list of Roles this User has.
	//
	Roles []string
}

User is an API user of DigitalRebar Provision swagger:model

func (*User) AuthKey

func (u *User) AuthKey() string

func (*User) CanHaveActions

func (b *User) CanHaveActions() bool

func (*User) ChangePassword

func (u *User) ChangePassword(newPass string) error

func (*User) CheckPassword

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

func (*User) Fill

func (u *User) Fill()

func (*User) GetDescription added in v4.1.0

func (u *User) GetDescription() string

GetDescription returns the object's Description

func (*User) GetMeta

func (u *User) GetMeta() Meta

func (*User) Key

func (u *User) Key() string

func (*User) KeyName

func (u *User) KeyName() string

func (*User) Prefix

func (u *User) Prefix() string

func (*User) Sanitize

func (u *User) Sanitize() Model

func (*User) SetMeta

func (u *User) SetMeta(d Meta)

func (*User) SetName

func (b *User) SetName(n string)

func (*User) SliceOf

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

func (*User) ToModels

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

func (*User) Validate

func (u *User) Validate()

type UserPassword

type UserPassword struct {
	Password string
}

swagger:model

type UserToken

type UserToken struct {
	Token string
	Info  Info
}

UserToken is an auth token for a specific User. The Token section can be used for bearer authentication.

swagger:model

type ValidateSetter

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

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 `index:",key"`

	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      WhoamiResult
	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

func (w *Whoami) Fill() error

Fill fills out the MacAddrs list and the MachineFingerprint from the DMI information on the machine.

func (*Whoami) FromMachine added in v4.3.0

func (w *Whoami) FromMachine(m *Machine)

FromMachine extracts the Fingerprint and HardwareAddrs fields from a Machine and populates Whoami with it.

func (*Whoami) Score added in v4.3.0

func (w *Whoami) Score(m *Machine) (score int)

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.

func (*Whoami) ToMachine added in v4.3.0

func (w *Whoami) ToMachine(m *Machine)

ToMachine saves the Fingerprint and the MacAddrs fields onto the passed Machine.

type WhoamiResult added in v4.5.1

type WhoamiResult struct {
	Score int       `json:",omitempty"`
	Uuid  uuid.UUID `json:",omitempty"`
	Token string    `json:",omitempty"`
}

type Workflow

type Workflow struct {
	Validation
	Access
	Meta
	Owned
	Bundled
	Name          string `index:",key"`
	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) AuthKey

func (w *Workflow) AuthKey() string

func (*Workflow) CanHaveActions

func (w *Workflow) CanHaveActions() bool

func (*Workflow) Fill

func (w *Workflow) Fill()

func (*Workflow) GetDescription added in v4.1.0

func (w *Workflow) GetDescription() string

GetDescription returns the object's Description

func (*Workflow) GetDocumentation

func (w *Workflow) GetDocumentation() string

GetDocumentaiton returns the object's Documentation

func (*Workflow) GetMeta

func (w *Workflow) GetMeta() Meta

func (*Workflow) Key

func (w *Workflow) Key() string

func (*Workflow) KeyName

func (w *Workflow) KeyName() string

func (*Workflow) Prefix

func (w *Workflow) Prefix() string

func (*Workflow) SetMeta

func (w *Workflow) SetMeta(d Meta)

func (*Workflow) SliceOf

func (w *Workflow) SliceOf() interface{}

func (*Workflow) ToModels

func (w *Workflow) ToModels(obj interface{}) []Model

func (*Workflow) Validate

func (w *Workflow) Validate()

Jump to

Keyboard shortcuts

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