gosh

module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT

README

Gosh

Gosh is a Go client library for accessing the SiteHost v1.3 API.

Installation

go get -u https://github.com/sitehostnz/gosh

Example

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/sitehostnz/gosh/pkg/api"
	"github.com/sitehostnz/gosh/pkg/api/server"
)

func main() {
	apiKey := os.Getenv("SH_API_KEY")
	clientId := os.Getenv("SH_CLIENT_ID")

	client := api.NewClient(apiKey, clientId)
	ctx := context.Background()

	instance := server.New(client)

	opts := server.CreateRequest{
		Label:       "goshserver",
		Location:    "AKLCITY",
		ProductCode: "XENLIT",
		Image:       "ubuntu-jammy-pvh.amd64",
		Params: server.ParamsOptions{
			SSHKeys: []string{"ssh-rsa ..."},
		},
	}

	server, err := instance.Create(ctx, opts)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%v", server)
}

Documentation

The structure of this library closely mirrors that of our API, so the API documentation should be your first point of reference.

Contributing

If you're interested in contributing to our project:

Licence

Gosh is distributed under the terms of the MIT licence.

Directories

Path Synopsis
pkg
api
Package api provides the functions to work with SiteHost API.
Package api provides the functions to work with SiteHost API.
api/bandwidth
Package bandwidth represents the SiteHost `/bandwidth` API endpoint.
Package bandwidth represents the SiteHost `/bandwidth` API endpoint.
api/cloud/db
Package db provides access to the `/cloud/db` API endpoint.
Package db provides access to the `/cloud/db` API endpoint.
api/cloud/db/grant
Package grant is used for interacting with the SiteHost `/cloud/db/grant` API endpoint.
Package grant is used for interacting with the SiteHost `/cloud/db/grant` API endpoint.
api/cloud/db/user
Package user represents the SiteHost `/cloud/db/user` API endpoint.
Package user represents the SiteHost `/cloud/db/user` API endpoint.
api/cloud/image
Package image provides access to the `/cloud/image` API endpoint.
Package image provides access to the `/cloud/image` API endpoint.
api/cloud/server
Package server provides access to the `/cloud/stack/server` API endpoint.
Package server provides access to the `/cloud/stack/server` API endpoint.
api/cloud/ssh/user
Package user provides access to the `/cloud/ssh/user` API endpoint.
Package user provides access to the `/cloud/ssh/user` API endpoint.
api/cloud/stack
Package stack represents a cloud stack operations under the `/cloud/stack` API endpoint.
Package stack represents a cloud stack operations under the `/cloud/stack` API endpoint.
api/cloud/stack/environment
Package environment represents a cloud stack environment operations under the `/cloud/stack/environment` API endpoint.
Package environment represents a cloud stack environment operations under the `/cloud/stack/environment` API endpoint.
api/cloud/stack/image
Package image provides access to the `/cloud/stack/image` API endpoint.
Package image provides access to the `/cloud/stack/image` API endpoint.
api/dns
Package dns represents our SiteHost `/dns` API endpoint.
Package dns represents our SiteHost `/dns` API endpoint.
api/info
Package info represents our SiteHost `/api` API endpoint.
Package info represents our SiteHost `/api` API endpoint.
api/job
Package job represents our SiteHost `/job` endpoint
Package job represents our SiteHost `/job` endpoint
api/server
Package server represents our SiteHost `/server` API endpoint.
Package server represents our SiteHost `/server` API endpoint.
api/ssh/key
Package key represents our SiteHost `/ssh/key` API endpoint.
Package key represents our SiteHost `/ssh/key` API endpoint.
models
Package models hosts all sharing models between api endpoints.
Package models hosts all sharing models between api endpoints.
utils
Package utils contains our utilities functions.
Package utils contains our utilities functions.

Jump to

Keyboard shortcuts

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