@@ -174,12 +174,16 @@ func RestartService(client *gophercloud.ServiceClient, id string) ActionResult {
174
174
func ResizeInstance (client * gophercloud.ServiceClient , id , flavorRef string ) ActionResult {
175
175
var res ActionResult
176
176
177
- reqBody := map [string ]map [string ]string {
178
- "resize" : map [string ]string {
179
- "flavorRef" : flavorRef ,
180
- },
177
+ type resize struct {
178
+ FlavorRef string `json:"flavorRef"`
181
179
}
182
180
181
+ type req struct {
182
+ Resize resize `json:"resize"`
183
+ }
184
+
185
+ reqBody := req {Resize : resize {FlavorRef : flavorRef }}
186
+
183
187
_ , res .Err = client .Request ("POST" , actionURL (client , id ), gophercloud.RequestOpts {
184
188
JSONBody : reqBody ,
185
189
OkCodes : []int {202 },
@@ -194,12 +198,20 @@ func ResizeInstance(client *gophercloud.ServiceClient, id, flavorRef string) Act
194
198
func ResizeVolume (client * gophercloud.ServiceClient , id string , size int ) ActionResult {
195
199
var res ActionResult
196
200
197
- reqBody := map [string ]map [string ]map [string ]int {
198
- "resize" : map [string ]map [string ]int {
199
- "volume" : map [string ]int {"size" : size },
200
- },
201
+ type volume struct {
202
+ Size int `json:"size"`
203
+ }
204
+
205
+ type resize struct {
206
+ Volume volume `json:"volume"`
207
+ }
208
+
209
+ type req struct {
210
+ Resize resize `json:"resize"`
201
211
}
202
212
213
+ reqBody := req {Resize : resize {Volume : volume {Size : size }}}
214
+
203
215
_ , res .Err = client .Request ("POST" , actionURL (client , id ), gophercloud.RequestOpts {
204
216
JSONBody : reqBody ,
205
217
OkCodes : []int {202 },
0 commit comments