v2

package
v0.0.0-...-28756f2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: LGPL-3.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// The Node has been created and has a system ID assigned to it.
	NodeStatusDeclared = "0"

	//Testing and other commissioning steps are taking place.
	NodeStatusCommissioning = "1"

	// Smoke or burn-in testing has a found a problem.
	NodeStatusFailedTests = "2"

	// The Node can’t be contacted.
	NodeStatusMissing = "3"

	// The Node is in the general pool ready to be deployed.
	NodeStatusReady = "4"

	// The Node is ready for named deployment.
	NodeStatusReserved = "5"

	// The Node is powering a service from a charm or is ready for use with a fresh Ubuntu install.
	NodeStatusDeployed = "6"

	// The Node has been removed from service manually until an admin overrides the retirement.
	NodeStatusRetired = "7"

	// The Node is broken: a step in the Node lifecyle failed. More details
	// can be found in the Node's event log.
	NodeStatusBroken = "8"

	// The Node is being installed.
	NodeStatusDeploying = "9"

	// The Node has been allocated to a user and is ready for deployment.
	NodeStatusAllocated = "10"

	// The deployment of the Node failed.
	NodeStatusFailedDeployment = "11"

	// The Node is powering down after a release request.
	NodeStatusReleasing = "12"

	// The releasing of the Node failed.
	NodeStatusFailedReleasing = "13"

	// The Node is erasing its disks.
	NodeStatusDiskErasing = "14"

	// The Node failed to erase its disks.
	NodeStatusFailedDiskErasing = "15"
)

Variables

This section is empty.

Functions

func AllocateMachinesParams

func AllocateMachinesParams(args AllocateMachineArgs) *util.URLParams

func ComssionMachineParams

func ComssionMachineParams(args CommissionMachineArgs) *util.URLParams

func CreateNodesParams

func CreateNodesParams(args CreateNodeArgs) *util.URLParams

func DeploytMachineParams

func DeploytMachineParams(args DeployMachineArgs) *util.URLParams

func FileParams

func FileParams(args AddFileArgs) *util.URLParams

func MachinesParams

func MachinesParams(args MachinesArgs) *util.URLParams

func NodesParams

func NodesParams(args NodesArgs) *util.URLParams

func ReleaseMachinesParams

func ReleaseMachinesParams(args ReleaseMachinesArgs) *util.URLParams

func SupportedVersion

func SupportedVersion(value string) bool

Types

type AddFileArgs

type AddFileArgs struct {
	Filename string
	Content  []byte
	Reader   io.Reader
	Length   int64
}

AddFileArgs is a argument struct for passing information into AddFile. One of Content or (Reader, Length) must be specified.

func (*AddFileArgs) Validate

func (a *AddFileArgs) Validate() error

Validate checks to make sure the Filename has no slashes, and that one of Content or (Reader, Length) is specified.

type AllocateMachineArgs

type AllocateMachineArgs struct {
	Hostname     string
	SystemId     string
	Architecture string
	MinCPUCount  int
	// MinMemory represented in MB.
	MinMemory int
	Tags      []string
	NotTags   []string
	Zone      string
	NotInZone []string
	// Storage represents the required disks on the MachineInterface. If any are specified
	// the first value is used for the root disk.
	Storage []StorageSpec
	// Interfaces represents a number of required interfaces on the MachineInterface.
	// Each InterfaceSpec relates to an individual network interface.
	Interfaces []InterfaceSpec
	// NotSpace is a MachineInterface level constraint, and applies to the entire MachineInterface
	// rather than specific interfaces.
	NotSpace  []string
	AgentName string
	Comment   string
	DryRun    bool
}

AllocateMachineArgs is an argument struct for passing args into MachineInterface.Allocate.

func (*AllocateMachineArgs) Validate

func (a *AllocateMachineArgs) Validate() error

Validate makes sure that any labels specifed in Storage or Interfaces are unique, and that the required specifications are valid.

type BlockDevice

type BlockDevice struct {
	ResourceURI string `json:"resource_uri,omitempty"`

	ID      int      `json:"ID,omitempty"`
	Name    string   `json:"Name,omitempty"`
	Model   string   `json:"Model,omitempty"`
	IDPath  string   `json:"id_path,omitempty"`
	Path    string   `json:"Path,omitempty"`
	UsedFor string   `json:"used_for,omitempty"`
	Tags    []string `json:"Tags,omitempty"`

	BlockSize uint64 `json:"block_size,omitempty"`
	UsedSize  uint64 `json:"used_size,omitempty"`
	Size      uint64 `json:"Size,omitempty"`

	Partitions []*Partition `json:"Partitions,omitempty"`
}

