parent
f204088619
commit
3a22405468
|
@ -31,7 +31,8 @@ message Droplet {
|
||||||
int64 size = 2;
|
int64 size = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
message StorageInfo {
|
message StorageInfo {
|
||||||
int64 capacity = 1; // Stores the storage capacity in bytes.
|
int64 capacity = 1; // Stores the storage capacity in bytes.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
10
helpers.go
10
helpers.go
|
@ -103,7 +103,17 @@ func (c *Cluster) AddDroplet(hostname string, cpus int, mem int) *Droplet {
|
||||||
d.Cpus = 1
|
d.Cpus = 1
|
||||||
}
|
}
|
||||||
d.Memory = SetGB(mem * 32)
|
d.Memory = SetGB(mem * 32)
|
||||||
|
if d.Testsi == nil {
|
||||||
|
fmt.Println("Testsi is NIL")
|
||||||
|
fmt.Println("Testsi is NIL")
|
||||||
|
fmt.Println("Testsi is NIL")
|
||||||
|
fmt.Println("Testsi is NIL")
|
||||||
|
var newInfo StorageInfo
|
||||||
|
newInfo = StorageInfo{Capacity: 64}
|
||||||
|
d.Testsi = &newInfo
|
||||||
|
} else {
|
||||||
d.Testsi.Capacity = SetGB(mem * 32)
|
d.Testsi.Capacity = SetGB(mem * 32)
|
||||||
|
}
|
||||||
// d.Testsi = StorageInfo{Capacity: 64}
|
// d.Testsi = StorageInfo{Capacity: 64}
|
||||||
c.Droplets = append(c.Droplets, d)
|
c.Droplets = append(c.Droplets, d)
|
||||||
return d
|
return d
|
||||||
|
|
|
@ -6,10 +6,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StorageInfo struct {
|
|
||||||
Capacity int64
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON custom marshals the StorageInfo struct to JSON
|
// MarshalJSON custom marshals the StorageInfo struct to JSON
|
||||||
func (s StorageInfo) MarshalJSON() ([]byte, error) {
|
func (s StorageInfo) MarshalJSON() ([]byte, error) {
|
||||||
capacityStr := fmt.Sprintf("%d GB", s.Capacity)
|
capacityStr := fmt.Sprintf("%d GB", s.Capacity)
|
||||||
|
|
Loading…
Reference in New Issue