github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/evs/extensions/volumeactions/detach.go (about)

     1  package volumeactions
     2  
     3  import "github.com/opentelekomcloud/gophertelekomcloud"
     4  
     5  type DetachOpts struct {
     6  	// AttachmentID is the ID of the attachment between a volume and instance.
     7  	AttachmentID string `json:"attachment_id,omitempty"`
     8  }
     9  
    10  func Detach(client *golangsdk.ServiceClient, id string, opts DetachOpts) (err error) {
    11  	b, err := golangsdk.BuildRequestBody(opts, "os-detach")
    12  	if err != nil {
    13  		return
    14  	}
    15  
    16  	_, err = client.Post(client.ServiceURL("volumes", id, "action"), b, nil, nil)
    17  	return
    18  }