summaryrefslogtreecommitdiff
path: root/digitalocean/structs.go
blob: bfb607fad0b289510a87461ed3268b3d1b222a34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* 
	The Digital Ocean Struct
*/

package digitalocean

import (
	"github.com/digitalocean/godo"

	"go.wit.com/gui"
	"go.wit.com/gui/gadgets"
)

type DigitalOcean struct {
	ready		bool
	hidden		bool
	err		error

	token		string // You're Digital Ocean API key
	dpolled		[]godo.Droplet
	sshKeys		[]godo.Key

	dropMap		map[int]*Droplet
	create		*windowCreate

	parent	*gui.Node // should be the root of the 'gui' package binary tree
	window	*gui.Node // our window for displaying digital ocean droplets
	group	*gui.Node
	grid	*gui.Node

	dGrid	*gui.Node // the grid for the droplets

	// Primary Directives
	status		*gadgets.OneLiner
	summary		*gadgets.OneLiner
	statusIPv4	*gadgets.OneLiner
	statusIPv6	*gadgets.OneLiner
}

type windowCreate struct {
	ready		bool
	hidden		bool
	err		error

	parent	*gui.Node // should be the root of the 'gui' package binary tree
	window	*gui.Node // our window for displaying digital ocean droplets
	group	*gui.Node
	grid	*gui.Node

	tag		*gadgets.OneLiner
	name		*gadgets.BasicEntry
}

type ipButton struct {
	ip	*gui.Node
	c	*gui.Node
}

type Droplet struct {
	ID		int

	ready		bool
	hidden		bool
	err		error

	poll		*godo.Droplet // store what the digital ocean API returned

	name		*gui.Node
	status		*gui.Node
	destroy		*gui.Node
	connect		*gui.Node
	poweron		*gui.Node
	poweroff	*gui.Node
	edit		*gui.Node

	// a box and grid of the IPv4 addresses
	box4		*gui.Node
	grid4		*gui.Node
	ipv4		[]ipButton

	// a box and grid of the IPv6 addresses
	box6		*gui.Node
	grid6		*gui.Node
	ipv6		[]ipButton
}