shakenfist_go

package module
v0.0.0-...-e54908c Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

With many thanks to the example code from https://github.com/spaceapegames/terraform-provider-example

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client holds all of the information required to connect to the server

func NewClient

func NewClient(hostname string, port int) *Client

NewClient returns a client ready for use

func (*Client) CreateInstance

func (c *Client) CreateInstance(Name string, CPUs int, Memory int,
	Networks []NetworkSpec, Disks []DiskSpec, SSHKey string,
	UserData string) (Instance, error)

CreateInstance creates a new instance

func (*Client) CreateNetwork

func (c *Client) CreateNetwork(netblock string, provideDHCP bool, provideNAT bool,
	name string) (Network, error)

CreateNetwork creates a new network

func (*Client) DefloatInterface

func (c *Client) DefloatInterface(interfaceUUID string) error

DefloatInterface removes a floating IP from an interface

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(instanceUUID string) error

DeleteInstance deletes an instance

func (*Client) DeleteNetwork

func (c *Client) DeleteNetwork(networkUUID string) error

DeleteNetwork removes a network with a specified UUID

func (*Client) FloatInterface

func (c *Client) FloatInterface(interfaceUUID string) error

FloatInterface adds a floating IP to an interface

func (*Client) GetInstance

func (c *Client) GetInstance(instanceUUID string) (Instance, error)

GetInstance fetches a specific instance by UUID

func (*Client) GetInstanceInterfaces

func (c *Client) GetInstanceInterfaces(instanceUUID string) ([]NetworkInterface, error)

GetInstanceInterfaces fetches a list of network interfaces for an instance

func (*Client) GetInstances

func (c *Client) GetInstances() ([]Instance, error)

GetInstances fetches a list of instances

func (*Client) GetNetwork

func (c *Client) GetNetwork(networkUUID string) (Network, error)

GetNetwork fetches a specific instance by UUID

func (*Client) GetNetworks

func (c *Client) GetNetworks() ([]Network, error)

GetNetworks fetches a list of networks

type DiskSpec

type DiskSpec struct {
	Base string `json:"base"`
	Size int    `json:"size"`
	Bus  string `json:"bus"`
	Type string `json:"type"`
}

DiskSpec is a definition of an instance disk

type Instance

type Instance struct {
	UUID         string                 `json:"uuid"`
	Name         string                 `json:"name"`
	CPUs         int                    `json:"cpus"`
	Memory       int                    `json:"memory"`
	DiskSpecs    []DiskSpec             `json:"disk_spec"`
	SSHKey       string                 `json:"ssh_key"`
	Node         string                 `json:"node"`
	ConsolePort  int                    `json:"console_port"`
	VDIPort      int                    `json:"vdi_port"`
	UserData     string                 `json:"User_data"`
	BlockDevices map[string]interface{} `json:"block_devices"`
	State        string                 `json:"state"`
	StateUpdated float64                `json:"state_updated"`
}

Instance is a definition of an instance

type Network

type Network struct {
	UUID            string  `json:"uuid"`
	Name            string  `json:"name"`
	VXId            int     `json:"vxid"`
	NetBlock        string  `json:"netblock"`
	ProvideDHCP     bool    `json:"provide_dhcp"`
	ProvideNAT      bool    `json:"provide_nat"`
	Owner           string  `json:"owner"`
	FloatingGateway string  `json:"floating_gateway"`
	State           string  `json:"state"`
	StateUpdated    float64 `json:"state_updated"`
}

Network is a definition of a network

type NetworkInterface

type NetworkInterface struct {
	UUID         string  `json:"uuid"`
	NetworkUUID  string  `json:"network_uuid"`
	InstanceUUID string  `json:"instance_uuid"`
	MACAddress   string  `json:"macaddr"`
	IPv4         string  `json:"ipv4"`
	Order        int     `json:"order"`
	Floating     string  `json:"floating"`
	State        string  `json:"state"`
	StateUpdated float64 `json:"state_updated"`
	Model        string  `json:"model"`
}

NetworkInterface is a definition of an network interface for an instance

type NetworkSpec

type NetworkSpec struct {
	NetworkUUID string `json:"network_uuid"`
	Address     string `json:"address"`
	MACAddress  string `json:"macaddress"`
	Model       string `json:"model"`
}

NetworkSpec is a definition of an instance network connect

Jump to

Keyboard shortcuts

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