Removing awkward nested maps
diff --git a/openstack/db/v1/instances/requests.go b/openstack/db/v1/instances/requests.go
index d87fdec..63406c7 100644
--- a/openstack/db/v1/instances/requests.go
+++ b/openstack/db/v1/instances/requests.go
@@ -174,12 +174,16 @@
func ResizeInstance(client *gophercloud.ServiceClient, id, flavorRef string) ActionResult {
var res ActionResult
- reqBody := map[string]map[string]string{
- "resize": map[string]string{
- "flavorRef": flavorRef,
- },
+ type resize struct {
+ FlavorRef string `json:"flavorRef"`
}
+ type req struct {
+ Resize resize `json:"resize"`
+ }
+
+ reqBody := req{Resize: resize{FlavorRef: flavorRef}}
+
_, res.Err = client.Request("POST", actionURL(client, id), gophercloud.RequestOpts{
JSONBody: reqBody,
OkCodes: []int{202},
@@ -194,12 +198,20 @@
func ResizeVolume(client *gophercloud.ServiceClient, id string, size int) ActionResult {
var res ActionResult
- reqBody := map[string]map[string]map[string]int{
- "resize": map[string]map[string]int{
- "volume": map[string]int{"size": size},
- },
+ type volume struct {
+ Size int `json:"size"`
}
+ type resize struct {
+ Volume volume `json:"volume"`
+ }
+
+ type req struct {
+ Resize resize `json:"resize"`
+ }
+
+ reqBody := req{Resize: resize{Volume: volume{Size: size}}}
+
_, res.Err = client.Request("POST", actionURL(client, id), gophercloud.RequestOpts{
JSONBody: reqBody,
OkCodes: []int{202},