github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/compute/v2/extensions/volumeattach/doc.go (about) 1 /* 2 Package volumeattach provides the ability to attach and detach volumes 3 from servers. 4 5 Example to Attach a Volume 6 7 serverID := "7ac8686c-de71-4acb-9600-ec18b1a1ed6d" 8 volumeID := "87463836-f0e2-4029-abf6-20c8892a3103" 9 10 createOpts := volumeattach.CreateOpts{ 11 Device: "/dev/vdc", 12 VolumeID: volumeID, 13 } 14 15 result, err := volumeattach.Create(computeClient, serverID, createOpts).Extract() 16 if err != nil { 17 panic(err) 18 } 19 20 Example to Detach a Volume 21 22 serverID := "7ac8686c-de71-4acb-9600-ec18b1a1ed6d" 23 attachmentID := "ed081613-1c9b-4231-aa5e-ebfd4d87f983" 24 25 err := volumeattach.Delete(computeClient, serverID, attachmentID).ExtractErr() 26 if err != nil { 27 panic(err) 28 } 29 */ 30 package volumeattach