type BootResource

type BootResource struct {
	// Add the ControllerInterface in when we need to do things with the BootResource.
	// ControllerInterface ControllerInterface
	ResourceURI  string `json:"resource_uri,omitempty"`
	ID           int    `json:"ID,omitempty"`
	Name         string `json:"Name,omitempty"`
	Type         string `json:"type,omitempty"`
	Architecture string `json:"Architecture,omitempty"`
	SubArches    string `json:"subarches,omitempty"`
	KernelFlavor string `json:"kflavor,omitempty"`
}

func (*BootResource) SubArchitectures

func (b *BootResource) SubArchitectures() set.Strings

SubArchitectures implements BootResource.

type CommissionMachineArgs

type CommissionMachineArgs struct {
	EnableSSH            bool
	SkipBMCConfig        bool
	SkipNetworking       bool
	SkipStorage          bool
	CommissioningScripts string
	TestingScript        string
}

type ConstraintMatches

type ConstraintMatches struct {
	// NetworkInterface is a mapping of the constraint Label specified to the Interfaces
	// that match that constraint.
	Interfaces map[string][]NetworkInterface

	// Storage is a mapping of the constraint Label specified to the BlockDevices
	// that match that constraint.
	Storage map[string][]BlockDevice
}

ConstraintMatches provides a way for the caller of AllocateMachine to determine .how the allocated MachineInterface matched the storage and interfaces constraints specified. The labels that were used in the constraints are the keys in the maps.

type Controller

type Controller struct {
	Client     *client.MAASClient
	APIVersion version.Number
	// Capabilities returns a set of Capabilities as defined by the string
	// constants.
	Capabilities set.Strings
}

Controller represents an API connection to a maas. Since the API is restful, there is no long held connection to the API server, but instead HTTP calls are made and JSON response structures parsed.

func NewController

func NewController(args ControllerArgs) (*Controller, error)

NewController creates an authenticated Client to the maas API, and checks the Capabilities of the server. If the BaseURL specified includes the API version, that version of the API will be used, otherwise the ControllerInterface will use the highest supported version available.

If the APIKey is not valid, a NotValid error is returned. If the credentials are incorrect, a PermissionError is returned.

func NewControllerUnknownVersion

func NewControllerUnknownVersion(args ControllerArgs) (*Controller, error)

func NewControllerWithVersion

func NewControllerWithVersion(baseURL, apiVersion, apiKey string) (*Controller, error)

func (*Controller) AddFile

func (c *Controller) AddFile(args AddFileArgs) error

AddFile adds or replaces the Content of the specified Filename. If or when the maas api is able to return metadata about a single File without sending the Content of the File, we can return a FileInterface instance here too.

func (*Controller) AllocateMachine

func (c *Controller) AllocateMachine(args AllocateMachineArgs) (*Machine, ConstraintMatches, error)

AllocateMachine will attempt to allocate a MachineInterface to the user. If successful, the allocated MachineInterface is returned. Returns an error that satisfies IsNoMatchError if the requested constraints cannot be met.

func (*Controller) BootResources

func (c *Controller) BootResources() ([]*BootResource, error)

BootResources implements ControllerInterface.

func (*Controller) CreateNode

func (c *Controller) CreateNode(args CreateNodeArgs) (*Node, error)

CreateNode creates and returns a new NodeInterface.

func (Controller) Delete

func (c Controller) Delete(path string) error

func (*Controller) DeleteFile

func (c *Controller) DeleteFile(f *File) error

Delete implements FileInterface.

func (*Controller) Fabrics

func (c *Controller) Fabrics() ([]Fabric, error)

Fabrics returns the list of Fabrics defined in the maas ControllerInterface.

func (Controller) Get

func (c Controller) Get(path string, op string, params url.Values) ([]byte, error)

func (*Controller) GetAPIVersionInfo

func (c *Controller) GetAPIVersionInfo() (set.Strings, error)

func (*Controller) GetFile

func (c *Controller) GetFile(filename string) (*File, error)

