2023-12-30 09:49:30 -06:00
|
|
|
/*
|
|
|
|
The Digital Ocean Struct
|
|
|
|
*/
|
|
|
|
|
|
|
|
package digitalocean
|
|
|
|
|
|
|
|
import (
|
2023-12-30 12:20:20 -06:00
|
|
|
"github.com/digitalocean/godo"
|
|
|
|
|
2023-12-30 09:49:30 -06:00
|
|
|
"go.wit.com/gui"
|
|
|
|
"go.wit.com/gui/gadgets"
|
|
|
|
)
|
|
|
|
|
|
|
|
type DigitalOcean struct {
|
|
|
|
ready bool
|
|
|
|
hidden bool
|
2023-12-30 12:20:20 -06:00
|
|
|
err error
|
2023-12-30 09:49:30 -06:00
|
|
|
|
|
|
|
token string // You're Digital Ocean API key
|
2023-12-30 12:20:20 -06:00
|
|
|
droplets []godo.Droplet
|
2023-12-30 09:49:30 -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 // our window for displaying digital ocean droplets
|
|
|
|
grid *gui.Node // our window for displaying digital ocean droplets
|
|
|
|
|
2023-12-30 12:20:20 -06:00
|
|
|
dGrid *gui.Node // the grid for the droplets
|
|
|
|
|
2023-12-30 09:49:30 -06:00
|
|
|
// Primary Directives
|
|
|
|
status *gadgets.OneLiner
|
|
|
|
summary *gadgets.OneLiner
|
|
|
|
statusIPv4 *gadgets.OneLiner
|
|
|
|
statusIPv6 *gadgets.OneLiner
|
|
|
|
}
|
2023-12-30 12:20:20 -06:00
|
|
|
|
|
|
|
type ipButton struct {
|
|
|
|
ip *gui.Node
|
|
|
|
c *gui.Node
|
|
|
|
}
|
|
|
|
|
|
|
|
type Droplet struct {
|
|
|
|
ready bool
|
|
|
|
hidden bool
|
|
|
|
err error
|
|
|
|
|
|
|
|
poll godo.Droplet // store what the digital ocean API returned
|
|
|
|
|
|
|
|
name *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
|
|
|
|
}
|