maasclient

package
v0.0.1-beta1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const (
	BootResourcesAPIPath      = "/boot-resources/"
	BootResourceAPIPathFormat = "/boot-resources/%d/"
)
View Source
const (
	// parametes
	FQDNKey         = "fqdn"
	DomainKey       = "domain"
	NameKey         = "name"
	ArchitectureKey = "architecture"
	SHA256Key       = "sha256"
	SizeKey         = "size"
	ZoneKey         = "zone"
	SystemIDKey     = "system_id"
	CPUCountKey     = "cpu_count"
	MemoryKey       = "mem"
	PoolLabel       = "pool"
	OSSystemKey     = "osystem"
	UserDataKey     = "user_data"
	DistroSeriesKey = "distro_series"
	TitleKey        = "title"
	ContentKey      = "content"
	FileTypeKey     = "filetype"
	RRTypeKey       = "rrtype"
	AllKey          = "all"
	AddressTTLKey   = "address_ttl"
	IPAddressesKey  = "ip_addresses"
	IDKey           = "id"
	EraseKey        = "erase"
	QuickEraseKey   = "quick_erase"
	SecureEraseKey  = "secure_erase"
	ForceKey        = "force"
	CommentKey      = "comment"
	SwapSizeKey     = "swap_size"
	HostnameKey     = "hostname"
	TrueKey         = "true"

	// Resource operations
	Operation                 = "op"
	OperationDeploy           = "deploy"
	OperationWhoAmI           = "whoami"
	OperationImportBootImages = "import_boot_images"
	OperationReleaseMachine   = "release"
	OperationAllocate         = "allocate"
)
View Source
const (
	DNSResourcesAPIPath  = "/dnsresources/"
	DNSResourceAPIFormat = "/dnsresources/%d/"
)
View Source
const (
	DomainsAPIPath      = "/domains/"
	DomainAPIPathFormat = "/domains/%d"
)
View Source
const (
	ResourcePoolsAPIPath      = "/resourcepools/"
	ResourcePoolAPIPathFormat = "/resourcepools/%d"
)
View Source
const (
	RackControllersAPIPath = "/rackcontrollers/"
)
View Source
const (
	UsersAPIPath = "/users/"
)
View Source
const (
	ZonesAPIPath = "/zones/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BootResource

type BootResource interface {
	BootResourceUploader
	Get(ctx context.Context) (BootResource, error)
	Delete(ctx context.Context) error
	ID() int
	Type() string
	Name() string
	Architecture() string
	SubArches() string
	Title() string
	Sets() map[string]Set
}

type BootResourceBuilder

type BootResourceBuilder interface {
	WithTitle(title string) BootResourceBuilder
	WithFileType(fileType string) BootResourceBuilder
	Create(ctx context.Context) (BootResource, error)
}

type BootResourceUploader

type BootResourceUploader interface {
	Upload(ctx context.Context) error
}

type BootResources

type BootResources interface {
	List(ctx context.Context, params Params) ([]BootResource, error)
	BootResource(id int) BootResource
	Builder(name, architecture, hash, filePath string, size int) BootResourceBuilder
}

Implements subset of https://maas.io/docs/api#boot-resources Usage bootstrap_test.go

func NewBootResourcesClient

func NewBootResourcesClient(client Client) BootResources

type Client

type Client interface {
	Get(ctx context.Context, path string, params url.Values) (*http.Response, error)
	PostForm(ctx context.Context, path string, contentType string, params url.Values, body io.Reader) (*http.Response, error)
	Post(ctx context.Context, path string, params url.Values) (*http.Response, error)
	Put(ctx context.Context, path string, params url.Values, body io.Reader, contentLength int) (*http.Response, error)
	PutParams(ctx context.Context, param string, params url.Values) (*http.Response, error)
	Delete(ctx context.Context, path string, params url.Values) (*http.Response, error)
}

type ClientSetInterface

type ClientSetInterface interface {
	BootResources() BootResources
	DNSResources() DNSResources
	Domains() Domains
	Machines() Machines
	RackControllers() RackControllers
	ResourcePools() ResourcePools
	Spaces() Spaces
	Users() Users
	Zones() Zones
}

func NewAuthenticatedClientSet

func NewAuthenticatedClientSet(maasEndpoint, apiKey string, options ...func(client *authenticatedClientSet)) ClientSetInterface

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

type DNSResource

type DNSResource interface {
	Delete(ctx context.Context) error
	Modifier() DNSResourceModifier
	Get(ctx context.Context) (DNSResource, error)
	ID() int
	FQDN() string
	AddressTTL() int
	IPAddresses() []IPAddress
}

type DNSResourceBuilder

type DNSResourceBuilder interface {
	WithFQDN(fqdn string) DNSResourceBuilder
	WithDomain(domain string) DNSResourceBuilder
	WithName(name string) DNSResourceBuilder
	WithAddressTTL(addressTTL string) DNSResourceBuilder
	WithIPAddresses(ipAddresses []string) DNSResourceBuilder
	Create(ctx context.Context) (DNSResource, error)
}

type DNSResourceModifier

type DNSResourceModifier interface {
	SetFQDN(fqdn string) DNSResourceModifier
	SetAddressTTL(addressTTL int) DNSResourceModifier
	SetIPAddresses(address []string) DNSResourceModifier
	SetName(name string) DNSResourceModifier
	SetDomain(name string) DNSResourceModifier
	Modify(ctx context.Context) (DNSResource, error)
}

type DNSResources

type DNSResources interface {
	List(ctx context.Context, params Params) ([]DNSResource, error)
	Builder() DNSResourceBuilder
	DNSResource(id int) DNSResource
}

func NewDNSResourcesClient

func NewDNSResourcesClient(client *authenticatedClient) DNSResources

type Domain

type Domain interface {
	ID() int
	IsAuthoritative() bool
	TTL() time.Duration
	IsDefault() bool
	Name() string
	ResourceRecordCount() int
}

type Domains

type Domains interface {
	List(ctx context.Context) ([]Domain, error)
	Domain(id int) Domain
}

func NewDomainsClient

func NewDomainsClient(client *authenticatedClient) Domains

type FilterType

type FilterType string

type IPAddress

type IPAddress interface {
	IP() net.IP
}

type Machine

type Machine interface {
	Get(ctx context.Context) (Machine, error)
	Delete(ctx context.Context) error
	Releaser() MachineReleaser
	Modifier() MachineModifier
	Deployer() MachineDeployer
	SystemID() string
	FQDN() string
	Zone() Zone
	PowerState() string
	Hostname() string
	IPAddresses() []net.IP
	State() string
	OSSystem() string
	DistroSeries() string
	SwapSize() int
}

type MachineAllocator

type MachineAllocator interface {
	Allocate(ctx context.Context) (Machine, error)
	WithZone(zone string) MachineAllocator
	WithSystemID(id string) MachineAllocator
	WithName(name string) MachineAllocator
	WithCPUCount(cpuCount int) MachineAllocator
	WithMemory(memory int) MachineAllocator
	WithResourcePool(pool string) MachineAllocator
}

type MachineDeployer

type MachineDeployer interface {
	SetOSSystem(ossytem string) MachineDeployer
	SetUserData(userdata string) MachineDeployer
	SetDistroSeries(distroseries string) MachineDeployer
	Deploy(ctx context.Context) (Machine, error)
}

type MachineModifier

type MachineModifier interface {
	SetSwapSize(size int) MachineModifier
	SetHostname(hostname string) MachineModifier
	Update(ctx context.Context) (Machine, error)
}

type MachineReleaser

type MachineReleaser interface {
	Release(ctx context.Context) (Machine, error)
	WithErase() MachineReleaser
	WithQuickErase() MachineReleaser
	WithSecureErase() MachineReleaser
	WithForce() MachineReleaser
	WithComment(comment string) MachineReleaser
}

type Machines

type Machines interface {
	List(ctx context.Context, params Params) ([]Machine, error)
	Machine(systemId string) Machine
	Allocator() MachineAllocator
}

func NewMachinesClient

func NewMachinesClient(client *authenticatedClient) Machines

type Params

type Params interface {
	Add(key, value string) Params
	Set(key, value string) Params
	Reset()
	Values() url.Values
	Copy(in Params)
}

func ParamsBuilder

func ParamsBuilder() Params

type RackControllers

type RackControllers interface {
	ImportBootImages(ctx context.Context) error
}

func NewRackControllersClient

func NewRackControllersClient(client *authenticatedClient) RackControllers

type ResourcePool

type ResourcePool interface {
	Name() string
	Description() string
	ID() int
}

type ResourcePools

type ResourcePools interface {
	List(ctx context.Context, params Params) ([]ResourcePool, error)
	ResourcePool(id int) ResourcePool
}

func NewResourcePoolsClient

func NewResourcePoolsClient(client *authenticatedClient) ResourcePools

type Set

type Set struct {
	Version  string             `json:"version"`
	Label    string             `json:"label"`
	Size     int                `json:"size"`
	Complete bool               `json:"complete"`
	Progress int                `json:"progress"`
	Files    map[string]SetFile `json:"files"`
}

type SetFile

type SetFile struct {
	FileName  string `json:"filename"`
	FileType  string `json:"filetype"`
	SHA256    string `json:"sha256"`
	Size      int    `json:"size"`
	Complete  bool   `json:"complete"`
	Progress  int    `json:"progress"`
	UploadURI string `json:"upload_uri"`
}

type Space

type Space interface {
	Name() string
	Subnets() []Subnet
}

type Spaces

type Spaces interface {
	List(ctx context.Context) ([]Space, error)
}

func NewSpacesClient

func NewSpacesClient(client *authenticatedClient) Spaces

type Subnet

type Subnet interface {
	ID() int
	Name() string
	Space() string
	VLAN() VLAN
}

type User

type User interface {
	IsSuperUser() bool
	UserName() string
	IsLocal() bool
	Email() string
}

type Users

type Users interface {
	List(ctx context.Context) ([]User, error)
	WhoAmI(ctx context.Context) (User, error)
}

func NewUsersClient

func NewUsersClient(client *authenticatedClient) Users

type VLAN

type VLAN interface {
	VID() int
	MTU() int
	IsDHCPOn() bool
	FabricID() int
	FabricName() string
}

type Zone

type Zone interface {
	ID() int
	Name() string
	Description() string
}

type Zones

type Zones interface {
	List(ctx context.Context) ([]Zone, error)
}

func NewZonesClient

func NewZonesClient(client Client) Zones

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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