GetFile returns a single File by its Filename.

func (*Controller) Machines

func (c *Controller) Machines(args MachinesArgs) ([]Machine, error)

Machines returns a list of machines that match the params.

func (*Controller) Nodes

func (c *Controller) Nodes(args NodesArgs) ([]Node, error)

Nodes returns a list of devices that match the params.

func (Controller) Post

func (c Controller) Post(path, op string, params url.Values) ([]byte, error)

func (Controller) PostFile

func (c Controller) PostFile(path, op string, params url.Values, fileContent []byte) ([]byte, error)

func (Controller) Put

func (c Controller) Put(path string, params url.Values) ([]byte, error)

func (*Controller) ReadFileContent

func (c *Controller) ReadFileContent(f *File) ([]byte, error)

func (*Controller) ReleaseMachines

func (c *Controller) ReleaseMachines(args ReleaseMachinesArgs) error

ReleaseMachines will stop the specified machines, and release them from the user making them available to be allocated again. Release multiple machines at once. Returns

  • BadRequestError if any of the machines cannot be found
  • PermissionError if the user does not have permission to release any of the machines
  • CannotCompleteError if any of the machines could not be released due to their current state

func (*Controller) Spaces

func (c *Controller) Spaces() ([]Space, error)

Spaces returns the list of Spaces defined in the maas ControllerInterface.

func (*Controller) StaticRoutes

func (c *Controller) StaticRoutes() ([]StaticRoute, error)

StaticRoutes returns the list of StaticRoutes defined in the maas ControllerInterface.

func (*Controller) Zones

func (c *Controller) Zones() ([]Zone, error)

Zones lists all the zones known to the maas ControllerInterface.

type ControllerArgs

type ControllerArgs struct {
	BaseURL string
	APIKey  string
}

ControllerArgs is an argument struct for passing the required parameters to the NewController method.

type CreateInterfaceArgs

type CreateInterfaceArgs struct {
	// Name of the interface (required).
	Name string
	// MACAddress is the MAC address of the interface (required).
	MACAddress string
	// VLAN is the untagged VLAN the interface is connected to (required).
	VLAN *VLAN
	// Tags to attach to the interface (optional).
	Tags []string
	// MTU - Maximum transmission unit. (optional)
	MTU int
	// AcceptRA - Accept router advertisements. (IPv6 only)
	AcceptRA bool
	// Autoconf - Perform stateless autoconfiguration. (IPv6 only)
	Autoconf bool
}

CreateInterfaceArgs is an argument struct for passing parameters to the MachineInterface.CreateInterface method.

func (*CreateInterfaceArgs) Validate

func (a *CreateInterfaceArgs) Validate() error

Validate checks the required fields are set for the arg structure.

type CreateMachineNodeArgs

type CreateMachineNodeArgs struct {
	Hostname      string
	InterfaceName string
	MACAddress    string
	Subnet        *Subnet
	VLAN          *VLAN
}

CreatemachineDeviceArgs is an argument structure for Machine.CreateNode. Only InterfaceName and MACAddress fields are required, the others are only used if set. If Subnet and VLAN are both set, Subnet.VLAN() must match the given VLAN. On failure, returns an error satisfying errors.IsNotValid().

func (*CreateMachineNodeArgs) Validate

func (a *CreateMachineNodeArgs) Validate() error

Validate ensures that all required Values are non-emtpy.

type CreateNodeArgs

type CreateNodeArgs struct {
	Hostname     string
	MACAddresses []string
	Domain       string
	Parent       string
}

CreateNodeArgs is a argument struct for passing information into CreateNode.

type DeployMachineArgs

type DeployMachineArgs struct {
	// UserData needs to be Base64 encoded user data for cloud-init.
	UserData     string
	DistroSeries string
	Kernel       string
	AgentName    string
	BridgeAll    bool
	BridgeSTP    bool
	BridgeFD     int
	Comment      string
	InstallRackd bool
}

DeployMachineArgs is an argument struct for passing parameters to the Machine.Deploy method.

type Fabric

type Fabric struct {
	// Add the ControllerInterface in when we need to do things with the Fabric.
	// ControllerInterface ControllerInterface
	ResourceURI string  `json:"resource_uri,omitempty"`
	ID          int     `json:"ID,omitempty"`
	Name        string  `json:"Name,omitempty"`
	ClassType   string  `json:"class_type,omitempty"`
	VLANs       []*VLAN `json:"VLANs,omitempty"`
}

