forked from gophercloud/gophercloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
87 lines (65 loc) · 1.68 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
Package attachments provides access to OpenStack Block Storage Attachment
API's. Use of this package requires Cinder version 3.27 at a minimum.
For more information, see:
https://docs.openstack.org/api-ref/block-storage/v3/index.html#attachments
Example to List Attachments
listOpts := &attachments.ListOpts{
InstanceID: "uuid",
}
client.Microversion = "3.27"
allPages, err := attachments.List(client, listOpts).AllPages()
if err != nil {
panic(err)
}
allAttachments, err := attachments.ExtractAttachments(allPages)
if err != nil {
panic(err)
}
for _, attachment := range allAttachments {
fmt.Println(attachment)
}
Example to Create Attachment
createOpts := &attachments.CreateOpts{
InstanceiUUID: "uuid",
VolumeUUID: "uuid"
}
client.Microversion = "3.27"
attachment, err := attachments.Create(client, createOpts).Extract()
if err != nil {
panic(err)
}
fmt.Println(attachment)
Example to Get Attachment
client.Microversion = "3.27"
attachment, err := attachments.Get(client, "uuid").Extract()
if err != nil {
panic(err)
}
fmt.Println(attachment)
Example to Update Attachment
opts := &attachments.UpdateOpts{
Connector: map[string]interface{}{
"mode": "ro",
}
}
client.Microversion = "3.27"
attachment, err := attachments.Update(client, "uuid", opts).Extract()
if err != nil {
panic(err)
}
fmt.Println(attachment)
Example to Complete Attachment
client.Microversion = "3.44"
err := attachments.Complete(client, "uuid").ExtractErr()
if err != nil {
panic(err)
}
Example to Delete Attachment
client.Microversion = "3.27"
err := attachments.Delete(client, "uuid").ExtractErr()
if err != nil {
panic(err)
}
*/
package attachments