Remove non-working Detach function

The function returns "422 Attachment not found" all the time (tested
with doctl), and the doc* also says that droplet id should be
specified.

* https://developers.digitalocean.com/documentation/v2/#remove-a-block-storage-volume-from-a-droplet
This commit is contained in:
Kristian Klausen 2017-03-30 03:09:19 +02:00
parent d59ed2fe84
commit 34f0bb60fa
2 changed files with 0 additions and 39 deletions

View File

@ -10,7 +10,6 @@ import (
// See: https://developers.digitalocean.com/documentation/v2#storage-actions
type StorageActionsService interface {
Attach(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error)
Detach(ctx context.Context, volumeID string) (*Action, *Response, error)
DetachByDropletID(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error)
Get(ctx context.Context, volumeID string, actionID int) (*Action, *Response, error)
List(ctx context.Context, volumeID string, opt *ListOptions) ([]Action, *Response, error)
@ -38,14 +37,6 @@ func (s *StorageActionsServiceOp) Attach(ctx context.Context, volumeID string, d
return s.doAction(ctx, volumeID, request)
}
// Detach a storage volume from a Droplet.
func (s *StorageActionsServiceOp) Detach(ctx context.Context, volumeID string) (*Action, *Response, error) {
request := &ActionRequest{
"type": "detach",
}
return s.doAction(ctx, volumeID, request)
}
// DetachByDropletID a storage volume from a Droplet by Droplet ID.
func (s *StorageActionsServiceOp) DetachByDropletID(ctx context.Context, volumeID string, dropletID int) (*Action, *Response, error) {
request := &ActionRequest{

View File

@ -42,36 +42,6 @@ func TestStoragesActions_Attach(t *testing.T) {
}
}
func TestStoragesActions_Detach(t *testing.T) {
setup()
defer teardown()
volumeID := "98d414c6-295e-4e3a-ac58-eb9456c1e1d1"
detachRequest := &ActionRequest{
"type": "detach",
}
mux.HandleFunc("/v2/volumes/"+volumeID+"/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, "POST")
if !reflect.DeepEqual(v, detachRequest) {
t.Errorf("want=%#v", detachRequest)
t.Errorf("got=%#v", v)
}
fmt.Fprintf(w, `{"action":{"status":"in-progress"}}`)
})
_, _, err := client.StorageActions.Detach(ctx, volumeID)
if err != nil {
t.Errorf("StoragesActions.Detach returned error: %v", err)
}
}
func TestStoragesActions_DetachByDropletID(t *testing.T) {
setup()
defer teardown()