Add boolean disk option to Resize droplet action.
This commit is contained in:
parent
1a08a979da
commit
68fe5fa87e
|
@ -18,7 +18,7 @@ type DropletActionsService interface {
|
|||
PowerCycle(int) (*Action, *Response, error)
|
||||
Reboot(int) (*Action, *Response, error)
|
||||
Restore(int, int) (*Action, *Response, error)
|
||||
Resize(int, string) (*Action, *Response, error)
|
||||
Resize(int, string, bool) (*Action, *Response, error)
|
||||
Rename(int, string) (*Action, *Response, error)
|
||||
Snapshot(int, string) (*Action, *Response, error)
|
||||
doAction(int, *ActionRequest) (*Action, *Response, error)
|
||||
|
@ -73,11 +73,12 @@ func (s *DropletActionsServiceOp) Restore(id, imageID int) (*Action, *Response,
|
|||
}
|
||||
|
||||
// Resize a Droplet
|
||||
func (s *DropletActionsServiceOp) Resize(id int, sizeSlug string) (*Action, *Response, error) {
|
||||
func (s *DropletActionsServiceOp) Resize(id int, sizeSlug string, resizeDisk bool) (*Action, *Response, error) {
|
||||
requestType := "resize"
|
||||
request := &ActionRequest{
|
||||
"type": requestType,
|
||||
"size": sizeSlug,
|
||||
"disk": resizeDisk,
|
||||
}
|
||||
return s.doAction(id, request)
|
||||
}
|
||||
|
@ -154,4 +155,4 @@ func (s *DropletActionsServiceOp) get(path string) (*Action, *Response, error) {
|
|||
|
||||
func dropletActionPath(dropletID int) string {
|
||||
return fmt.Sprintf("v2/droplets/%d/actions", dropletID)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,6 +180,7 @@ func TestDropletAction_Resize(t *testing.T) {
|
|||
request := &ActionRequest{
|
||||
"type": "resize",
|
||||
"size": "1024mb",
|
||||
"disk": true,
|
||||
}
|
||||
|
||||
mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -196,7 +197,7 @@ func TestDropletAction_Resize(t *testing.T) {
|
|||
|
||||
})
|
||||
|
||||
action, _, err := client.DropletActions.Resize(1, "1024mb")
|
||||
action, _, err := client.DropletActions.Resize(1, "1024mb", true)
|
||||
if err != nil {
|
||||
t.Errorf("DropletActions.Resize returned error: %v", err)
|
||||
}
|
||||
|
@ -323,4 +324,4 @@ func TestDropletActions_Get(t *testing.T) {
|
|||
if !reflect.DeepEqual(action, expected) {
|
||||
t.Errorf("DropletActions.Get returned %+v, expected %+v", action, expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue