gomaasclient

module
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0

README

Golang MAAS Client

⚠ Repository ownership and module name change

The GoMAASClient repository now lives under the Canonical GitHub organisation with a new module name github.com/canonical/gomaasclient.

If you are not using GOPROXY=https://proxy.golang.org/cached-only or not caching modules, your development environment or CI might encounter failures when trying to retrieve the module by its old name.

If you encounter an error to the likes of:

module declares its path as: github.com/canonical/gomaasclient
        but was required as: github.com/maas/gomaasclient

Ensure you are pointing at the new module URL, which is github.com/canonical/gomaasclient. You can use the replace directive, so you don't have to change old imports everywhere.


This repository contains the following packages:

  • api - defines an interface to each MAAS API endpoint.
  • entity - defines types for the MAAS API endpoints' return types.
  • client - contains the MAAS client source code.

Usage

import (
    gomaasclient "github.com/canonical/gomaasclient/client"
    "github.com/canonical/gomaasclient/entity"
)

c, _ := gomaasclient.GetClient("<MAAS_URL>", "<API_KEY>", "2.0")

// List MAAS machines
machines, _ := c.Machines.Get(&entity.MachinesParams{})

// Get MAAS machine details
machine, _ := c.Machine.Get(machines[0].SystemID)

// List MAAS VM hosts
vmHosts, _ := c.VMHosts.Get()

Credit

This work was initially started by Brian Hazeltine (@onwsk8r) as part of his Terraform MAAS provider implementation.

Directories

Path Synopsis
Package api defines an interface to each MAAS API endpoint.
Package api defines an interface to each MAAS API endpoint.
Package client contains the implementation of CRUD operations on MAAS resources.
Package client contains the implementation of CRUD operations on MAAS resources.
Package entity defines types for the MAAS API endpoints' return types.
Package entity defines types for the MAAS API endpoints' return types.
event
Package event contains entities related to events.
Package event contains entities related to events.
node
Package node contains entities related to nodes.
Package node contains entities related to nodes.
notification
Package notification contains entities related to notifications.
Package notification contains entities related to notifications.
subnet
Package subnet contains entities related to subnets.
Package subnet contains entities related to subnets.
test
helper
Package helper contains helper functions for unit tests.
Package helper contains helper functions for unit tests.

Jump to

Keyboard shortcuts

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