mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-05-25 19:01:57 -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
60
vendor/github.com/xanzy/go-cloudstack/cloudstack/LoadBalancerService.go
generated
vendored
60
vendor/github.com/xanzy/go-cloudstack/cloudstack/LoadBalancerService.go
generated
vendored
@@ -1067,7 +1067,7 @@ func (s *LoadBalancerService) NewListLoadBalancerRulesParams() *ListLoadBalancer
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *LoadBalancerService) GetLoadBalancerRuleID(name string, opts ...OptionFunc) (string, error) {
|
||||
func (s *LoadBalancerService) GetLoadBalancerRuleID(name string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListLoadBalancerRulesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
@@ -1075,38 +1075,38 @@ func (s *LoadBalancerService) GetLoadBalancerRuleID(name string, opts ...OptionF
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", err
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListLoadBalancerRules(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.LoadBalancerRules[0].Id, nil
|
||||
return l.LoadBalancerRules[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.LoadBalancerRules {
|
||||
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 *LoadBalancerService) GetLoadBalancerRuleByName(name string, opts ...OptionFunc) (*LoadBalancerRule, int, error) {
|
||||
id, err := s.GetLoadBalancerRuleID(name, opts...)
|
||||
id, count, err := s.GetLoadBalancerRuleID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetLoadBalancerRuleByID(id, opts...)
|
||||
@@ -1959,11 +1959,10 @@ func (s *LoadBalancerService) NewListLoadBalancerRuleInstancesParams(id string)
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *LoadBalancerService) GetLoadBalancerRuleInstanceByID(id string, opts ...OptionFunc) (*LoadBalancerRuleInstance, int, error) {
|
||||
func (s *LoadBalancerService) GetLoadBalancerRuleInstanceByID(id string, opts ...OptionFunc) (*VirtualMachine, int, error) {
|
||||
p := &ListLoadBalancerRuleInstancesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
p.p["id"] = id
|
||||
p.p["id"] = id
|
||||
|
||||
for _, fn := range opts {
|
||||
@@ -2008,7 +2007,8 @@ func (s *LoadBalancerService) ListLoadBalancerRuleInstances(p *ListLoadBalancerR
|
||||
|
||||
type ListLoadBalancerRuleInstancesResponse struct {
|
||||
Count int `json:"count"`
|
||||
LoadBalancerRuleInstances []*LoadBalancerRuleInstance `json:"lbrulevmidip"`
|
||||
LBRuleVMIDIPs []*LoadBalancerRuleInstance `json:"lbrulevmidip,omitempty"`
|
||||
LoadBalancerRuleInstances []*VirtualMachine `json:"loadbalancerruleinstance,omitempty"`
|
||||
}
|
||||
|
||||
type LoadBalancerRuleInstance struct {
|
||||
@@ -3661,7 +3661,7 @@ func (s *LoadBalancerService) NewListGlobalLoadBalancerRulesParams() *ListGlobal
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *LoadBalancerService) GetGlobalLoadBalancerRuleID(keyword string, opts ...OptionFunc) (string, error) {
|
||||
func (s *LoadBalancerService) GetGlobalLoadBalancerRuleID(keyword string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListGlobalLoadBalancerRulesParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
@@ -3669,38 +3669,38 @@ func (s *LoadBalancerService) GetGlobalLoadBalancerRuleID(keyword string, opts .
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", err
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListGlobalLoadBalancerRules(p)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", -1, err
|
||||
}
|
||||
|
||||
if l.Count == 0 {
|
||||
return "", fmt.Errorf("No match found for %s: %+v", keyword, l)
|
||||
return "", l.Count, fmt.Errorf("No match found for %s: %+v", keyword, l)
|
||||
}
|
||||
|
||||
if l.Count == 1 {
|
||||
return l.GlobalLoadBalancerRules[0].Id, nil
|
||||
return l.GlobalLoadBalancerRules[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.GlobalLoadBalancerRules {
|
||||
if v.Name == keyword {
|
||||
return v.Id, nil
|
||||
return v.Id, l.Count, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l)
|
||||
return "", l.Count, fmt.Errorf("Could not find an exact match for %s: %+v", keyword, l)
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *LoadBalancerService) GetGlobalLoadBalancerRuleByName(name string, opts ...OptionFunc) (*GlobalLoadBalancerRule, int, error) {
|
||||
id, err := s.GetGlobalLoadBalancerRuleID(name, opts...)
|
||||
id, count, err := s.GetGlobalLoadBalancerRuleID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetGlobalLoadBalancerRuleByID(id, opts...)
|
||||
@@ -4408,7 +4408,7 @@ func (s *LoadBalancerService) NewListLoadBalancersParams() *ListLoadBalancersPar
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *LoadBalancerService) GetLoadBalancerID(name string, opts ...OptionFunc) (string, error) {
|
||||
func (s *LoadBalancerService) GetLoadBalancerID(name string, opts ...OptionFunc) (string, int, error) {
|
||||
p := &ListLoadBalancersParams{}
|
||||
p.p = make(map[string]interface{})
|
||||
|
||||
@@ -4416,38 +4416,38 @@ func (s *LoadBalancerService) GetLoadBalancerID(name string, opts ...OptionFunc)
|
||||
|
||||
for _, fn := range opts {
|
||||
if err := fn(s.cs, p); err != nil {
|
||||
return "", err
|
||||
return "", -1, err
|
||||
}
|
||||
}
|
||||
|
||||
l, err := s.ListLoadBalancers(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.LoadBalancers[0].Id, nil
|
||||
return l.LoadBalancers[0].Id, l.Count, nil
|
||||
}
|
||||
|
||||
if l.Count > 1 {
|
||||
for _, v := range l.LoadBalancers {
|
||||
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 *LoadBalancerService) GetLoadBalancerByName(name string, opts ...OptionFunc) (*LoadBalancer, int, error) {
|
||||
id, err := s.GetLoadBalancerID(name, opts...)
|
||||
id, count, err := s.GetLoadBalancerID(name, opts...)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
return nil, count, err
|
||||
}
|
||||
|
||||
r, count, err := s.GetLoadBalancerByID(id, opts...)
|
||||
|
||||
Reference in New Issue
Block a user