gosh

module
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT

README

Gosh

Gosh is a Go client library for accessing the SiteHost v1.5 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
examples
accounts command
Program accounts is a read-only validation of accounts.client.ListSubAccounts.
Program accounts is a read-only validation of accounts.client.ListSubAccounts.
bandwidth command
Program bandwidth is a read-only validation of the bandwidth package's four read endpoints, with particular attention to the two decode-bug shapes that motivate the package's custom UnmarshalJSON methods and Number type.
Program bandwidth is a read-only validation of the bandwidth package's four read endpoints, with particular attention to the two decode-bug shapes that motivate the package's custom UnmarshalJSON methods and Number type.
cloud-db-compare command
Program cloud-db-compare creates a database + user on each of a CCS's MariaDB and MySQL stacks, prints a side-by-side comparison of the responses, and tears down.
Program cloud-db-compare creates a database + user on each of a CCS's MariaDB and MySQL stacks, prints a side-by-side comparison of the responses, and tears down.
mail-list-all command
Program mail-list-all is a read-only validation of mail.ListAll against a real mail server.
Program mail-list-all is a read-only validation of mail.ListAll against a real mail server.
redirect command
Program redirect is a read-only validation of redirect.ListRedirects.
Program redirect is a read-only validation of redirect.ListRedirects.
pkg
api
Package api provides the functions to work with SiteHost API.
Package api provides the functions to work with SiteHost API.
api/accounts/client
Package client wraps the /accounts/client API endpoints — currently just /accounts/client/list_sub_accounts.json, the paginated list of sub-accounts under the calling client_id (reseller / parent-account view).
Package client wraps the /accounts/client API endpoints — currently just /accounts/client/list_sub_accounts.json, the paginated list of sub-accounts under the calling client_id (reseller / parent-account view).
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/image/version
Package version provides access to the /cloud/image/version endpoints — listing build history for a custom image, fetching build logs, and deleting individual versions.
Package version provides access to the /cloud/image/version endpoints — listing build history for a custom image, fetching build logs, and deleting individual versions.
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/cloud/stack/ssl/letsencrypt
Package letsencrypt wraps SiteHost's Cloud-Container Let's Encrypt endpoints under /cloud/stack/ssl/lets_encrypt.
Package letsencrypt wraps SiteHost's Cloud-Container Let's Encrypt endpoints under /cloud/stack/ssl/lets_encrypt.
api/cloud/volume
Package volume represents our SiteHost `/cloud/volume` API endpoint — persistent volumes that can be attached to cloud containers.
Package volume represents our SiteHost `/cloud/volume` API endpoint — persistent volumes that can be attached to cloud containers.
api/dns
Package dns represents our SiteHost `/dns` API endpoint.
Package dns represents our SiteHost `/dns` API endpoint.
api/dns/template
Package template represents our SiteHost `/dns/domain_templates` API endpoint.
Package template represents our SiteHost `/dns/domain_templates` API endpoint.
api/info
Package info wraps SiteHost's /api/* endpoints.
Package info wraps SiteHost's /api/* endpoints.
api/job
Package job represents our SiteHost `/job` endpoint
Package job represents our SiteHost `/job` endpoint
api/mail
Package mail represents our SiteHost `/mail` API endpoint — shared mail service inspection (server info, domains, accounts, aliases, forwarders).
Package mail represents our SiteHost `/mail` API endpoint — shared mail service inspection (server info, domains, accounts, aliases, forwarders).
api/redirect
Package redirect wraps the /redirect API endpoint — currently just /redirect/list_redirects.json, the per-account inventory of HTTP redirect rules grouped by domain.
Package redirect wraps the /redirect API endpoint — currently just /redirect/list_redirects.json, the per-account inventory of HTTP redirect rules grouped by domain.
api/server
Package server wraps the SiteHost /server API endpoints — the VPS / Cloud Container Server lifecycle: provision, get, list, upgrade, snapshot, etc.
Package server wraps the SiteHost /server API endpoints — the VPS / Cloud Container Server lifecycle: provision, get, list, upgrade, snapshot, etc.
api/server/firewall
Package firewall represents our SiteHost `/server/firewall` API endpoint.
Package firewall represents our SiteHost `/server/firewall` API endpoint.
api/server/firewall/securitygroups
Package securitygroups represents our SiteHost `/server/firewall/security_groups` API endpoint.
Package securitygroups represents our SiteHost `/server/firewall/security_groups` API endpoint.
api/server/snapshot
Package snapshot represents our SiteHost `/server/snapshot` API endpoint — server-level disk snapshot management (list, create, delete, restore, lifetime).
Package snapshot represents our SiteHost `/server/snapshot` API endpoint — server-level disk snapshot management (list, create, delete, restore, lifetime).
api/srs
Package srs wraps the SiteHost /srs API — domain registration, transfer, contacts, and lifecycle ops via the Shared Registry System.
Package srs wraps the SiteHost /srs API — domain registration, transfer, contacts, and lifecycle ops via the Shared Registry System.
api/ssh/key
Package key represents our SiteHost `/ssh/key` API endpoint.
Package key represents our SiteHost `/ssh/key` API endpoint.
api/ssl
Package ssl represents our SiteHost `/ssl` API endpoint.
Package ssl represents our SiteHost `/ssl` API endpoint.
models
Package models hosts all sharing models between api endpoints.
Package models hosts all sharing models between api endpoints.
net
Package net contains assorted functions for working with net things like dns records and urls
Package net contains assorted functions for working with net things like dns records and urls
shtypes
Package shtypes container wrappers for handling JSON types that may or may not be weird e.g.: numbers as strings or numbers, bools as anything that looks truthy it adds a little more flexibility around some of the types than the json.Number and related classes
Package shtypes container wrappers for handling JSON types that may or may not be weird e.g.: numbers as strings or numbers, bools as anything that looks truthy it adds a little more flexibility around some of the types than the json.Number and related classes

Jump to

Keyboard shortcuts

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