parent
1c2dfda279
commit
8de0a3092e
3
Makefile
3
Makefile
|
@ -5,6 +5,9 @@ all:
|
||||||
@echo a work in progress digital ocean control panel
|
@echo a work in progress digital ocean control panel
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
goimports:
|
||||||
|
goimports -w *.go
|
||||||
|
|
||||||
redomod:
|
redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
GO111MODULE= go mod init
|
GO111MODULE= go mod init
|
||||||
|
|
12
api.go
12
api.go
|
@ -3,8 +3,8 @@ package digitalocean
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"golang.org/x/oauth2"
|
|
||||||
"github.com/digitalocean/godo"
|
"github.com/digitalocean/godo"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -25,11 +25,11 @@ func (d *DigitalOcean) listRegions() []godo.Region {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Print details of each region.
|
// Print details of each region.
|
||||||
fmt.Println("Available Regions:")
|
fmt.Println("Available Regions:")
|
||||||
for _, region := range regions {
|
for _, region := range regions {
|
||||||
fmt.Printf("Slug: %s, Name: %s, Available: %v\n", region.Slug, region.Name, region.Available)
|
fmt.Printf("Slug: %s, Name: %s, Available: %v\n", region.Slug, region.Name, region.Available)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return regions
|
return regions
|
||||||
|
|
6
args.go
6
args.go
|
@ -3,7 +3,7 @@ package digitalocean
|
||||||
// initializes logging and command line options
|
// initializes logging and command line options
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/arg"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@ type ArgsDo struct {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
arg.Register(&argDo)
|
arg.Register(&argDo)
|
||||||
full := "go.wit.com/gui/digitalocean"
|
full := "go.wit.com/lib/gui/digitalocean"
|
||||||
short := "DOgui"
|
short := "DOgui"
|
||||||
|
|
||||||
NOW = log.NewFlag( "NOW", true, full, short, "temp debugging stuff")
|
NOW = log.NewFlag("NOW", true, full, short, "temp debugging stuff")
|
||||||
INFO = log.NewFlag("INFO", false, full, short, "normal debugging stuff")
|
INFO = log.NewFlag("INFO", false, full, short, "normal debugging stuff")
|
||||||
INFO = log.NewFlag("POLL", false, full, short, "show droplet status polling")
|
INFO = log.NewFlag("POLL", false, full, short, "show droplet status polling")
|
||||||
}
|
}
|
||||||
|
|
49
create.go
49
create.go
|
@ -3,11 +3,12 @@ package digitalocean
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
"golang.org/x/oauth2"
|
|
||||||
"github.com/digitalocean/godo"
|
|
||||||
|
|
||||||
|
"github.com/digitalocean/godo"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
// "go.wit.com/gui"
|
// "go.wit.com/gui"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -78,12 +79,12 @@ func (d *DigitalOcean) createDropletNew(name, region, size, image string) (*godo
|
||||||
log.Verbose("found ssh key.Fingerprint =", key.Fingerprint)
|
log.Verbose("found ssh key.Fingerprint =", key.Fingerprint)
|
||||||
log.Verbose("found ssh key:", key)
|
log.Verbose("found ssh key:", key)
|
||||||
/*
|
/*
|
||||||
sshKeys = []godo.DropletCreateSSHKey{
|
sshKeys = []godo.DropletCreateSSHKey{
|
||||||
{ID: key.ID},
|
{ID: key.ID},
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
sshKeys = append(sshKeys, godo.DropletCreateSSHKey{ID: key.ID})
|
sshKeys = append(sshKeys, godo.DropletCreateSSHKey{ID: key.ID})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define the create request.
|
// Define the create request.
|
||||||
createRequest := &godo.DropletCreateRequest{
|
createRequest := &godo.DropletCreateRequest{
|
||||||
|
@ -93,7 +94,7 @@ func (d *DigitalOcean) createDropletNew(name, region, size, image string) (*godo
|
||||||
Image: godo.DropletCreateImage{
|
Image: godo.DropletCreateImage{
|
||||||
Slug: image,
|
Slug: image,
|
||||||
},
|
},
|
||||||
IPv6: true, // Enable IPv6
|
IPv6: true, // Enable IPv6
|
||||||
SSHKeys: sshKeys, // Add SSH key IDs here
|
SSHKeys: sshKeys, // Add SSH key IDs here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +115,9 @@ var myCreate *windowCreate
|
||||||
// This is initializes the main DO object
|
// This is initializes the main DO object
|
||||||
// You can only have one of these
|
// You can only have one of these
|
||||||
func InitCreateWindow() *windowCreate {
|
func InitCreateWindow() *windowCreate {
|
||||||
if ! myDo.Ready() {return nil}
|
if !myDo.Ready() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if myCreate != nil {
|
if myCreate != nil {
|
||||||
myCreate.Show()
|
myCreate.Show()
|
||||||
return myCreate
|
return myCreate
|
||||||
|
@ -127,7 +130,7 @@ func InitCreateWindow() *windowCreate {
|
||||||
// make a group label and a grid
|
// make a group label and a grid
|
||||||
myCreate.group = myCreate.window.NewGroup("droplets:").Pad()
|
myCreate.group = myCreate.window.NewGroup("droplets:").Pad()
|
||||||
myCreate.grid = myCreate.group.NewGrid("grid", 2, 1).Pad()
|
myCreate.grid = myCreate.group.NewGrid("grid", 2, 1).Pad()
|
||||||
|
|
||||||
myCreate.name = gadgets.NewBasicEntry(myCreate.grid, "Name").Set("test.wit.com")
|
myCreate.name = gadgets.NewBasicEntry(myCreate.grid, "Name").Set("test.wit.com")
|
||||||
|
|
||||||
myCreate.region = gadgets.NewBasicDropdown(myCreate.grid, "Region")
|
myCreate.region = gadgets.NewBasicDropdown(myCreate.grid, "Region")
|
||||||
|
@ -143,7 +146,7 @@ func InitCreateWindow() *windowCreate {
|
||||||
log.Info("Skipping region. No available sizes region =", region.Name)
|
log.Info("Skipping region. No available sizes region =", region.Name)
|
||||||
} else {
|
} else {
|
||||||
s := region.Name + " (" + region.Slug + ")"
|
s := region.Name + " (" + region.Slug + ")"
|
||||||
if (myCreate.regionSlug == "") {
|
if myCreate.regionSlug == "" {
|
||||||
myCreate.regionSlug = region.Slug
|
myCreate.regionSlug = region.Slug
|
||||||
}
|
}
|
||||||
myCreate.region.Add(s)
|
myCreate.region.Add(s)
|
||||||
|
@ -205,15 +208,15 @@ func InitCreateWindow() *windowCreate {
|
||||||
|
|
||||||
// box := myCreate.group.NewBox("vBox", false).Pad()
|
// box := myCreate.group.NewBox("vBox", false).Pad()
|
||||||
box := myCreate.group.NewBox("hBox", true).Pad()
|
box := myCreate.group.NewBox("hBox", true).Pad()
|
||||||
box.NewButton("Cancel", func () {
|
box.NewButton("Cancel", func() {
|
||||||
myCreate.Hide()
|
myCreate.Hide()
|
||||||
})
|
})
|
||||||
box.NewButton("Create", func () {
|
box.NewButton("Create", func() {
|
||||||
name := myCreate.name.Get()
|
name := myCreate.name.Get()
|
||||||
size := myCreate.size.Get()
|
size := myCreate.size.Get()
|
||||||
region := myCreate.regionSlug
|
region := myCreate.regionSlug
|
||||||
image := myCreate.image.Get()
|
image := myCreate.image.Get()
|
||||||
if (region == "") {
|
if region == "" {
|
||||||
log.Info("Create() droplet name =", name, "region =", region, "size =", size, "image", image)
|
log.Info("Create() droplet name =", name, "region =", region, "size =", size, "image", image)
|
||||||
log.Info("Create() region lookup failed")
|
log.Info("Create() region lookup failed")
|
||||||
return
|
return
|
||||||
|
@ -230,7 +233,9 @@ func InitCreateWindow() *windowCreate {
|
||||||
|
|
||||||
// Find the size
|
// Find the size
|
||||||
func (d *windowCreate) UpdateSize() {
|
func (d *windowCreate) UpdateSize() {
|
||||||
if ! d.Ready() {return}
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("Now find the size. sizes count =", len(myCreate.regionSelected.Sizes))
|
log.Info("Now find the size. sizes count =", len(myCreate.regionSelected.Sizes))
|
||||||
var s string
|
var s string
|
||||||
m := myCreate.memory.Get()
|
m := myCreate.memory.Get()
|
||||||
|
@ -270,12 +275,16 @@ func (d *windowCreate) UpdateSize() {
|
||||||
|
|
||||||
// Returns true if the status is valid
|
// Returns true if the status is valid
|
||||||
func (d *windowCreate) Ready() bool {
|
func (d *windowCreate) Ready() bool {
|
||||||
if d == nil {return false}
|
if d == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return d.ready
|
return d.ready
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *windowCreate) Show() {
|
func (d *windowCreate) Show() {
|
||||||
if ! d.Ready() {return}
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("digitalocean.Show() window")
|
log.Info("digitalocean.Show() window")
|
||||||
if d.hidden {
|
if d.hidden {
|
||||||
d.window.Show()
|
d.window.Show()
|
||||||
|
@ -284,9 +293,11 @@ func (d *windowCreate) Show() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *windowCreate) Hide() {
|
func (d *windowCreate) Hide() {
|
||||||
if ! d.Ready() {return}
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("digitalocean.Hide() window")
|
log.Info("digitalocean.Hide() window")
|
||||||
if ! d.hidden {
|
if !d.hidden {
|
||||||
d.window.Hide()
|
d.window.Hide()
|
||||||
}
|
}
|
||||||
d.hidden = true
|
d.hidden = true
|
||||||
|
|
165
droplet.go
165
droplet.go
|
@ -1,10 +1,11 @@
|
||||||
package digitalocean
|
package digitalocean
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/digitalocean/godo"
|
"github.com/digitalocean/godo"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -12,10 +13,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *DigitalOcean) NewDroplet(dd *godo.Droplet) *Droplet {
|
func (d *DigitalOcean) NewDroplet(dd *godo.Droplet) *Droplet {
|
||||||
if ! myDo.Ready() {return nil}
|
if !myDo.Ready() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// check if the droplet ID already exists
|
// check if the droplet ID already exists
|
||||||
if (d.dropMap[dd.ID] != nil) {
|
if d.dropMap[dd.ID] != nil {
|
||||||
log.Error(errors.New("droplet.NewDroplet() already exists"))
|
log.Error(errors.New("droplet.NewDroplet() already exists"))
|
||||||
return d.dropMap[dd.ID]
|
return d.dropMap[dd.ID]
|
||||||
}
|
}
|
||||||
|
@ -26,7 +29,7 @@ func (d *DigitalOcean) NewDroplet(dd *godo.Droplet) *Droplet {
|
||||||
droplet.ID = dd.ID
|
droplet.ID = dd.ID
|
||||||
droplet.image = dd.Image.Name + " (" + dd.Image.Slug + ")"
|
droplet.image = dd.Image.Name + " (" + dd.Image.Slug + ")"
|
||||||
|
|
||||||
if (d.dGrid == nil) {
|
if d.dGrid == nil {
|
||||||
d.dGrid = d.group.NewGrid("grid", 12, 1).Pad()
|
d.dGrid = d.group.NewGrid("grid", 12, 1).Pad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,23 +59,23 @@ func (d *DigitalOcean) NewDroplet(dd *godo.Droplet) *Droplet {
|
||||||
droplet.imageN = d.dGrid.NewLabel(dd.Image.Slug)
|
droplet.imageN = d.dGrid.NewLabel(dd.Image.Slug)
|
||||||
droplet.statusN = d.dGrid.NewLabel(dd.Status)
|
droplet.statusN = d.dGrid.NewLabel(dd.Status)
|
||||||
|
|
||||||
droplet.connect = d.dGrid.NewButton("Connect", func () {
|
droplet.connect = d.dGrid.NewButton("Connect", func() {
|
||||||
droplet.Connect()
|
droplet.Connect()
|
||||||
})
|
})
|
||||||
|
|
||||||
droplet.edit = d.dGrid.NewButton("Edit", func () {
|
droplet.edit = d.dGrid.NewButton("Edit", func() {
|
||||||
droplet.Show()
|
droplet.Show()
|
||||||
})
|
})
|
||||||
|
|
||||||
droplet.poweroff = d.dGrid.NewButton("Power Off", func () {
|
droplet.poweroff = d.dGrid.NewButton("Power Off", func() {
|
||||||
droplet.PowerOff()
|
droplet.PowerOff()
|
||||||
})
|
})
|
||||||
|
|
||||||
droplet.poweron = d.dGrid.NewButton("Power On", func () {
|
droplet.poweron = d.dGrid.NewButton("Power On", func() {
|
||||||
droplet.PowerOn()
|
droplet.PowerOn()
|
||||||
})
|
})
|
||||||
|
|
||||||
droplet.destroy = d.dGrid.NewButton("Destroy", func () {
|
droplet.destroy = d.dGrid.NewButton("Destroy", func() {
|
||||||
droplet.Destroy()
|
droplet.Destroy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -81,9 +84,11 @@ func (d *DigitalOcean) NewDroplet(dd *godo.Droplet) *Droplet {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) Active() bool {
|
func (d *Droplet) Active() bool {
|
||||||
if ! d.Ready() {return false}
|
if !d.Ready() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
log.Log(POLL, "droplet.Active() status: ", d.poll.Status, "d.statusN.GetText() =", d.statusN.GetText())
|
log.Log(POLL, "droplet.Active() status: ", d.poll.Status, "d.statusN.GetText() =", d.statusN.GetText())
|
||||||
if (d.statusN.GetText() == "active") {
|
if d.statusN.GetText() == "active" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -91,25 +96,33 @@ func (d *Droplet) Active() bool {
|
||||||
|
|
||||||
// Returns true if the droplet is finished installing
|
// Returns true if the droplet is finished installing
|
||||||
func (d *Droplet) Ready() bool {
|
func (d *Droplet) Ready() bool {
|
||||||
if d == nil {return false}
|
if d == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return d.ready
|
return d.ready
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the droplet is running
|
// Returns true if the droplet is running
|
||||||
func (d *Droplet) On() bool {
|
func (d *Droplet) On() bool {
|
||||||
if ! d.Ready() {return false}
|
if !d.Ready() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) HasIPv4() bool {
|
func (d *Droplet) HasIPv4() bool {
|
||||||
if ! d.Ready() {return false}
|
if !d.Ready() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if d.ipv4.GetText() == "" {
|
if d.ipv4.GetText() == "" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
func (d *Droplet) HasIPv6() bool {
|
func (d *Droplet) HasIPv6() bool {
|
||||||
if ! d.Ready() {return false}
|
if !d.Ready() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if d.ipv6.GetText() == "" {
|
if d.ipv6.GetText() == "" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -117,18 +130,24 @@ func (d *Droplet) HasIPv6() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) GetIPv4() string {
|
func (d *Droplet) GetIPv4() string {
|
||||||
if ! d.Ready() {return ""}
|
if !d.Ready() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return d.ipv4.GetText()
|
return d.ipv4.GetText()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) GetIPv6() string {
|
func (d *Droplet) GetIPv6() string {
|
||||||
if ! d.Ready() {return ""}
|
if !d.Ready() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
log.Info("droplet GetIPv6 has: n.GetText()", d.ipv6.GetText())
|
log.Info("droplet GetIPv6 has: n.GetText()", d.ipv6.GetText())
|
||||||
return d.ipv6.GetText()
|
return d.ipv6.GetText()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) Connect() {
|
func (d *Droplet) Connect() {
|
||||||
if ! d.Ready() {return}
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
if d.HasIPv4() {
|
if d.HasIPv4() {
|
||||||
ipv4 := d.GetIPv4()
|
ipv4 := d.GetIPv4()
|
||||||
log.Info("droplet has IPv4 =", ipv4)
|
log.Info("droplet has IPv4 =", ipv4)
|
||||||
|
@ -145,7 +164,9 @@ func (d *Droplet) Connect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) Update(dpoll *godo.Droplet) {
|
func (d *Droplet) Update(dpoll *godo.Droplet) {
|
||||||
if ! d.Exists() {return}
|
if !d.Exists() {
|
||||||
|
return
|
||||||
|
}
|
||||||
d.poll = dpoll
|
d.poll = dpoll
|
||||||
log.Log(POLL, "droplet", dpoll.Name, "dpoll.Status =", dpoll.Status)
|
log.Log(POLL, "droplet", dpoll.Name, "dpoll.Status =", dpoll.Status)
|
||||||
log.Spew(dpoll)
|
log.Spew(dpoll)
|
||||||
|
@ -164,50 +185,58 @@ func (d *Droplet) Update(dpoll *godo.Droplet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) PowerOn() {
|
func (d *Droplet) PowerOn() {
|
||||||
if ! d.Exists() {return}
|
if !d.Exists() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("droplet.PowerOn() should do it here")
|
log.Info("droplet.PowerOn() should do it here")
|
||||||
myDo.PowerOn(d.ID)
|
myDo.PowerOn(d.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) PowerOff() {
|
func (d *Droplet) PowerOff() {
|
||||||
if ! d.Exists() {return}
|
if !d.Exists() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("droplet.PowerOff() here")
|
log.Info("droplet.PowerOff() here")
|
||||||
myDo.PowerOff(d.ID)
|
myDo.PowerOff(d.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) Destroy() {
|
func (d *Droplet) Destroy() {
|
||||||
if ! d.Exists() {return}
|
if !d.Exists() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("droplet.Destroy() ID =", d.ID, "Name =", d.nameN.GetText())
|
log.Info("droplet.Destroy() ID =", d.ID, "Name =", d.nameN.GetText())
|
||||||
myDo.deleteDroplet(d)
|
myDo.deleteDroplet(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
type Droplet struct {
|
type Droplet struct {
|
||||||
ID int `json:"id,float64,omitempty"`
|
ID int `json:"id,float64,omitempty"`
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Memory int `json:"memory,omitempty"`
|
Memory int `json:"memory,omitempty"`
|
||||||
Vcpus int `json:"vcpus,omitempty"`
|
Vcpus int `json:"vcpus,omitempty"`
|
||||||
Disk int `json:"disk,omitempty"`
|
Disk int `json:"disk,omitempty"`
|
||||||
Region *Region `json:"region,omitempty"`
|
Region *Region `json:"region,omitempty"`
|
||||||
Image *Image `json:"image,omitempty"`
|
Image *Image `json:"image,omitempty"`
|
||||||
Size *Size `json:"size,omitempty"`
|
Size *Size `json:"size,omitempty"`
|
||||||
SizeSlug string `json:"size_slug,omitempty"`
|
SizeSlug string `json:"size_slug,omitempty"`
|
||||||
BackupIDs []int `json:"backup_ids,omitempty"`
|
BackupIDs []int `json:"backup_ids,omitempty"`
|
||||||
NextBackupWindow *BackupWindow `json:"next_backup_window,omitempty"`
|
NextBackupWindow *BackupWindow `json:"next_backup_window,omitempty"`
|
||||||
SnapshotIDs []int `json:"snapshot_ids,omitempty"`
|
SnapshotIDs []int `json:"snapshot_ids,omitempty"`
|
||||||
Features []string `json:"features,omitempty"`
|
Features []string `json:"features,omitempty"`
|
||||||
Locked bool `json:"locked,bool,omitempty"`
|
Locked bool `json:"locked,bool,omitempty"`
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
Networks *Networks `json:"networks,omitempty"`
|
Networks *Networks `json:"networks,omitempty"`
|
||||||
Created string `json:"created_at,omitempty"`
|
Created string `json:"created_at,omitempty"`
|
||||||
Kernel *Kernel `json:"kernel,omitempty"`
|
Kernel *Kernel `json:"kernel,omitempty"`
|
||||||
Tags []string `json:"tags,omitempty"`
|
Tags []string `json:"tags,omitempty"`
|
||||||
VolumeIDs []string `json:"volume_ids"`
|
VolumeIDs []string `json:"volume_ids"`
|
||||||
VPCUUID string `json:"vpc_uuid,omitempty"`
|
VPCUUID string `json:"vpc_uuid,omitempty"`
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
func (d *Droplet) Show() {
|
func (d *Droplet) Show() {
|
||||||
if ! d.Exists() {return}
|
if !d.Exists() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("droplet: ID =", d.ID)
|
log.Info("droplet: ID =", d.ID)
|
||||||
log.Info("droplet: Name =", d.GetName())
|
log.Info("droplet: Name =", d.GetName())
|
||||||
log.Info("droplet: Size =", d.GetSize())
|
log.Info("droplet: Size =", d.GetSize())
|
||||||
|
@ -220,47 +249,67 @@ func (d *Droplet) Show() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) Hide() {
|
func (d *Droplet) Hide() {
|
||||||
if ! d.Exists() {return}
|
if !d.Exists() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("droplet.Hide() window")
|
log.Info("droplet.Hide() window")
|
||||||
if ! d.hidden {
|
if !d.hidden {
|
||||||
// d.window.Hide()
|
// d.window.Hide()
|
||||||
}
|
}
|
||||||
d.hidden = true
|
d.hidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) Exists() bool {
|
func (d *Droplet) Exists() bool {
|
||||||
if ! myDo.Ready() {return false}
|
if !myDo.Ready() {
|
||||||
if d == nil {return false}
|
return false
|
||||||
if d.poll == nil {return false}
|
}
|
||||||
|
if d == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if d.poll == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return d.ready
|
return d.ready
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) GetName() string {
|
func (d *Droplet) GetName() string {
|
||||||
if ! d.Ready() {return ""}
|
if !d.Ready() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return d.nameN.GetText()
|
return d.nameN.GetText()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) GetSize() string {
|
func (d *Droplet) GetSize() string {
|
||||||
if ! d.Ready() {return ""}
|
if !d.Ready() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return d.sizeSlugN.GetText()
|
return d.sizeSlugN.GetText()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) GetMemory() string {
|
func (d *Droplet) GetMemory() string {
|
||||||
if ! d.Ready() {return ""}
|
if !d.Ready() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return strconv.Itoa(d.memory)
|
return strconv.Itoa(d.memory)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) GetDisk() string {
|
func (d *Droplet) GetDisk() string {
|
||||||
if ! d.Ready() {return ""}
|
if !d.Ready() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return strconv.Itoa(d.disk)
|
return strconv.Itoa(d.disk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) GetImage() string {
|
func (d *Droplet) GetImage() string {
|
||||||
if ! d.Ready() {return ""}
|
if !d.Ready() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return d.imageN.GetText()
|
return d.imageN.GetText()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Droplet) GetStatus() string {
|
func (d *Droplet) GetStatus() string {
|
||||||
if ! d.Ready() {return ""}
|
if !d.Ready() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return d.statusN.GetText()
|
return d.statusN.GetText()
|
||||||
}
|
}
|
||||||
|
|
14
go.mod
14
go.mod
|
@ -1,26 +1,24 @@
|
||||||
module go.wit.com/gui/lib/digitalocean
|
module go.wit.com/lib/gui/digitalocean
|
||||||
|
|
||||||
go 1.21.4
|
go 1.21.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/digitalocean/godo v1.108.0
|
github.com/digitalocean/godo v1.108.0
|
||||||
go.wit.com/arg v1.4.4
|
go.wit.com/dev/alexflint/arg v1.4.5
|
||||||
go.wit.com/gui/gadgets v0.12.5
|
go.wit.com/gui v0.13.11
|
||||||
go.wit.com/gui/gui v0.12.10
|
go.wit.com/lib/gadgets v0.13.0
|
||||||
go.wit.com/log v0.5.5
|
go.wit.com/log v0.5.6
|
||||||
golang.org/x/oauth2 v0.16.0
|
golang.org/x/oauth2 v0.16.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/alexflint/go-scalar v1.2.0 // indirect
|
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
|
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
|
||||||
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
|
|
||||||
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
||||||
go.wit.com/gui/widget v1.1.3 // indirect
|
go.wit.com/widget v1.1.6 // indirect
|
||||||
golang.org/x/net v0.20.0 // indirect
|
golang.org/x/net v0.20.0 // indirect
|
||||||
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
|
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
|
|
20
go.sum
20
go.sum
|
@ -1,5 +1,3 @@
|
||||||
github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw=
|
|
||||||
github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
|
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/digitalocean/godo v1.108.0 h1:fWyMENvtxpCpva1UbKzOFnyAS04N1FNuBWWfPeTGquQ=
|
github.com/digitalocean/godo v1.108.0 h1:fWyMENvtxpCpva1UbKzOFnyAS04N1FNuBWWfPeTGquQ=
|
||||||
|
@ -25,22 +23,20 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
go.wit.com/arg v1.4.4 h1:nfW8JUsVfyXi5l3BlTq5GGhesLlnyh3ICIm8cpM2U8w=
|
|
||||||
go.wit.com/arg v1.4.4/go.mod h1:P2JoYIsJ9SSvp45qSnYibQEQPNTuTB8dTkyT9y1btsI=
|
|
||||||
go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY=
|
go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY=
|
||||||
go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
|
go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
|
||||||
go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
|
go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
|
||||||
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
||||||
go.wit.com/gui/gadgets v0.12.5 h1:Eg7UbwnvwGgYlNX+sgKQNVcbRMZyYL4ChDmS2p/DHtM=
|
go.wit.com/gui v0.13.11 h1:d74Ko/XFZYR25P/AZfCQaVO2CuGh1BSjdUp1wjktdDg=
|
||||||
go.wit.com/gui/gadgets v0.12.5/go.mod h1:OB7MtEZy/VK2HrU3yiEuzY9n4LjZwO0L06NYUAFybJs=
|
go.wit.com/gui v0.13.11/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA=
|
||||||
go.wit.com/gui/gui v0.12.10 h1:52wFdTqB/GpsFKYFTUvSbHQWNEXz114lhvTfMVrXpYM=
|
go.wit.com/lib/gadgets v0.13.0 h1:jtsEnf4DHqAxBxuYsaDlHti73rgaxYf/ffAXNB1PJAk=
|
||||||
go.wit.com/gui/gui v0.12.10/go.mod h1:YgbFWxsGqZb45oLGaHim2GukPzPgMLQcVRRI0QkrGS8=
|
go.wit.com/lib/gadgets v0.13.0/go.mod h1:xidaHAL6Nk9+M9FkySVU1AG5i39v7T3PuFphUos6LxE=
|
||||||
go.wit.com/gui/widget v1.1.3 h1:GvLzGSOF9tfmoh6HNbFdN+NSlBo2qeS/Ba2TnQQ1A1U=
|
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
|
||||||
go.wit.com/gui/widget v1.1.3/go.mod h1:A6/FaiFQtAHTjgo7c4FrokXe6bXX1Cowo35b2Lgi31E=
|
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
||||||
go.wit.com/log v0.5.5 h1:bK3b94uVKgev4jB5wg06FnvCFBEapQICTSH2YW+CWr4=
|
go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY=
|
||||||
go.wit.com/log v0.5.5/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
go.wit.com/widget v1.1.6/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
|
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
|
||||||
|
|
2
json.go
2
json.go
|
@ -1,6 +1,6 @@
|
||||||
package digitalocean
|
package digitalocean
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
11
listKeys.go
11
listKeys.go
|
@ -2,8 +2,9 @@ package digitalocean
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"golang.org/x/oauth2"
|
|
||||||
"github.com/digitalocean/godo"
|
"github.com/digitalocean/godo"
|
||||||
|
"golang.org/x/oauth2"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -28,10 +29,10 @@ func (d *DigitalOcean) ListSSHKeyID() error {
|
||||||
log.Log(POLL, "found ssh key:", key)
|
log.Log(POLL, "found ssh key:", key)
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
sshKeys := []godo.DropletCreateSSHKey{
|
sshKeys := []godo.DropletCreateSSHKey{
|
||||||
{ID: 22994569},
|
{ID: 22994569},
|
||||||
{ID: 333},
|
{ID: 333},
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// return fmt.Errorf("SSH Key not found")
|
// return fmt.Errorf("SSH Key not found")
|
||||||
|
|
29
new.go
29
new.go
|
@ -1,9 +1,10 @@
|
||||||
package digitalocean
|
package digitalocean
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"go.wit.com/gui"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var myDo *DigitalOcean
|
var myDo *DigitalOcean
|
||||||
|
@ -11,7 +12,9 @@ var myDo *DigitalOcean
|
||||||
// This is initializes the main DO object
|
// This is initializes the main DO object
|
||||||
// You can only have one of these
|
// You can only have one of these
|
||||||
func New(p *gui.Node) *DigitalOcean {
|
func New(p *gui.Node) *DigitalOcean {
|
||||||
if myDo != nil {return myDo}
|
if myDo != nil {
|
||||||
|
return myDo
|
||||||
|
}
|
||||||
myDo = new(DigitalOcean)
|
myDo = new(DigitalOcean)
|
||||||
myDo.ready = false
|
myDo.ready = false
|
||||||
myDo.parent = p
|
myDo.parent = p
|
||||||
|
@ -34,12 +37,16 @@ func New(p *gui.Node) *DigitalOcean {
|
||||||
|
|
||||||
// Returns true if the status is valid
|
// Returns true if the status is valid
|
||||||
func (d *DigitalOcean) Ready() bool {
|
func (d *DigitalOcean) Ready() bool {
|
||||||
if d == nil {return false}
|
if d == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return d.ready
|
return d.ready
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DigitalOcean) Show() {
|
func (d *DigitalOcean) Show() {
|
||||||
if ! d.Ready() {return}
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("digitalocean.Show() window")
|
log.Info("digitalocean.Show() window")
|
||||||
if d.hidden {
|
if d.hidden {
|
||||||
d.window.Show()
|
d.window.Show()
|
||||||
|
@ -48,21 +55,25 @@ func (d *DigitalOcean) Show() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DigitalOcean) Hide() {
|
func (d *DigitalOcean) Hide() {
|
||||||
if ! d.Ready() {return}
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("digitalocean.Hide() window")
|
log.Info("digitalocean.Hide() window")
|
||||||
if ! d.hidden {
|
if !d.hidden {
|
||||||
d.window.Hide()
|
d.window.Hide()
|
||||||
}
|
}
|
||||||
d.hidden = true
|
d.hidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DigitalOcean) Update() bool {
|
func (d *DigitalOcean) Update() bool {
|
||||||
if ! d.Ready() {return false}
|
if !d.Ready() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
d.ListSSHKeyID()
|
d.ListSSHKeyID()
|
||||||
if d.ListDroplets() {
|
if d.ListDroplets() {
|
||||||
for _, droplet := range d.dpolled {
|
for _, droplet := range d.dpolled {
|
||||||
// check if the droplet ID already exists
|
// check if the droplet ID already exists
|
||||||
if (d.dropMap[droplet.ID] == nil) {
|
if d.dropMap[droplet.ID] == nil {
|
||||||
d.dropMap[droplet.ID] = d.NewDroplet(&droplet)
|
d.dropMap[droplet.ID] = d.NewDroplet(&droplet)
|
||||||
} else {
|
} else {
|
||||||
log.Log(POLL, "droplet.Update()", droplet.ID, droplet.Name, "already exists")
|
log.Log(POLL, "droplet.Update()", droplet.ID, droplet.Name, "already exists")
|
||||||
|
|
|
@ -30,20 +30,20 @@ func (d *DigitalOcean) ListDroplets() bool {
|
||||||
|
|
||||||
// Iterate over droplets and print their details.
|
// Iterate over droplets and print their details.
|
||||||
/*
|
/*
|
||||||
for _, droplet := range d.polled {
|
for _, droplet := range d.polled {
|
||||||
fmt.Printf("Droplet: %s\n", droplet.Name)
|
fmt.Printf("Droplet: %s\n", droplet.Name)
|
||||||
for _, network := range droplet.Networks.V4 {
|
for _, network := range droplet.Networks.V4 {
|
||||||
if network.Type == "public" {
|
if network.Type == "public" {
|
||||||
fmt.Printf("IPv4: %s\n", network.IPAddress)
|
fmt.Printf("IPv4: %s\n", network.IPAddress)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
for _, network := range droplet.Networks.V6 {
|
||||||
for _, network := range droplet.Networks.V6 {
|
if network.Type == "public" {
|
||||||
if network.Type == "public" {
|
fmt.Printf("IPv6: %s\n", network.IPAddress)
|
||||||
fmt.Printf("IPv6: %s\n", network.IPAddress)
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Println("-------------------------")
|
||||||
}
|
}
|
||||||
fmt.Println("-------------------------")
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
112
structs.go
112
structs.go
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
The Digital Ocean Struct
|
The Digital Ocean Struct
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -7,85 +7,85 @@ package digitalocean
|
||||||
import (
|
import (
|
||||||
"github.com/digitalocean/godo"
|
"github.com/digitalocean/godo"
|
||||||
|
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DigitalOcean struct {
|
type DigitalOcean struct {
|
||||||
ready bool
|
ready bool
|
||||||
hidden bool
|
hidden bool
|
||||||
err error
|
err error
|
||||||
|
|
||||||
token string // You're Digital Ocean API key
|
token string // You're Digital Ocean API key
|
||||||
dpolled []godo.Droplet
|
dpolled []godo.Droplet
|
||||||
sshKeys []godo.Key
|
sshKeys []godo.Key
|
||||||
|
|
||||||
dropMap map[int]*Droplet
|
dropMap map[int]*Droplet
|
||||||
create *windowCreate
|
create *windowCreate
|
||||||
|
|
||||||
parent *gui.Node // should be the root of the 'gui' package binary tree
|
parent *gui.Node // should be the root of the 'gui' package binary tree
|
||||||
window *gui.Node // our window for displaying digital ocean droplets
|
window *gui.Node // our window for displaying digital ocean droplets
|
||||||
group *gui.Node
|
group *gui.Node
|
||||||
grid *gui.Node
|
grid *gui.Node
|
||||||
|
|
||||||
dGrid *gui.Node // the grid for the droplets
|
dGrid *gui.Node // the grid for the droplets
|
||||||
|
|
||||||
// Primary Directives
|
// Primary Directives
|
||||||
status *gadgets.OneLiner
|
status *gadgets.OneLiner
|
||||||
summary *gadgets.OneLiner
|
summary *gadgets.OneLiner
|
||||||
statusIPv4 *gadgets.OneLiner
|
statusIPv4 *gadgets.OneLiner
|
||||||
statusIPv6 *gadgets.OneLiner
|
statusIPv6 *gadgets.OneLiner
|
||||||
}
|
}
|
||||||
|
|
||||||
type windowCreate struct {
|
type windowCreate struct {
|
||||||
ready bool
|
ready bool
|
||||||
hidden bool
|
hidden bool
|
||||||
err error
|
err error
|
||||||
|
|
||||||
parent *gui.Node // should be the root of the 'gui' package binary tree
|
parent *gui.Node // should be the root of the 'gui' package binary tree
|
||||||
window *gui.Node // our window for displaying digital ocean droplets
|
window *gui.Node // our window for displaying digital ocean droplets
|
||||||
group *gui.Node
|
group *gui.Node
|
||||||
grid *gui.Node
|
grid *gui.Node
|
||||||
|
|
||||||
regionSelected godo.Region
|
regionSelected godo.Region
|
||||||
regionSlug string
|
regionSlug string
|
||||||
tag *gadgets.OneLiner
|
tag *gadgets.OneLiner
|
||||||
name *gadgets.BasicEntry
|
name *gadgets.BasicEntry
|
||||||
region *gadgets.BasicDropdown
|
region *gadgets.BasicDropdown
|
||||||
size *gadgets.BasicCombobox
|
size *gadgets.BasicCombobox
|
||||||
memory *gadgets.BasicDropdown
|
memory *gadgets.BasicDropdown
|
||||||
image *gadgets.BasicCombobox
|
image *gadgets.BasicCombobox
|
||||||
// nvme *gadgets.BasicCheckbox
|
// nvme *gadgets.BasicCheckbox
|
||||||
}
|
}
|
||||||
|
|
||||||
type ipButton struct {
|
type ipButton struct {
|
||||||
ip *gui.Node
|
ip *gui.Node
|
||||||
c *gui.Node
|
c *gui.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
type Droplet struct {
|
type Droplet struct {
|
||||||
ID int
|
ID int
|
||||||
image string
|
image string
|
||||||
memory int
|
memory int
|
||||||
disk int
|
disk int
|
||||||
|
|
||||||
ready bool
|
ready bool
|
||||||
hidden bool
|
hidden bool
|
||||||
err error
|
err error
|
||||||
|
|
||||||
poll *godo.Droplet // store what the digital ocean API returned
|
poll *godo.Droplet // store what the digital ocean API returned
|
||||||
|
|
||||||
nameN *gui.Node
|
nameN *gui.Node
|
||||||
sizeSlugN *gui.Node
|
sizeSlugN *gui.Node
|
||||||
statusN *gui.Node
|
statusN *gui.Node
|
||||||
imageN *gui.Node
|
imageN *gui.Node
|
||||||
|
|
||||||
destroy *gui.Node
|
destroy *gui.Node
|
||||||
connect *gui.Node
|
connect *gui.Node
|
||||||
poweron *gui.Node
|
poweron *gui.Node
|
||||||
poweroff *gui.Node
|
poweroff *gui.Node
|
||||||
edit *gui.Node
|
edit *gui.Node
|
||||||
|
|
||||||
ipv4 *gui.Node
|
ipv4 *gui.Node
|
||||||
ipv6 *gui.Node
|
ipv6 *gui.Node
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue