import "."
Package gona provides a simple golang interface to the NetActuate Rest API at https://vapi2.netactuate.com/
- Constants
- func GetKeyFromEnv() string
- type BGPCreateSessionsInput
- type BGPSession
- 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) CreateBGPSessions(mbPkgID int, groupID int, isIPV6 bool, redundant bool) (*BGPSession, 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) GetBGPSession(id int) (*BGPSession, error)
- func (c *Client) GetBGPSessions(mbPkgID int) ([]*BGPSession, error)
- func (c *Client) GetIPs(mbPkgID int) (ips IPs, err error)
- func (c *Client) GetLocations() ([]Location, error)
- func (c *Client) GetOSs() ([]OS, error)
- func (c *Client) GetPackage(id int) (pkg Package, err error)
- func (c *Client) GetPackages() ([]Package, error)
- func (c *Client) GetPlans() ([]Plan, 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) StartServer(id int) error
- func (c *Client) StopServer(id int) error
- func (c *Client) UnlinkServer(id int) error
- type CreateServerRequest
- type IP
- type IPType
- type IPs
- type Location
- type OS
- type Package
- type Plan
- type Prefix
- type SSHKey
- type Server
- type ServerBuild
bgp.go client.go ip.go locations.go os.go packages.go plans.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() stringGetKeyFromEnv is a simple function to grab the value for "NA_API_KEY" from the environment
type BGPCreateSessionsInput struct {
MbPkgID int `json:"mbpkgid"` // Contract BGP ID
GroupID int `json:"group_id"`
Redundant int `json:"redundant"` //Force session redundancy
IPV6 int `json:"ipv6"` // IPv6 Session
}type BGPSession struct {
ID int `json:"id"`
CustomerIP string `json:"customer_peer_ip"`
GroupID int `json:"group_id"`
Locked int `json:"locked"`
Description string `json:"description"`
State interface{} `json:"state"`
RoutesReceived interface{} `json:"routes_received"`
LastUpdate interface{} `json:"last_update"`
ConfigStatus int `json:"config_status"`
Password interface{} `json:"password"`
Prefixes []Prefix `json:"prefixes"`
ExportList string `json:"export_list"`
Community interface{} `json:"community"`
ProviderPeerIP string `json:"provider_peer_ip"`
Location string `json:"location"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
GroupName string `json:"group_name"`
ProviderIPType string `json:"provider_ip_type"`
ProviderAsn int `json:"provider_asn,string"`
CustomerAsn int `json:"customer_asn,string"`
}func (s *BGPSession) IsLocked() boolfunc (*BGPSession) IsProviderIPTypeV4
func (s *BGPSession) IsProviderIPTypeV4() booltype 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) *ClientNewClient takes an apikey and calls NewClientCustom with the hardcoded BaseEndpoint constant API URL
func NewClientCustom(apikey string, apiurl string) *ClientNewClientCustom 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) CreateBGPSessions
func (c *Client) CreateBGPSessions(mbPkgID int, groupID int, isIPV6 bool, redundant bool) (*BGPSession, error)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) errorDeleteSSHKey deletes a key
func (*Client) DeleteServer
func (c *Client) DeleteServer(id int, cancelBilling bool) errorDeleteServer external method on Client to destroy an instance.
func (*Client) GetBGPSession
func (c *Client) GetBGPSession(id int) (*BGPSession, error)GetBGPSession external method on Client to get your BGP session
func (*Client) GetBGPSessions
func (c *Client) GetBGPSessions(mbPkgID int) ([]*BGPSession, error)GetBGPSessions external method on Client to get BGP sessions
func (c *Client) GetIPs(mbPkgID int) (ips IPs, err error)GetIPs returns a list of IPs for the selected mbPkgID from the API
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 (*Client) GetPackage
func (c *Client) GetPackage(id int) (pkg Package, err error)GetPackage external method on Client that takes an id (int) as it's sole argument and returns a single Package object
func (*Client) GetPackages
func (c *Client) GetPackages() ([]Package, error)GetPackages external method on Client that returns a list of Package object from the API
func (c *Client) GetPlans() ([]Plan, error)GetPlans external method on Client to list available Plans
func (c *Client) GetSSHKey(id int) (sshkey SSHKey, err error)GetSSHKey will list the information on a specific key
func (*Client) GetSSHKeys
func (c *Client) GetSSHKeys() (keys []SSHKey, err error)GetSSHKeys will list all SSH Keys installed for the account
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) StartServer
func (c *Client) StartServer(id int) errorStartServer external method on Client to boot up an instance
func (*Client) StopServer
func (c *Client) StopServer(id int) errorStopServer external method on Client to shut down an instance
func (*Client) UnlinkServer
func (c *Client) UnlinkServer(id int) errorUnlinkServer 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 IP struct {
ID int `json:"id"`
Primary int `json:"primary"`
Reverse string `json:"reverse"`
IP string `json:"ip"`
Gateway string `json:"gateway"`
Netmask string `json:"netmask"`
Broadcast string `json:"broadcast"`
}type IPType stringconst (
IPv4 IPType = "ipv4"
IPv6 IPType = "ipv6"
)type IPs struct {
IPv4 []IP `json:"IPv4"`
IPv6 []IP `json:"IPv6"`
}func (ips *IPs) GetIPsMap() *map[string]IPTypetype 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 of available deployment locations
type OS struct {
ID int `json:"id"`
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 Package struct {
ID int `json:"mbpkgid,string"`
Status string `json:"package_status"`
Locked string `json:"locked"`
PlanName string `json:"name"`
Installed int `json:"installed,string"`
}Package struct stores the purchaced package values
type Plan struct {
ID int `json:"plan_id,string"`
Name string `json:"plan"`
RAM string `json:"ram"`
Disk string `json:"disk"`
Transfer string `json:"transfer"`
Price string `json:"price"`
Available string `json:"available"`
}Plan struct defines the purchaceable plans/packages
type Prefix struct {
ID int `json:"id"`
MbID int `json:"mb_id"`
Prefix string `json:"prefix"`
Append interface{} `json:"append"`
RuleType string `json:"rule_type"`
PrefixType string `json:"prefix_type"`
Description string `json:"description"`
Date string `json:"date"`
AllowedPps int `json:"allowed_pps"`
BgpGroupID int `json:"bgp_group_id"`
PrefixID int `json:"prefix_id"`
}type SSHKey struct {
ID int `json:"id"`
Name string `json:"name"`
Key string `json:"ssh_key"`
Fingerprint string `json:"fingerprint"`
}SSHKey Struct
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