Merge pull request #136 from klausenbusk/detach
Remove non-working Detach function
This commit is contained in:
commit
dfa802149c
|
@ -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{
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue