modulepackage
0.0.0-20200122030159-1ba86139ece3
Repository: https://github.com/seanhoughton/gomaasapi.git
Documentation: pkg.go.dev
# README
.. -- mode: rst --
MAAS API client library for Go
This library serves as a minimal client for communicating with the MAAS web API in Go programs.
For more information see the project homepage
_.
.. _project homepage: https://github.com/juju/gomaasapi
# Functions
AddAPIVersionToURL will add the version/<version>/ suffix to the given URL, handling trailing slashes.
EnsureTrailingSlash appends a slash at the end of the given string unless there already is one.
GetServerError returns the ServerError from the cause of the error if it is a ServerError, and also returns the bool to indicate if it was a ServerError or not.
InternalError replies to the request with an HTTP 500 internal error.
IPFromInt64 creates a new IP from a uint64 IP address representation.
IPFromNetIP creates a IP from a net.IP.
IPFromString creates a new IP from a string IP address representation.
IsBadRequestError returns true if err is a NoMatchError.
IsCannotCompleteError returns true if err is a NoMatchError.
IsDeserializationError returns true if err is a DeserializationError.
IsNoMatchError returns true if err is a NoMatchError.
IsPermissionError returns true if err is a NoMatchError.
IsUnexpectedError returns true if err is an UnexpectedError.
IsUnsupportedVersionError returns true if err is an UnsupportedVersionError.
JoinURLs joins a base URL and a subpath together.
JSONObjectFromStruct takes a struct and converts it to a JSONObject.
NameOrIDToID takes a string that contains eiter an integer ID or the name of a thing.
NewAnonymousClient creates a client that issues anonymous requests.
NewAuthenticatedClient parses the given MAAS API key into the individual OAuth tokens and creates an Client that will use these tokens to sign the requests it issues.
NewBadRequestError constructs a new BadRequestError and sets the location.
NewCannotCompleteError constructs a new CannotCompleteError and sets the location.
NewController creates an authenticated client to the MAAS API, and checks the capabilities of the server.
NewDeserializationError constructs a new DeserializationError and sets the location.
NewMAAS returns an interface to the MAAS API as a *MAASObject.
NewNoMatchError constructs a new NoMatchError and sets the location.
NewPermissionError constructs a new PermissionError and sets the location.
No description provided by the author
No description provided by the author
NewTestMAAS returns a TestMAASObject that implements the MAASObject interface and thus can be used as a test object instead of the one returned by gomaasapi.NewMAAS().
NewTestServer starts and returns a new MAAS test server.
NewUnexpectedError constructs a new UnexpectedError and sets the location.
NewUnsupportedVersionError constructs a new UnsupportedVersionError and sets the location.
NewURLParams allocates a new URLParams type.
Parse a JSON blob into a JSONObject.
No description provided by the author
SplitVersionedURL splits a versioned API URL (like http://maas.server/MAAS/api/2.0/) into a base URL (http://maas.server/MAAS/) and API version (2.0).
WrapWithDeserializationError constructs a new DeserializationError with the specified message, and sets the location and returns a new error with the full error stack set including the error passed in.
WrapWithUnsupportedVersionError constructs a new UnsupportedVersionError wrapping the passed error.
# Constants
No description provided by the author
No description provided by the author
LinkModeDHCP - Bring the interface up with DHCP on the given subnet.
LinkModeLinkUp - Bring the interface up only on the given subnet.
LinkModeStatic - Bring the interface up with a STATIC IP address on the given subnet.
No description provided by the author
Capability constants.
The node has been allocated to a user and is ready for deployment.
The node is broken: a step in the node lifecyle failed.
Testing and other commissioning steps are taking place.
The node has been created and has a system ID assigned to it.
The node is powering a service from a charm or is ready for use with a fresh Ubuntu install.
The node is being installed.
The node is erasing its disks.
The deployment of the node failed.
The node failed to erase its disks.
The releasing of the node failed.
Smoke or burn-in testing has a found a problem.
The node can’t be contacted.
The node is in the general pool ready to be deployed.
The node is powering down after a release request.
The node is ready for named deployment.
The node has been removed from service manually until an admin overrides the retirement.
Number of retries performed when the server returns a 503 response with a 'Retry-after' header.
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
# Structs
AddFileArgs is a argument struct for passing information into AddFile.
AddressRange is used to generate reserved IP address range lists.
AddressRangeList is a list of AddressRange.
AllocateMachineArgs is an argument struct for passing args into Machine.Allocate.
BadRequestError is returned when the requested action cannot be performed due to bad or incorrect parameters passed to the server.
CannotCompleteError is returned when the requested action is unable to complete for some server side reason.
Client represents a way to communicating with a MAAS API instance.
ConstraintMatches provides a way for the caller of AllocateMachine to determine.how the allocated machine matched the storage and interfaces constraints specified.
ControllerArgs is an argument struct for passing the required parameters to the NewController method.
CreateDeviceArgs is a argument struct for passing information into CreateDevice.
CreateInterfaceArgs is an argument struct for passing parameters to the Machine.CreateInterface method.
CreateMachineDeviceArgs is an argument structure for Machine.CreateDevice.
CreateSpace is used to create new spaces on the server.
CreateStaticRoute is used to create new Static Routes on the server.
CreateSubnet is used to receive new subnets via the MAAS API.
DeserializationError types are returned when the returned JSON data from the controller doesn't match the code's expectations.
DevicesArgs is a argument struct for selecting Devices.
InterfaceSpec represents one element of network related constraints.
IP is an enhanced net.IP.
JSONObject is a wrapper around a JSON structure which provides methods to extract data from that structure.
LinkSubnetArgs is an argument struct for passing parameters to the Interface.LinkSubnet method.
MAASObject represents a MAAS object as returned by the MAAS API, such as a Node or a Tag.
MachinesArgs is a argument struct for selecting Machines.
NetworkLink represents a MAAS network link.
Node represents a node.
NodeNetworkInterface represents a network interface attached to a node.
NoMatchError is returned when the requested action cannot be performed due to being unable to service due to no entities available that match the request.
No description provided by the author
PermissionError is returned when the user does not have permission to do the requested action.
PostedVLAN is the MAAS API posted VLAN representation.
ReleaseMachinesArgs is an argument struct for passing the machine system IDs and an optional comment into the ReleaseMachines method.
ServerError is an http error (or at least, a non-2xx result) received from the server.
No description provided by the author
StartArgs is an argument struct for passing parameters to the Machine.Start method.
StorageSpec represents one element of storage constraints necessary to be satisfied to allocate a machine.
SubnetStats holds statistics about a subnet.
No description provided by the author
TestMAASObject is a fake MAAS server MAASObject.
A TestServer is an HTTP server listening on a system-chosen port on the local loopback interface, which simulates the behavior of a MAAS server.
TestSpace is the MAAS API space representation.
TestStaticRoute is the MAAS API Static Route representation.
TestSubnet is the MAAS API subnet representation.
TestVLAN is the MAAS API VLAN representation.
UnexpectedError is an error for a condition that hasn't been determined.
UnsupportedVersionError refers to calls made to an unsupported api version.
UpdateInterfaceArgs is an argument struct for calling Interface.Update.
URLParams wraps url.Values to easily add values, but skipping empty ones.
# Interfaces
BlockDevice represents an entire block device on the machine.
BootResource is the bomb..
Controller represents an API connection to a MAAS Controller.
Device represents some form of device in MAAS.
No description provided by the author
Fabric represents a set of interconnected VLANs that are capable of mutual communication.
File represents a file stored in the MAAS controller.
FileSystem represents a formatted filesystem mounted at a location.
Interface represents a physical or virtual network interface on a Machine.
Link represents a network link between an Interface and a Subnet.
Machine represents a physical machine.
No description provided by the author
OwnerDataHolder represents any MAAS object that can store key/value data.
Partition represents a partition of a block device.
Pool is just a logical separation of resources.
Space is a name for a collection of Subnets.
StaticRoute defines an explicit route that users have requested to be added for a given subnet.
StorageDevice represents any piece of storage on a machine.
Subnet refers to an IP range on a VLAN.
VLAN represents an instance of a Virtual LAN.
Zone represents a physical zone that a Machine is in.
# Type aliases
InterfaceLinkMode is the type of the various link mode constants used for LinkSubnetArgs.