Fabric represents a set of interconnected VLANs that are capable of mutual communication. A Fabric can be thought of as a logical grouping in which VLANs can be considered unique.

For cmd, a distributed network may have a Fabric in London containing VLAN 100, while a separate Fabric in San Francisco may contain a VLAN 100, whose attached Subnets are completely different and unrelated.

type File

type File struct {
	Controller  *Controller `json:"-"`
	ResourceURI string      `json:"resource_uri,string,omitempty"`
	// Filename is the Name of the File. No Path, just the Filename.
	Filename string `json:"Filename,string,omitempty"`
	// AnonymousURI is a URL that can be used to retrieve the contents of the
	// File without credentials.
	AnonymousURI *url.URL `json:"anon_resource_uri,string,omitempty"`
	Content      string   `json:"Content,string,omitempty"`
}

func (*File) UnmarshalJSON

func (f *File) UnmarshalJSON(j []byte) error

UnmarshalJSON allows json.Unmarshal to properly unmarshal json

type Filesystem

type Filesystem struct {
	// There is no need for ControllerInterface based parsing of filesystems until we need it.
	// Currently the Filesystem reading is only called by the Partition parsing.
	Type       string `json:"Type,omitempty"`
	MountPoint string `json:"mount_point,omitempty"`
	Label      string `json:"Label,omitempty"`
	UUID       string `json:"UUID,omitempty"`
}

type InterfaceLinkMode

type InterfaceLinkMode string

InterfaceLinkMode is the type of the various Link Mode constants used for LinkSubnetArgs.

const (
	// LinkModeDHCP - Bring the interface up with DHCP on the given Subnet. Only
	// one Subnet can be set to DHCP. If the Subnet is managed this interface
	// will pull from the dynamic IP range.
	LinkModeDHCP InterfaceLinkMode = "DHCP"

	// LinkModeStatic - Bring the interface up with a STATIC IP address on the
	// given Subnet. Any number of STATIC Links can exist on an interface.
	LinkModeStatic InterfaceLinkMode = "STATIC"

	// LinkModeLinkUp - Bring the interface up only on the given Subnet. No IP
	// address will be assigned to this interface. The interface cannot have any
	// current DHCP or STATIC Links.
	LinkModeLinkUp InterfaceLinkMode = "LINK_UP"
)

type InterfaceSpec

type InterfaceSpec struct {
	// Label is required and an arbitrary string. Labels need to be unique
	// across the InterfaceSpec elements specified in the AllocateMachineArgs.
	// The Label is returned in the ConstraintMatches response from
	// AllocateMachine.
	Label string
	Space string
}

InterfaceSpec represents one element of network related constraints.

func (*InterfaceSpec) String

func (a *InterfaceSpec) String() string

String returns the interface spec as MaaS requires it.

func (*InterfaceSpec) Validate

func (a *InterfaceSpec) Validate() error

Validate ensures that a Label is specified and that there is at least one Space or NotSpace value set.

type Link struct {
	ID        int     `json:"ID,omitempty"`
	Mode      string  `json:"Mode,omitempty"`
	Subnet    *Subnet `json:"Subnet,omitempty"`
	IPAddress string  `json:"ip_address,omitempty"`
}

type LinkSubnetArgs

type LinkSubnetArgs struct {
	// Mode is used to describe how the address is provided for the Link.
	// Required field.
	Mode InterfaceLinkMode
	// Subnet is the Subnet to Link to. Required field.
	Subnet *Subnet
	// IPAddress is only valid when the Mode is set to LinkModeStatic. If
	// not specified with a Mode of LinkModeStatic, an IP address from the
	// Subnet will be auto selected.
	IPAddress string
	// DefaultGateway will set the gateway IP address for the Subnet as the
	// default gateway for the Machine or node the interface belongs to.
	// Option can only be used with Mode LinkModeStatic.
	DefaultGateway bool
}

LinkSubnetArgs is an argument struct for passing parameters to the NetworkInterface.LinkSubnet method.

func (*LinkSubnetArgs) Validate

func (a *LinkSubnetArgs) Validate() error

Validate ensures that the Mode and Subnet are set, and that the other options are consistent with the Mode.

