mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-04-27 18:00:48 -04:00
Update go-cloudstack dependency
This commit is contained in:
25
vendor/github.com/xanzy/go-cloudstack/cloudstack/AddressService.go
generated
vendored
25
vendor/github.com/xanzy/go-cloudstack/cloudstack/AddressService.go
generated
vendored
@@ -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.
|
||||
@@ -581,12 +581,18 @@ func (s *AddressService) NewListPublicIpAddressesParams() *ListPublicIpAddresses
|
||||
}
|
||||
|
||||
// This is a courtesy helper function, which in some cases may not work as expected!
|
||||
func (s *AddressService) GetPublicIpAddressByID(id string) (*PublicIpAddress, int, error) {
|
||||
func (s *AddressService) GetPublicIpAddressByID(id string, opts ...OptionFunc) (*PublicIpAddress, int, error) {
|
||||
p := &ListPublicIpAddressesParams{}
|
||||
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.ListPublicIpAddresses(p)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), fmt.Sprintf(
|
||||
@@ -597,21 +603,6 @@ func (s *AddressService) GetPublicIpAddressByID(id string) (*PublicIpAddress, in
|
||||
return nil, -1, err
|
||||
}
|
||||
|
||||
if l.Count == 0 {
|
||||
// If no matches, search all projects
|
||||
p.p["projectid"] = "-1"
|
||||
|
||||
l, err = s.ListPublicIpAddresses(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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user