parent
15efe46bc4
commit
9e34b3d3f4
12
cloud.go
12
cloud.go
|
@ -1,5 +1,13 @@
|
||||||
package virtigolib
|
package virtigolib
|
||||||
|
|
||||||
|
// makes a Cluster interface which is:
|
||||||
|
|
||||||
|
// a number of hypervisors (the physical machines)
|
||||||
|
// a list of the virtual machines
|
||||||
|
// functions to start, stop, etc virtual machines
|
||||||
|
|
||||||
|
// virtual machines are often called droplets to make it easier to understand
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -30,6 +38,7 @@ type cloudAPI interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCloud() *CloudManager {
|
func NewCloud() *CloudManager {
|
||||||
|
// client := virtbuf.NewRealCloudAPIClient()
|
||||||
// clusterManager := NewCloudManager(myClient)
|
// clusterManager := NewCloudManager(myClient)
|
||||||
newCloudManager := &CloudManager{client: myClient}
|
newCloudManager := &CloudManager{client: myClient}
|
||||||
|
|
||||||
|
@ -45,6 +54,9 @@ func NewCloud() *CloudManager {
|
||||||
|
|
||||||
// FindByName retrieves a cluster by name.
|
// FindByName retrieves a cluster by name.
|
||||||
func (m *CloudManager) FindDropletByName(name string) (*virtbuf.Droplet, error) {
|
func (m *CloudManager) FindDropletByName(name string) (*virtbuf.Droplet, error) {
|
||||||
|
if m.cluster == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
d := m.cluster.FindDropletByName(name)
|
d := m.cluster.FindDropletByName(name)
|
||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue