Update go-cloudstack dependency

This commit is contained in:
Sander van Harmelen
2016-04-21 16:57:02 +02:00
parent b53d0d29c8
commit cbea101ecf
65 changed files with 1076 additions and 1017 deletions

View File

@@ -1,5 +1,5 @@
//
// Copyright 2014, Sander van Harmelen
// Copyright 2016, Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -935,27 +935,23 @@ func (s *NetworkService) NewListNetworksParams() *ListNetworksParams {
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetNetworkID(keyword string) (string, error) {
func (s *NetworkService) GetNetworkID(keyword string, opts ...OptionFunc) (string, error) {
p := &ListNetworksParams{}
p.p = make(map[string]interface{})
p.p["keyword"] = keyword
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return "", err
}
}
l, err := s.ListNetworks(p)
if err != nil {
return "", err
}
if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"
l, err = s.ListNetworks(p)
if err != nil {
return "", err
}
}
if l.Count == 0 {
return "", fmt.Errorf("No match found for %s: %+v", keyword, l)
}
@@ -975,13 +971,13 @@ func (s *NetworkService) GetNetworkID(keyword string) (string, error) {
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetNetworkByName(name string) (*Network, int, error) {
id, err := s.GetNetworkID(name)
func (s *NetworkService) GetNetworkByName(name string, opts ...OptionFunc) (*Network, int, error) {
id, err := s.GetNetworkID(name, opts...)
if err != nil {
return nil, -1, err
}
r, count, err := s.GetNetworkByID(id)
r, count, err := s.GetNetworkByID(id, opts...)
if err != nil {
return nil, count, err
}
@@ -989,12 +985,18 @@ func (s *NetworkService) GetNetworkByName(name string) (*Network, int, error) {
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetNetworkByID(id string) (*Network, int, error) {
func (s *NetworkService) GetNetworkByID(id string, opts ...OptionFunc) (*Network, int, error) {
p := &ListNetworksParams{}
p.p = make(map[string]interface{})
p.p["id"] = id
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return nil, -1, err
}
}
l, err := s.ListNetworks(p)
if err != nil {
if strings.Contains(err.Error(), fmt.Sprintf(
@@ -1005,21 +1007,6 @@ func (s *NetworkService) GetNetworkByID(id string) (*Network, int, error) {
return nil, -1, err
}
if l.Count == 0 {
// If no matches, search all projects
p.p["projectid"] = "-1"
l, err = s.ListNetworks(p)
if err != nil {
if strings.Contains(err.Error(), fmt.Sprintf(
"Invalid parameter id value=%s due to incorrect long value format, "+
"or entity does not exist", id)) {
return nil, 0, fmt.Errorf("No match found for %s: %+v", id, l)
}
return nil, -1, err
}
}
if l.Count == 0 {
return nil, l.Count, fmt.Errorf("No match found for %s: %+v", id, l)
}
@@ -1801,12 +1788,18 @@ func (s *NetworkService) NewListPhysicalNetworksParams() *ListPhysicalNetworksPa
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetPhysicalNetworkID(name string) (string, error) {
func (s *NetworkService) GetPhysicalNetworkID(name string, opts ...OptionFunc) (string, error) {
p := &ListPhysicalNetworksParams{}
p.p = make(map[string]interface{})
p.p["name"] = name
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return "", err
}
}
l, err := s.ListPhysicalNetworks(p)
if err != nil {
return "", err
@@ -1831,13 +1824,13 @@ func (s *NetworkService) GetPhysicalNetworkID(name string) (string, error) {
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetPhysicalNetworkByName(name string) (*PhysicalNetwork, int, error) {
id, err := s.GetPhysicalNetworkID(name)
func (s *NetworkService) GetPhysicalNetworkByName(name string, opts ...OptionFunc) (*PhysicalNetwork, int, error) {
id, err := s.GetPhysicalNetworkID(name, opts...)
if err != nil {
return nil, -1, err
}
r, count, err := s.GetPhysicalNetworkByID(id)
r, count, err := s.GetPhysicalNetworkByID(id, opts...)
if err != nil {
return nil, count, err
}
@@ -1845,12 +1838,18 @@ func (s *NetworkService) GetPhysicalNetworkByName(name string) (*PhysicalNetwork
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetPhysicalNetworkByID(id string) (*PhysicalNetwork, int, error) {
func (s *NetworkService) GetPhysicalNetworkByID(id string, opts ...OptionFunc) (*PhysicalNetwork, int, error) {
p := &ListPhysicalNetworksParams{}
p.p = make(map[string]interface{})
p.p["id"] = id
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return nil, -1, err
}
}
l, err := s.ListPhysicalNetworks(p)
if err != nil {
if strings.Contains(err.Error(), fmt.Sprintf(
@@ -2410,12 +2409,18 @@ func (s *NetworkService) NewListNetworkServiceProvidersParams() *ListNetworkServ
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetNetworkServiceProviderID(name string) (string, error) {
func (s *NetworkService) GetNetworkServiceProviderID(name string, opts ...OptionFunc) (string, error) {
p := &ListNetworkServiceProvidersParams{}
p.p = make(map[string]interface{})
p.p["name"] = name
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return "", err
}
}
l, err := s.ListNetworkServiceProviders(p)
if err != nil {
return "", err
@@ -2862,12 +2867,18 @@ func (s *NetworkService) NewListStorageNetworkIpRangeParams() *ListStorageNetwor
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetStorageNetworkIpRangeByID(id string) (*StorageNetworkIpRange, int, error) {
func (s *NetworkService) GetStorageNetworkIpRangeByID(id string, opts ...OptionFunc) (*StorageNetworkIpRange, int, error) {
p := &ListStorageNetworkIpRangeParams{}
p.p = make(map[string]interface{})
p.p["id"] = id
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return nil, -1, err
}
}
l, err := s.ListStorageNetworkIpRange(p)
if err != nil {
if strings.Contains(err.Error(), fmt.Sprintf(
@@ -3111,13 +3122,19 @@ func (s *NetworkService) NewListPaloAltoFirewallNetworksParams(lbdeviceid string
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetPaloAltoFirewallNetworkID(keyword string, lbdeviceid string) (string, error) {
func (s *NetworkService) GetPaloAltoFirewallNetworkID(keyword string, lbdeviceid string, opts ...OptionFunc) (string, error) {
p := &ListPaloAltoFirewallNetworksParams{}
p.p = make(map[string]interface{})
p.p["keyword"] = keyword
p.p["lbdeviceid"] = lbdeviceid
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return "", err
}
}
l, err := s.ListPaloAltoFirewallNetworks(p)
if err != nil {
return "", err
@@ -3306,13 +3323,19 @@ func (s *NetworkService) NewListNetscalerLoadBalancerNetworksParams(lbdeviceid s
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetNetscalerLoadBalancerNetworkID(keyword string, lbdeviceid string) (string, error) {
func (s *NetworkService) GetNetscalerLoadBalancerNetworkID(keyword string, lbdeviceid string, opts ...OptionFunc) (string, error) {
p := &ListNetscalerLoadBalancerNetworksParams{}
p.p = make(map[string]interface{})
p.p["keyword"] = keyword
p.p["lbdeviceid"] = lbdeviceid
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return "", err
}
}
l, err := s.ListNetscalerLoadBalancerNetworks(p)
if err != nil {
return "", err
@@ -3501,13 +3524,19 @@ func (s *NetworkService) NewListNiciraNvpDeviceNetworksParams(nvpdeviceid string
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetNiciraNvpDeviceNetworkID(keyword string, nvpdeviceid string) (string, error) {
func (s *NetworkService) GetNiciraNvpDeviceNetworkID(keyword string, nvpdeviceid string, opts ...OptionFunc) (string, error) {
p := &ListNiciraNvpDeviceNetworksParams{}
p.p = make(map[string]interface{})
p.p["keyword"] = keyword
p.p["nvpdeviceid"] = nvpdeviceid
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return "", err
}
}
l, err := s.ListNiciraNvpDeviceNetworks(p)
if err != nil {
return "", err
@@ -3935,12 +3964,18 @@ func (s *NetworkService) NewListOpenDaylightControllersParams() *ListOpenDayligh
}
// This is a courtesy helper function, which in some cases may not work as expected!
func (s *NetworkService) GetOpenDaylightControllerByID(id string) (*OpenDaylightController, int, error) {
func (s *NetworkService) GetOpenDaylightControllerByID(id string, opts ...OptionFunc) (*OpenDaylightController, int, error) {
p := &ListOpenDaylightControllersParams{}
p.p = make(map[string]interface{})
p.p["id"] = id
for _, fn := range opts {
if err := fn(s.cs, p); err != nil {
return nil, -1, err
}
}
l, err := s.ListOpenDaylightControllers(p)
if err != nil {
if strings.Contains(err.Error(), fmt.Sprintf(