import "github.com/netactuate/gona/gona"
Package gona provides a simple golang interface to the NetActuate Rest API at https://vapi2.netactuate.com/
- Constants
- func GetKeyFromEnv() string
- type BuildServerRequest
- type Client
- func NewClient(apikey string) *Client
- func NewClientCustom(apikey string, apiurl string) *Client
- func (c *Client) BuildServer(id int, r *BuildServerRequest) (b ServerBuild, err error)
- func (c *Client) CreateSSHKey(name, key string) (sshkey SSHKey, err error)
- func (c *Client) CreateServer(r *CreateServerRequest) (b ServerBuild, err error)
- func (c *Client) DeleteSSHKey(id int) error
- func (c *Client) DeleteServer(id int, cancelBilling bool) error
- func (c *Client) GetLocations() ([]Location, error)
- func (c *Client) GetOSs() ([]OS, error)
- func (c *Client) GetSSHKey(id int) (sshkey SSHKey, err error)
- func (c *Client) GetSSHKeys() (keys []SSHKey, err error)
- func (c *Client) GetServer(id int) (server Server, err error)
- func (c *Client) GetServers() ([]Server, error)
- func (c *Client) UnlinkServer(id int) error
- type CreateServerRequest
- type Location
- type OS
- type SSHKey
- type Server
- type ServerBuild
client.go locations.go os.go servers.go sshkeys.go
const (
Version = "0.2.0"
BaseEndpoint = "https://vapi2.netactuate.com/api/"
ContentType = "application/json"
)
Version, BaseEndpoint, ContentType constants
func GetKeyFromEnv() string
GetKeyFromEnv is a simple function to try to yank the value for "NA_API_KEY" from the environment
type BuildServerRequest struct {
Location int `url:"location,omitempty"`
Image int `url:"image,omitempty"`
FQDN string `url:"fqdn,omitempty"`
SSHKey string `url:"ssh_key,omitempty"`
SSHKeyID int `url:"ssh_key_id,omitempty"`
Password string `url:"password,omitempty"`
CloudConfig string `url:"cloud_config,omitempty"`
ScriptContent string `url:"script_content,omitempty"`
}
BuildServerRequest is a set of parameters for a server re-building call.
type Client struct {
// contains filtered or unexported fields
}
Client is the main object (struct) to which we attach most methods/functions. It has the following fields: (client, userAgent, endPoint, apiKey)
func NewClient(apikey string) *Client
NewClient takes an apikey and calls NewClientCustom with the hardcoded BaseEndpoint constant API URL
func NewClientCustom(apikey string, apiurl string) *Client
NewClientCustom is the main entrypoint for instantiating a Client struct. It takes your API Key as it's sole argument and returns the Client struct ready to talk to the API
func (*Client) BuildServer
func (c *Client) BuildServer(id int, r *BuildServerRequest) (b ServerBuild, err error)
BuildServer external method on Client to re-build an instance
func (*Client) CreateSSHKey
func (c *Client) CreateSSHKey(name, key string) (sshkey SSHKey, err error)
CreateSSHKey creates a key
func (*Client) CreateServer
func (c *Client) CreateServer(r *CreateServerRequest) (b ServerBuild, err error)
CreateServer external method on Client to buy and build a new instance.
func (*Client) DeleteSSHKey
func (c *Client) DeleteSSHKey(id int) error
DeleteSSHKey deletes a key
func (*Client) DeleteServer
func (c *Client) DeleteServer(id int, cancelBilling bool) error
DeleteServer external method on Client to destroy an instance.
func (*Client) GetLocations
func (c *Client) GetLocations() ([]Location, error)
GetLocations public method on Client to get a list of locations
func (c *Client) GetOSs() ([]OS, error)
GetOSs returns a list of OS objects from the api
func (c *Client) GetSSHKey(id int) (sshkey SSHKey, err error)
GetSSHKey as in one key
func (*Client) GetSSHKeys
func (c *Client) GetSSHKeys() (keys []SSHKey, err error)
GetSSHKeys as in many keys
func (c *Client) GetServer(id int) (server Server, err error)
GetServer external method on Client to get an instance
func (*Client) GetServers
func (c *Client) GetServers() ([]Server, error)
GetServers external method on Client to list your instances
func (*Client) UnlinkServer
func (c *Client) UnlinkServer(id int) error
UnlinkServer external method on Client to unlink a billing package from a location
type CreateServerRequest struct {
Plan string `url:"plan,omitempty"`
Location int `url:"location,omitempty"`
Image int `url:"image,omitempty"`
FQDN string `url:"fqdn,omitempty"`
SSHKey string `url:"ssh_key,omitempty"`
SSHKeyID int `url:"ssh_key_id,omitempty"`
Password string `url:"password,omitempty"`
PackageBilling string `url:"package_billing,omitempty"`
PackageBillingContractId string `url:"package_billing_contract_id,omitempty"`
CloudConfig string `url:"cloud_config,omitempty"`
ScriptContent string `url:"script_content,omitempty"`
}
CreateServerRequest is as set of parameters for a server creation call.
type Location struct {
ID int `json:"id"`
Name string `json:"name"`
IATACode string `json:"iata_code"`
Continent string `json:"continent"`
Flag string `json:"flat"`
Disabled int `json:"disabled"`
}
Location is an API response message identifyin a particular location.
type OS struct {
ID int `json:"id,string"`
Os string `json:"os"`
Type string `json:"type"`
Subtype string `json:"subtype"`
Size string `json:"size"`
Bits string `json:"bits"`
Tech string `json:"tech"`
}
OS is a struct for storing the attributes of an OS
type SSHKey struct {
ID int `json:"id"`
Name string `json:"name"`
Key string `json:"ssh_key"`
Fingerprint string `json:"fingerprint"`
}
SSHKey is what it is
type Server struct {
Name string `json:"fqdn"`
ID int `json:"mbpkgid"`
OS string `json:"os"`
OSID int `json:"os_id"`
PrimaryIPv4 string `json:"ip"`
PrimaryIPv6 string `json:"ipv6"`
PlanID int `json:"plan_id"`
Package string `json:"package"`
PackageBilling string `json:"package_billing"`
PackageBillingContractId string `json:"package_billing_contract_id"`
Location string `json:"city"`
LocationID int `json:"location_id"`
ServerStatus string `json:"status"`
PowerStatus string `json:"state"`
Installed int `json:"installed"`
}
Server struct defines what a VPS looks like
type ServerBuild struct {
ServerID int `json:"mbpkgid"`
Status string `json:"status"`
Build int `json:"build"`
}
ServerBuild is a server creation response message.
Generated by godoc2md