oxide.go

module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MPL-2.0

README

oxide.go

Go Reference

IMPORTANT: This SDK is under heavy development and will have constant breaking changes.

The Go API client for administrating an Oxide rack.

To contribute to this repository make sure you read the contributing documentation.

Getting started

Make sure you have installed Go 1.21.x or above.

Installation

Use go get inside your module dependencies directory

go get github.com/oxidecomputer/oxide.go@latest
Usage example
package main

import (
	"fmt"

	"github.com/oxidecomputer/oxide.go/oxide"
)

func main() {
	cfg := oxide.Config{
		Address: "https://api.oxide.computer",
		Token:   "oxide-abc123",
	}
	client, err := oxide.NewClient(&cfg)
	if err != nil {
		panic(err)
	}

	ctx := context.Background()
	params := oxide.ProjectCreateParams{
		Body: &oxide.ProjectCreate{
			Description: "A sample project",
			Name:        oxide.Name("my-project"),
		},
	}

	resp, err := client.ProjectCreate(ctx, params)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%+v\n", resp)
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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