clouddk

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: MPL-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EnableDebugMessages sets whether or not to write debug messages to the log.
	EnableDebugMessages = false
)

Functions

func DebugClientRequest

func DebugClientRequest(s string, v ...interface{})

DebugClientRequest writes a message to the log.

func DoClientRequest

func DoClientRequest(settings *ClientSettings, method string, path string, body *bytes.Buffer, successCodes []int, retryLimit int, retryDelay int) (*http.Response, error)

DoClientRequest performs a HTTP request and does so multiple times, if required.

func GetClientRequestObject

func GetClientRequestObject(settings *ClientSettings, method string, path string, body io.Reader) (*http.Request, error)

GetClientRequestObject returns a new HTTP request object.

Types

type ClientSettings

type ClientSettings struct {
	Endpoint string
	Key      string
}

ClientSettings describes the client settings.

type CustomBool

type CustomBool bool

CustomBool allows a JSON boolean value to also be an integer

func (CustomBool) MarshalJSON

func (r CustomBool) MarshalJSON() ([]byte, error)

MarshalJSON converts a boolean to a JSON value.

func (*CustomBool) UnmarshalJSON

func (r *CustomBool) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to a boolean.

type CustomInt

type CustomInt int

CustomInt allows a JSON integer value to also be a string

func (*CustomInt) UnmarshalJSON

func (r *CustomInt) UnmarshalJSON(b []byte) error

UnmarshalJSON converts a JSON value to an integer.

type DiskBody

type DiskBody struct {
	Identifier string     `json:"identifier"`
	Label      string     `json:"label"`
	Size       CustomInt  `json:"size"`
	Primary    CustomBool `json:"primary"`
}

DiskBody describes a disk object.

type DiskCreateBody

type DiskCreateBody struct {
	Label string    `json:"label"`
	Size  CustomInt `json:"size"`
}

DiskCreateBody describes a disk creation object.

type DiskListBody

type DiskListBody []DiskBody

DiskListBody describes a disk list.

type ErrorBody

type ErrorBody struct {
	Message string    `json:"message"`
	Status  CustomInt `json:"status"`
}

ErrorBody describes an error object.

type FirewallRuleBody

type FirewallRuleBody struct {
	Identifier string    `json:"identifier"`
	Position   CustomInt `json:"position"`
	Command    string    `json:"command"`
	Protocol   string    `json:"protocol"`
	Address    string    `json:"address"`
	Bits       CustomInt `json:"bits"`
	Port       string    `json:"port"`
}

FirewallRuleBody describes a firewall rule object.

type FirewallRuleCreateBody

type FirewallRuleCreateBody struct {
	Command  string    `json:"command"`
	Protocol string    `json:"protocol"`
	Address  string    `json:"address"`
	Bits     CustomInt `json:"bits"`
	Port     string    `json:"port"`
}

FirewallRuleCreateBody describes a firewall rule creation object.

type FirewallRuleListBody

type FirewallRuleListBody []FirewallRuleBody

FirewallRuleListBody describes a firewall rule list.

type IPAddressBody

type IPAddressBody struct {
	Address                    string `json:"address"`
	Network                    string `json:"network"`
	Netmask                    string `json:"netmask"`
	Gateway                    string `json:"gateway"`
	NetworkInterfaceIdentifier string `json:"network_interface_identifier"`
}

IPAddressBody describes an IP address object.

type IPAddressListBody

type IPAddressListBody []IPAddressBody

IPAddressListBody describes an IP address list.

type LocationBody

type LocationBody struct {
	Identifier string `json:"identifier"`
	Name       string `json:"name"`
}

LocationBody describes a datacenter location object.

type LocationListBody

type LocationListBody []LocationBody

LocationListBody describes a datacenter location list.

type LogsBody

type LogsBody struct {
	Identifier       CustomInt `json:"id"`
	Action           string    `json:"action"`
	Status           string    `json:"status"`
	TargetType       string    `json:"target_type"`
	TargetIdentifier CustomInt `json:"target_id"`
	CreatedAt        string    `json:"created_at"`
}

LogsBody describes a logs object.

type LogsListBody

type LogsListBody []LogsBody

LogsListBody describes a logs list.

type NetworkInterfaceBody

type NetworkInterfaceBody struct {
	Identifier          string               `json:"identifier"`
	Label               string               `json:"label"`
	RateLimit           CustomInt            `json:"rate_limit"`
	DefaultFirewallRule string               `json:"default_firewall_rule"`
	Primary             CustomBool           `json:"primary"`
	IPAddresses         IPAddressListBody    `json:"ipAddresses"`
	FirewallRules       FirewallRuleListBody `json:"firewallRules"`
}

NetworkInterfaceBody describes a network interface object.

type NetworkInterfaceListBody

type NetworkInterfaceListBody []NetworkInterfaceBody

NetworkInterfaceListBody describes a network interface list.

type NetworkInterfaceUpdateBody

type NetworkInterfaceUpdateBody struct {
	Label               string `json:"label"`
	DefaultFirewallRule string `json:"default_firewall_rule"`
}

NetworkInterfaceUpdateBody describes a network interface update object.

type PackageBody

type PackageBody struct {
	Identifier string `json:"identifier"`
	Name       string `json:"name"`
}

PackageBody describes a server package object.

type PackageeListBody

type PackageeListBody []PackageBody

PackageeListBody describes a server package list.

type ServerBody

type ServerBody struct {
	Identifier        string                   `json:"identifier"`
	Hostname          string                   `json:"hostname"`
	Label             string                   `json:"label"`
	CPUs              CustomInt                `json:"cpus"`
	Memory            CustomInt                `json:"memory"`
	Booted            CustomBool               `json:"booted"`
	Disks             DiskListBody             `json:"disks"`
	NetworkInterfaces NetworkInterfaceListBody `json:"networkInterfaces"`
	Template          TemplateBody             `json:"template"`
	Location          LocationBody             `json:"location"`
	Package           PackageBody              `json:"package"`
}

ServerBody describes a server object.

type ServerCreateBody

type ServerCreateBody struct {
	Hostname            string `json:"hostname"`
	Label               string `json:"label"`
	InitialRootPassword string `json:"initialRootPassword"`
	Package             string `json:"package"`
	Template            string `json:"template"`
	Location            string `json:"location"`
}

ServerCreateBody describes a server creation object.

type ServerListBody

type ServerListBody []ServerBody

ServerListBody describes a server list.

type ServerUpdateBody

type ServerUpdateBody struct {
	Hostname string `json:"hostname"`
	Label    string `json:"label"`
}

ServerUpdateBody describes a server update object.

type ServerUpgradeBody

type ServerUpgradeBody struct {
	Package     string     `json:"package"`
	UpgradeDisk CustomBool `json:"upgradeDisk"`
}

ServerUpgradeBody describes a server upgrade object.

type TemplateBody

type TemplateBody struct {
	Identifier string `json:"identifier"`
	Name       string `json:"name"`
}

TemplateBody describes a datacenter location object.

type TemplateListBody

type TemplateListBody []TemplateBody

TemplateListBody describes a datacenter location list.

Jump to

Keyboard shortcuts

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