Remove updrage droplet action (deprecated)
The upgrade droplet action is no longer supported by the v2 API. It returns "410 The specified action type is no longer available". This removes the Upgrade method from the DropletActionsService.
This commit is contained in:
parent
98504c2536
commit
d6417d85b8
|
@ -40,7 +40,6 @@ type DropletActionsService interface {
|
|||
EnableIPv6ByTag(context.Context, string) ([]Action, *Response, error)
|
||||
EnablePrivateNetworking(context.Context, int) (*Action, *Response, error)
|
||||
EnablePrivateNetworkingByTag(context.Context, string) ([]Action, *Response, error)
|
||||
Upgrade(context.Context, int) (*Action, *Response, error)
|
||||
Get(context.Context, int, int) (*Action, *Response, error)
|
||||
GetByURI(context.Context, string) (*Action, *Response, error)
|
||||
}
|
||||
|
@ -230,12 +229,6 @@ func (s *DropletActionsServiceOp) EnablePrivateNetworkingByTag(ctx context.Conte
|
|||
return s.doActionByTag(ctx, tag, request)
|
||||
}
|
||||
|
||||
// Upgrade a Droplet.
|
||||
func (s *DropletActionsServiceOp) Upgrade(ctx context.Context, id int) (*Action, *Response, error) {
|
||||
request := &ActionRequest{"type": "upgrade"}
|
||||
return s.doAction(ctx, id, request)
|
||||
}
|
||||
|
||||
func (s *DropletActionsServiceOp) doAction(ctx context.Context, id int, request *ActionRequest) (*Action, *Response, error) {
|
||||
if id < 1 {
|
||||
return nil, nil, NewArgError("id", "cannot be less than 1")
|
||||
|
|
|
@ -957,41 +957,6 @@ func TestDropletAction_EnablePrivateNetworkingByTag(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestDropletAction_Upgrade(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
||||
request := &ActionRequest{
|
||||
"type": "upgrade",
|
||||
}
|
||||
|
||||
mux.HandleFunc("/v2/droplets/1/actions", func(w http.ResponseWriter, r *http.Request) {
|
||||
v := new(ActionRequest)
|
||||
err := json.NewDecoder(r.Body).Decode(v)
|
||||
if err != nil {
|
||||
t.Fatalf("decode json: %v", err)
|
||||
}
|
||||
|
||||
testMethod(t, r, http.MethodPost)
|
||||
|
||||
if !reflect.DeepEqual(v, request) {
|
||||
t.Errorf("Request body = %+v, expected %+v", v, request)
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`)
|
||||
})
|
||||
|
||||
action, _, err := client.DropletActions.Upgrade(ctx, 1)
|
||||
if err != nil {
|
||||
t.Errorf("DropletActions.Upgrade returned error: %v", err)
|
||||
}
|
||||
|
||||
expected := &Action{Status: "in-progress"}
|
||||
if !reflect.DeepEqual(action, expected) {
|
||||
t.Errorf("DropletActions.Upgrade returned %+v, expected %+v", action, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDropletActions_Get(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
|
Loading…
Reference in New Issue