type Machine

type Machine struct {
	Controller *Controller `json:"-"`

	ResourceURI string   `json:"resource_uri,omitempty"`
	SystemID    string   `json:"system_id,omitempty"`
	Hostname    string   `json:"Hostname,omitempty"`
	FQDN        string   `json:"FQDN,omitempty"`
	Tags        []string `json:"tag_names,omitempty"`
	// OwnerData returns a copy of the key/value data stored for this
	// object.
	OwnerData       map[string]string `json:"owner_data,omitempty"`
	OperatingSystem string            `json:"osystem,omitempty"`
	DistroSeries    string            `json:"distro_series,omitempty"`
	Architecture    string            `json:"Architecture,omitempty"`
	Memory          int               `json:"Memory,omitempty"`
	CPUCount        int               `json:"cpu_count,omitempty"`
	IPAddresses     []string          `json:"ip_addresses,omitempty"`
	PowerState      string            `json:"power_state,omitempty"`
	// NOTE: consider some form of status struct
	StatusName    string `json:"status_name,omitempty"`
	StatusMessage string `json:"status_message,omitempty"`
	// BootInterface returns the interface that was used to boot the MachineInterface.
	BootInterface *NetworkInterface `json:"boot_interface,omitempty"`
	// InterfaceSet returns all the interfaces for the MachineInterface.
	InterfaceSet []*NetworkInterface `json:"interface_set,omitempty"`
	Zone         *Zone               `json:"Zone,omitempty"`

	// PhysicalBlockDevice returns the physical block node for the MachineInterface
	// that matches the ID specified. If there is no match, nil is returned.
	PhysicalBlockDevices []*BlockDevice `json:"physicalblockdevice_set,omitempty"`
	// BlockDevices returns all the physical and virtual block devices on the MachineInterface.
	BlockDevices []*BlockDevice `json:"blockdevice_set,omitempty"`
	Kernel       string         `json:"hwe_kernel,omitempty"`
}

MachineInterface represents a physical MachineInterface.

func (*Machine) BlockDevice

func (m *Machine) BlockDevice(id int) *BlockDevice

BlockDevice implements Machine.

func (*Machine) CreateNode

func (m *Machine) CreateNode(args CreateMachineNodeArgs) (*Node, error)

CreateNode implements Machine

func (*Machine) Deploy

func (m *Machine) Deploy(args DeployMachineArgs) error

Deploy implements Machine.

func (*Machine) Interface

func (m *Machine) Interface(id int) *NetworkInterface

NetworkInterface implements Machine.

func (*Machine) Nodes

func (m *Machine) Nodes(args NodesArgs) ([]Node, error)

Nodes implements Machine.

func (*Machine) PhysicalBlockDevice

func (m *Machine) PhysicalBlockDevice(id int) *BlockDevice

PhysicalBlockDevice implements Machine.

func (*Machine) SetOwnerData

func (m *Machine) SetOwnerData(ownerData map[string]string) error

SetOwnerData updates the key/value data stored for this object with the Values passed in. Existing keys that aren't specified in the map passed in will be left in place; to clear a key set its value to "". All Owner data is cleared when the object is released.

type MachineInterface

type MachineInterface interface {
	OwnerDataHolderInterface

	// Nodes returns a list of devices that match the params and have
	// this MachineInterface as the Parent.
	Nodes(NodesArgs) ([]NodeInterface, error)

	// NetworkInterface returns the interface for the MachineInterface that matches the ID
	// specified. If there is no match, nil is returned.
	Interface(id int) *NetworkInterface
	// BlockDevice returns the block node for the MachineInterface that matches the
	// ID specified. If there is no match, nil is returned.
	BlockDevice(id int) BlockDevice

	// Deploy the MachineInterface and install the operating system specified in the args.
	Deploy(DeployMachineArgs) error

	// CreateNode creates a new NodeInterface with this MachineInterface as the Parent.
	// The node will have one interface that is linked to the specified Subnet.
	CreateNode(CreateMachineNodeArgs) (NodeInterface, error)
}

type MachineOp

type MachineOp string
const (

	// Comission begins commissioning process for a machine.
	MachineComission MachineOp = "commission"
	// Deploy an operating system to a machine.
	MachineDeploy MachineOp = "deploy"
	// Details obtains various system details.
	MachineDetails MachineOp = "details"
	// GetCurtinConfig returns the rendered curtin configuration for the machine.
	MachineGetCurtinConfig MachineOp = "get_curtin_config"
	// PowerParams obtain power parameters.
	PowerParams MachineOp = "power_parameters"
	// Abort a machine's current operation
	MachineAbort MachineOp = "abort"
	// clear_default_gateways
	MachineClearDefaultGateways MachineOp = "clear_default_gateways"
	// ExitRescueMode exits rescue mode process for a machine.
	MachineExitRescueMode MachineOp = "exit_rescue_mode"
	// MarkBroken marks a node as 'broken'.
	MachineMarkBroken MachineOp = "mark_broken"
	// MarkFixed mark a broken node as fixed and set its status as 'ready'.
	MachineMarkFixed MachineOp = "mark_fixed"
	// MountSpecial Mount a special-purpose filesystem, like tmpfs.
	MachineMountSpecial MachineOp = "mount_special"
	// PowerOFF to request Power off a node.
	MachinePowerOFF MachineOp = "power_off"
	// PowerON Turn on a node.
	MachinePowerON MachineOp = "power_on"
	// Release  a machine. Opposite of Machines.allocate.
	MachineRelease MachineOp = "release"
	// Begin rescue mode process for a machine.
	MachineRescueMode MachineOp = "rescue_mode"
	// Reset a machine's configuration to its initial state.
	MachineRestoreDefaultConfig MachineOp = "restore_default_configuration"
	// Reset a machine's networking options to its initial state.
	MachineRestoreNetworkConfig MachineOp = "restore_networking_configuration"
	// Reset a machine's storage options to its initial state.
	MachineRestoreStorageConfig MachineOp = "restore_storage_configuration"
	// Set key/value data for the current owner.
	MachineSetOwnerData MachineOp = "set_owner_data"
	// Changes the storage layout on the machine.
	MachineSetStorageLayout MachineOp = "set_storage_layout"
	// Unmount a special-purpose filesystem, like tmpfs.
	MachineUnmountSpecial MachineOp = "unmount_special"
)

type MachinesArgs

type MachinesArgs struct {
	Hostnames    []string
	MACAddresses []string
	SystemIDs    []string
	Domain       string
	Zone         string
	AgentName    string
	OwnerData    map[string]string
}

MachinesArgs is a argument struct for selecting Machines. Only machines that match the specified criteria are returned.

type MachinesOp

type MachinesOp string
const (
	// Allocate an available machine for deployment.
	Allocate MachinesOp = "allocate"
)

type NetworkInterface

type NetworkInterface struct {
	Controller   *Controller `json:"-"`
	ResourceURI  string      `json:"resource_uri,omitempty"`
	ID           int         `json:"ID,omitempty"`
	Name         string      `json:"Name,omitempty"`
	Type         string      `json:"type,omitempty"`
	Enabled      bool        `json:"Enabled,omitempty"`
	Tags         []string    `json:"Tags,omitempty"`
	VLAN         *VLAN       `json:"VLAN,omitempty"`
	Links        []*Link     `json:"Links,omitempty"`
	MACAddress   string      `json:"mac_address,omitempty"`
	EffectiveMTU int         `json:"effective_mtu,omitempty"`
	Parents      []string    `json:"Parents,omitempty"`
	Children     []string    `json:"Children,omitempty"`
}

NetworkInterface represents a physical or virtual network interface on a MachineInterface.

func (*NetworkInterface) Delete

func (i *NetworkInterface) Delete() error

Delete this interface.

func (*NetworkInterface) LinkSubnet

func (i *NetworkInterface) LinkSubnet(args LinkSubnetArgs) error

LinkSubnet will attempt to make this interface available on the specified Subnet.

func (*NetworkInterface) UnlinkSubnet

func (i *NetworkInterface) UnlinkSubnet(s *Subnet) error

UnlinkSubnet will remove the Link to the Subnet, and release the IP address associated if there is one.

func (*NetworkInterface) Update

func (i *NetworkInterface) Update(args UpdateInterfaceArgs) error

Update the Name, mac address or VLAN.

type Node

type Node struct {
	// TODO: add domain
	Controller  *Controller `json:"-"`
	ResourceURI string      `json:"resource_uri,omitempty"`
	SystemID    string      `json:"system_id,omitempty"`
	Hostname    string      `json:"Hostname,omitempty"`
	FQDN        string      `json:"FQDN,omitempty"`
	// Parent returns the SystemID of the Parent. Most often this will be a
	// MachineInterface.
	Parent string `json:"Parent,omitempty"`
	// Owner is the username of the user that created the Node.
	Owner       string   `json:"owner,omitempty"`
	IPAddresses []string `json:"ip_addresses,omitempty"`
	// InterfaceSet returns all the interfaces for the NodeInterface.
	InterfaceSet []*NetworkInterface `json:"interface_set,omitempty"`
	Zone         *Zone               `json:"Zone,omitempty"`
	Tags         []string            `json:"tag_names,omitempty"`
	Type         string              `json:"node_type_name,omitempty"`
}

Nodes are now known as nodes...? should reconsider this struct. Device represents some form of Node in maas.

func (*Node) CreateInterface

func (d *Node) CreateInterface(args CreateInterfaceArgs) (*NetworkInterface, error)

CreateInterface implements NodeInterface.

func (*Node) Delete

func (d *Node) Delete() error

Delete implements NodeInterface.

type NodeInterface

type NodeInterface interface {
	// CreateInterface will create a physical interface for this MachineInterface.
	CreateInterface(CreateInterfaceArgs) (*NetworkInterface, error)
	// Delete will remove this NodeInterface.
	Delete() error
}

type NodeOp

type NodeOp string
const (
	NodeDetails         NodeOp = "details"
	NodePowerParameters NodeOp = "power_parameters"
)

type NodesArgs

type NodesArgs struct {
	Hostname     []string
	MACAddresses []string
	SystemIDs    []string
	Domain       string
	Zone         string
	AgentName    string
}

NodesArgs is a argument struct for selecting Nodes. Only devices that match the specified criteria are returned.

type NodesOp

type NodesOp string
const (
	SetZone NodesOp = "set_zone"
)

type OwnerDataHolderInterface

type OwnerDataHolderInterface interface {
	// SetOwnerData updates the key/value data stored for this object
	// with the Values passed in. Existing keys that aren't specified
	// in the map passed in will be left in place; to clear a key set
	// its value to "". All Owner data is cleared when the object is
	// released.
	SetOwnerData(map[string]string) error
}

OwnerDataHolderInterface represents any maas object that can store key/value data.

type Partition

type Partition struct {
	ResourceURI string      `json:"resource_uri,omitempty"`
	ID          int         `json:"ID,omitempty"`
	Path        string      `json:"Path,omitempty"`
	UUID        string      `json:"UUID,omitempty"`
	UsedFor     string      `json:"used_for,omitempty"`
	Size        uint64      `json:"Size,omitempty"`
	FileSystem  *Filesystem `json:"Filesystem,omitempty"`
}

type ReleaseMachinesArgs

type ReleaseMachinesArgs struct {
	SystemIDs   []string
	Comment     string
	Erase       bool
	SecureErase bool
	QuickErase  bool
}

ReleaseMachinesArgs is an argument struct for passing the MachineInterface system IDs and an optional comment into the ReleaseMachines method.

type Space

type Space struct {
	// Add the ControllerInterface in when we need to do things with the Space.
	// ControllerInterface ControllerInterface
	ResourceURI string    `json:"resource_uri,omitempty"`
	ID          int       `json:"ID,omitempty"`
	Name        string    `json:"Name,omitempty"`
	Subnets     []*Subnet `json:"Subnets,omitempty"`
}

type StaticRoute

type StaticRoute struct {
	ResourceURI string `json:"resource_uri,omitempty"`
	ID          int    `json:"id,omitempty"`
	// Source is the Subnet that should have the route configured. (Machines
	// inside Source should use GatewayIP to reach Destination addresses.)
	Source *Subnet `json:"source,omitempty"`
	// Destination is the Subnet that a MachineInterface wants to send packets to. We
	// want to configure a route to that Subnet via GatewayIP.
	Destination *Subnet `json:"destination,omitempty"`
	// GatewayIP is the IPAddress to direct traffic to.
	GatewayIP string `json:"gateway_ip,omitempty"`
	// Metric is the routing Metric that determines whether this route will
	// take precedence over similar routes (there may be a route for 10/8, but
	// also a more concrete route for 10.0/16 that should take precedence if it
	// applies.) Metric should be a non-negative integer.
	Metric int `json:"metric,omitempty"`
}

