Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/canonical/gomaasclient
Go MAAS client
https://github.com/canonical/gomaasclient
Last synced: 9 days ago
JSON representation
Go MAAS client
- Host: GitHub
- URL: https://github.com/canonical/gomaasclient
- Owner: canonical
- License: apache-2.0
- Created: 2021-04-26T09:46:44.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-27T13:27:33.000Z (15 days ago)
- Last Synced: 2024-11-27T14:30:13.790Z (15 days ago)
- Language: Go
- Size: 339 KB
- Stars: 23
- Watchers: 10
- Forks: 28
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - canonical/gomaasclient - Go MAAS client (Go)
README
# Golang MAAS Client
## :warning: Repository ownership and module name change
The GoMAASClient repository now lives under the [Canonical GitHub organisation](https://github.com/canonical) 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:
```go
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](https://go.dev/ref/mod#go-mod-file-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
```Go
import (
gomaasclient "github.com/canonical/gomaasclient/client"
"github.com/canonical/gomaasclient/entity"
)c, _ := gomaasclient.GetClient("", "", "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)](https://github.com/onwsk8r) as part of his [Terraform MAAS provider](https://github.com/Roblox/terraform-provider-maas) implementation.