Rename Result.Resp to Result.Body.
diff --git a/openstack/blockstorage/v1/apiversions/requests.go b/openstack/blockstorage/v1/apiversions/requests.go
index 79a939c..63ed76a 100644
--- a/openstack/blockstorage/v1/apiversions/requests.go
+++ b/openstack/blockstorage/v1/apiversions/requests.go
@@ -21,7 +21,7 @@
_, err := perigee.Request("GET", getURL(client, v), perigee.Options{
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200},
- Results: &res.Resp,
+ Results: &res.Body,
})
res.Err = err
return res
diff --git a/openstack/blockstorage/v1/apiversions/results.go b/openstack/blockstorage/v1/apiversions/results.go
index c2ec935..7b0df11 100644
--- a/openstack/blockstorage/v1/apiversions/results.go
+++ b/openstack/blockstorage/v1/apiversions/results.go
@@ -52,7 +52,7 @@
Version *APIVersion `mapstructure:"version"`
}
- err := mapstructure.Decode(r.Resp, &resp)
+ err := mapstructure.Decode(r.Body, &resp)
return resp.Version, err
}
diff --git a/openstack/blockstorage/v1/snapshots/requests.go b/openstack/blockstorage/v1/snapshots/requests.go
index 7fac925..792e7dd 100644
--- a/openstack/blockstorage/v1/snapshots/requests.go
+++ b/openstack/blockstorage/v1/snapshots/requests.go
@@ -73,7 +73,7 @@
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200, 201},
ReqBody: &reqBody,
- Results: &res.Resp,
+ Results: &res.Body,
})
return res
}
@@ -92,7 +92,7 @@
func Get(client *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
_, res.Err = perigee.Request("GET", getURL(client, id), perigee.Options{
- Results: &res.Resp,
+ Results: &res.Body,
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200},
})
@@ -181,7 +181,7 @@
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200},
ReqBody: &reqBody,
- Results: &res.Resp,
+ Results: &res.Body,
})
return res
}
diff --git a/openstack/blockstorage/v1/snapshots/results.go b/openstack/blockstorage/v1/snapshots/results.go
index c5c3470..d414a7d 100644
--- a/openstack/blockstorage/v1/snapshots/results.go
+++ b/openstack/blockstorage/v1/snapshots/results.go
@@ -11,28 +11,40 @@
type Snapshot struct {
// Currect status of the Snapshot.
Status string `mapstructure:"status"`
+
// Display name.
Name string `mapstructure:"display_name"`
+
// Instances onto which the Snapshot is attached.
Attachments []string `mapstructure:"attachments"`
+
// Logical group.
AvailabilityZone string `mapstructure:"availability_zone"`
+
// Is the Snapshot bootable?
Bootable string `mapstructure:"bootable"`
+
// Date created.
CreatedAt string `mapstructure:"created_at"`
+
// Display description.
Description string `mapstructure:"display_discription"`
+
// See VolumeType object for more information.
VolumeType string `mapstructure:"volume_type"`
+
// ID of the Snapshot from which this Snapshot was created.
SnapshotID string `mapstructure:"snapshot_id"`
+
// ID of the Volume from which this Snapshot was created.
VolumeID string `mapstructure:"volume_id"`
+
// User-defined key-value pairs.
Metadata map[string]string `mapstructure:"metadata"`
+
// Unique identifier.
ID string `mapstructure:"id"`
+
// Size of the Snapshot, in GB.
Size int `mapstructure:"size"`
}
@@ -82,9 +94,8 @@
return nil, r.Err
}
- m := r.Resp["metadata"].(map[string]interface{})
-
- return m, nil
+ m := r.Body.(map[string]interface{})["metadata"]
+ return m.(map[string]interface{}), nil
}
type commonResult struct {
@@ -101,7 +112,7 @@
Snapshot *Snapshot `json:"snapshot"`
}
- err := mapstructure.Decode(r.Resp, &res)
+ err := mapstructure.Decode(r.Body, &res)
return res.Snapshot, err
}
diff --git a/openstack/blockstorage/v1/volumes/requests.go b/openstack/blockstorage/v1/volumes/requests.go
index 042a33e..ae97419 100644
--- a/openstack/blockstorage/v1/volumes/requests.go
+++ b/openstack/blockstorage/v1/volumes/requests.go
@@ -88,7 +88,7 @@
_, res.Err = perigee.Request("POST", createURL(client), perigee.Options{
MoreHeaders: client.Provider.AuthenticatedHeaders(),
ReqBody: &reqBody,
- Results: &res.Resp,
+ Results: &res.Body,
OkCodes: []int{200, 201},
})
return res
@@ -108,7 +108,7 @@
func Get(client *gophercloud.ServiceClient, id string) GetResult {
var res GetResult
_, res.Err = perigee.Request("GET", getURL(client, id), perigee.Options{
- Results: &res.Resp,
+ Results: &res.Body,
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200},
})
@@ -210,7 +210,7 @@
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200},
ReqBody: &reqBody,
- Results: &res.Resp,
+ Results: &res.Body,
})
return res
}
diff --git a/openstack/blockstorage/v1/volumes/results.go b/openstack/blockstorage/v1/volumes/results.go
index 421e4ca..7215daf 100644
--- a/openstack/blockstorage/v1/volumes/results.go
+++ b/openstack/blockstorage/v1/volumes/results.go
@@ -77,7 +77,7 @@
Volume *Volume `json:"volume"`
}
- err := mapstructure.Decode(r.Resp, &res)
+ err := mapstructure.Decode(r.Body, &res)
return res.Volume, err
}
diff --git a/openstack/blockstorage/v1/volumetypes/requests.go b/openstack/blockstorage/v1/volumetypes/requests.go
index d4f880f..7253a87 100644
--- a/openstack/blockstorage/v1/volumetypes/requests.go
+++ b/openstack/blockstorage/v1/volumetypes/requests.go
@@ -49,7 +49,7 @@
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200, 201},
ReqBody: &reqBody,
- Results: &res.Resp,
+ Results: &res.Body,
})
return res
}
@@ -70,7 +70,7 @@
_, err := perigee.Request("GET", getURL(client, id), perigee.Options{
MoreHeaders: client.Provider.AuthenticatedHeaders(),
OkCodes: []int{200},
- Results: &res.Resp,
+ Results: &res.Body,
})
res.Err = err
return res
diff --git a/openstack/blockstorage/v1/volumetypes/results.go b/openstack/blockstorage/v1/volumetypes/results.go
index cdd641b..a13f7c1 100644
--- a/openstack/blockstorage/v1/volumetypes/results.go
+++ b/openstack/blockstorage/v1/volumetypes/results.go
@@ -61,7 +61,7 @@
VolumeType *VolumeType `json:"volume_type" mapstructure:"volume_type"`
}
- err := mapstructure.Decode(r.Resp, &res)
+ err := mapstructure.Decode(r.Body, &res)
return res.VolumeType, err
}