2024-01-24 22:55:34 -06:00
|
|
|
/*
|
2024-01-01 15:33:08 -06:00
|
|
|
The Digital Ocean Struct
|
|
|
|
*/
|
|
|
|
|
|
|
|
package digitalocean
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/digitalocean/godo"
|
|
|
|
|
2024-01-24 22:55:34 -06:00
|
|
|
"go.wit.com/gui"
|
|
|
|
"go.wit.com/lib/gadgets"
|
2024-01-01 15:33:08 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
type DigitalOcean struct {
|
2024-01-24 22:55:34 -06:00
|
|
|
ready bool
|
|
|
|
hidden bool
|
|
|
|
err error
|
2024-01-01 15:33:08 -06:00
|
|
|
|
2024-01-24 22:55:34 -06:00
|
|
|
token string // You're Digital Ocean API key
|
|
|
|
dpolled []godo.Droplet
|
|
|
|
sshKeys []godo.Key
|
2024-01-01 15:33:08 -06:00
|
|
|
|
2024-01-24 22:55:34 -06:00
|
|
|
dropMap map[int]*Droplet
|
|
|
|
create *windowCreate
|
2024-01-01 15:33:08 -06:00
|
|
|
|
2024-01-24 22:55:34 -06:00
|
|
|
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
|
2024-01-01 15:33:08 -06:00
|
|
|
|
2024-01-24 22:55:34 -06:00
|
|
|
dGrid *gui.Node // the grid for the droplets
|
2024-01-01 15:33:08 -06:00
|
|
|
|
|
|
|
// Primary Directives
|
2024-01-24 22:55:34 -06:00
|
|
|
status *gadgets.OneLiner
|
|
|
|
summary *gadgets.OneLiner
|
|
|
|
statusIPv4 *gadgets.OneLiner
|
|
|
|
statusIPv6 *gadgets.OneLiner
|
2024-01-01 15:33:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type windowCreate struct {
|
2024-01-24 22:55:34 -06:00
|
|
|
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
|
|
|
|
|
|
|
|
regionSelected godo.Region
|
|
|
|
regionSlug string
|
|
|
|
tag *gadgets.OneLiner
|
|
|
|
name *gadgets.BasicEntry
|
|
|
|
region *gadgets.BasicDropdown
|
|
|
|
size *gadgets.BasicCombobox
|
|
|
|
memory *gadgets.BasicDropdown
|
|
|
|
image *gadgets.BasicCombobox
|
2024-01-01 15:33:08 -06:00
|
|
|
// nvme *gadgets.BasicCheckbox
|
|
|
|
}
|
|
|
|
|
|
|
|
type ipButton struct {
|
2024-01-24 22:55:34 -06:00
|
|
|
ip *gui.Node
|
|
|
|
c *gui.Node
|
2024-01-01 15:33:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type Droplet struct {
|
2024-01-24 22:55:34 -06:00
|
|
|
ID int
|
|
|
|
image string
|
|
|
|
memory int
|
|
|
|
disk int
|
|
|
|
|
|
|
|
ready bool
|
|
|
|
hidden bool
|
|
|
|
err error
|
|
|
|
|
|
|
|
poll *godo.Droplet // store what the digital ocean API returned
|
|
|
|
|
|
|
|
nameN *gui.Node
|
|
|
|
sizeSlugN *gui.Node
|
|
|
|
statusN *gui.Node
|
|
|
|
imageN *gui.Node
|
|
|
|
|
|
|
|
destroy *gui.Node
|
|
|
|
connect *gui.Node
|
|
|
|
poweron *gui.Node
|
|
|
|
poweroff *gui.Node
|
|
|
|
edit *gui.Node
|
|
|
|
|
|
|
|
ipv4 *gui.Node
|
|
|
|
ipv6 *gui.Node
|
2024-01-01 15:33:08 -06:00
|
|
|
}
|