StaticRoute defines an explicit route that users have requested to be added for a given Subnet.

type StorageSpec

type StorageSpec struct {
	// Label is optional and an arbitrary string. Labels need to be unique
	// across the StorageSpec elements specified in the AllocateMachineArgs.
	Label string
	// Size is required and refers to the required minimum Size in GB.
	Size int
	// Zero or more Tags assocated to with the disks.
	Tags []string
}

StorageSpec represents one element of storage constraints necessary to be satisfied to allocate a MachineInterface.

func (*StorageSpec) String

func (s *StorageSpec) String() string

String returns the string representation of the storage spec.

func (*StorageSpec) Validate

func (s *StorageSpec) Validate() error

Validate ensures that there is a positive Size and that there are no Empty tag Values.

type Subnet

type Subnet struct {
	// Add the ControllerInterface in when we need to do things with the Subnet.
	// ControllerInterface ControllerInterface
	ResourceURI string `json:"resource_uri,omitempty"`
	ID          int    `json:"ID,omitempty"`
	Name        string `json:"Name,omitempty"`
	Space       string `json:"Space,omitempty"`
	VLAN        *VLAN  `json:"VLAN,omitempty"`
	Gateway     string `json:"gateway_ip,omitempty"`
	CIDR        string `json:"cidr,omitempty"`
	// DNSServers is a list of ip addresses of the DNS servers for the Subnet.
	// This list may be empty.
	DNSServers []string `json:"dns_servers,omitempty"`
}

type UpdateInterfaceArgs

type UpdateInterfaceArgs struct {
	Name       string
	MACAddress string
	VLAN       *VLAN
}

UpdateInterfaceArgs is an argument struct for calling NetworkInterface.Update.

type VLAN

type VLAN struct {
	// Add the ControllerInterface in when we need to do things with the VLAN.
	// ControllerInterface ControllerInterface
	ResourceURI string `json:"resource_uri,omitempty"`
	ID          int    `json:"ID,omitempty"`
	Name        string `json:"Name,omitempty"`
	Fabric      string `json:"Fabric,omitempty"`
	// VID is the VLAN ID. eth0.10 -> VID = 10.
	VID int `json:"VID,omitempty"`
	// MTU (maximum transmission unit) is the largest Size packet or frame,
	// specified in octets (eight-bit bytes), that can be sent.
	MTU           int    `json:"MTU,omitempty"`
	DHCP          bool   `json:"dhcp_on,omitempty"`
	PrimaryRack   string `json:"primary_rack,omitempty"`
	SecondaryRack string `json:"secondary_rack,omitempty"`
}

VLAN represents an instance of a Virtual LAN. VLANs are a common way to create logically separate networks using the same physical infrastructure.

Managed switches can assign VLANs to each port in either a “tagged” or an “untagged” manner. A VLAN is said to be “untagged” on a particular port when it is the default VLAN for that port, and requires no special configuration in order to access.

“Tagged” VLANs (traditionally used by network administrators in order to aggregate multiple networks over inter-switch “trunk” lines) can also be used with nodes in MAAS. That is, if a switch port is configured such that “tagged” VLAN frames can be sent and received by a MAAS node, that MAAS node can be configured to automatically bring up VLAN interfaces, so that the deployed node can make use of them.

A “Default VLAN” is created for every Fabric, to which every new VLAN-aware object in the Fabric will be associated to by default (unless otherwise specified).

type Version

type Version struct {
	Capabilities []string `json:"capabilities,omitempty"`
	Version      string   `json:"version,omitempty"`
	SubVersion   string   `json:"subversion,omitempty"`
}

type Zone

type Zone struct {
	// Add the ControllerInterface in when we need to do things with the Zone.
	// ControllerInterface ControllerInterface
	ResourceURI string `json:"resource_uri,omitempty"`
	Name        string `json:"Name,omitempty"`
	Description string `json:"Description,omitempty"`
}

Zone represents a physical Zone that a MachineInterface is in. The meaning of a physical Zone is up to you: it could identify e.g. a server rack, a network, or a data centre. Users can then allocate nodes from specific physical zones, to suit their redundancy or performance requirements.

Jump to

Keyboard shortcuts

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