mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-10 19:00:41 -04:00
Add ability to manage cloudstack affinity groups (#8360)
Add documentation for cloudstack affinity group resource Implement improvements from review by svanharmelen Update to latest go-cloudstack v2.1.3
This commit is contained in:
committed by
Sander van Harmelen
parent
92a9a7c8b8
commit
0835b64456
18
vendor/github.com/xanzy/go-cloudstack/cloudstack/VirtualMachineService.go
generated
vendored
18
vendor/github.com/xanzy/go-cloudstack/cloudstack/VirtualMachineService.go
generated
vendored
@@ -2592,7 +2592,7 @@ func (s *VirtualMachineService) NewListVirtualMachinesParams() *ListVirtualMachi
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *VirtualMachineService) GetVirtualMachineID(name string, opts ...OptionFunc) (string, error) {
|
||||
func (s *VirtualMachineService) GetVirtualMachineID(name string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListVirtualMachinesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
@@ -2600,38 +2600,38 @@ func (s *VirtualMachineService) GetVirtualMachineID(name string, opts ...OptionF
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", err
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListVirtualMachines(p)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", -1, err
|
||||
}
|
||||
|
||||
if l.Count == 0 {
|
||||
return "", fmt.Errorf("No match found for %s: %+v", name, l)
|
||||
return "", l.Count, fmt.Errorf("No match found for %s: %+v", name, l)
|
||||
}
|
||||
|
||||
if l.Count == 1 {
|
||||
return l.VirtualMachines[0].Id, nil
|
||||
return l.VirtualMachines[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.VirtualMachines {
|
||||
if v.Name == name {
|
||||
return v.Id, nil
|
||||
return v.Id, l.Count, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
|
||||
return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", name, l)
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *VirtualMachineService) GetVirtualMachineByName(name string, opts ...OptionFunc) (*VirtualMachine, int, error) {
|
||||
id, err := s.GetVirtualMachineID(name, opts...)
|
||||
id, count, err := s.GetVirtualMachineID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetVirtualMachineByID(id, opts...)
|
||||
|
||||
Reference in New Issue
Block a user