Add ListAddresses method for cloud servers
diff --git a/servers.go b/servers.go
index 85f49ff..7133d93 100644
--- a/servers.go
+++ b/servers.go
@@ -288,6 +288,32 @@
return s, err
}
+// See the CloudServersProvider interface for details.
+func (gsp *genericServersProvider) ListAddresses(id string) (AddressSet, error) {
+ var pas *AddressSet
+ var statusCode int
+
+ err := gsp.context.WithReauth(gsp.access, func() error {
+ ep := fmt.Sprintf("%s/servers/%s/ips", gsp.endpoint, id)
+ return perigee.Get(ep, perigee.Options{
+ Results: &struct{ Addresses **AddressSet }{&pas},
+ MoreHeaders: map[string]string{
+ "X-Auth-Token": gsp.access.AuthToken(),
+ },
+ OkCodes: []int{200, 203},
+ StatusCode: &statusCode,
+ })
+ })
+
+ if err != nil {
+ if statusCode == 203 {
+ err = WarnUnauthoritative
+ }
+ }
+
+ return *pas, err
+}
+
// RaxBandwidth provides measurement of server bandwidth consumed over a given audit interval.
type RaxBandwidth struct {
AuditPeriodEnd string `json:"audit_period_end"`