forked from huaweicloud/huaweicloud-sdk-go
/
doc.go
63 lines (52 loc) · 1.41 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
/*
Package volumetypes provides information and interaction with volume types in the
OpenStack Block Storage service. A volume type is a collection of specs used to
define the volume capabilities.
Example to list Volume Types
allPages, err := volumetypes.List(client, volumetypes.ListOpts{}).AllPages()
if err != nil{
panic(err)
}
volumeTypes, err := volumetypes.ExtractVolumeTypes(allPages)
if err != nil{
panic(err)
}
for _,vt := range volumeTypes{
fmt.Println(vt)
}
Example to show a Volume Type
typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
volumeType, err := volumetypes.Get(client, typeID).Extract()
if err != nil{
panic(err)
}
fmt.Println(volumeType)
Example to create a Volume Type
volumeType, err := volumetypes.Create(client, volumetypes.CreateOpts{
Name:"volume_type_001",
IsPublic:true,
Description:"description_001",
}).Extract()
if err != nil{
panic(err)
}
fmt.Println(volumeType)
Example to delete a Volume Type
typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
err := volumetypes.Delete(client, typeID).ExtractErr()
if err != nil{
panic(err)
}
Example to update a Volume Type
typeID := "7ffaca22-f646-41d4-b79d-d7e4452ef8cc"
volumetype, err = volumetypes.Update(client, typeID, volumetypes.UpdateOpts{
Name: "volume_type_002",
Description:"description_002",
IsPublic:false,
}).Extract()
if err != nil{
panic(err)
}
fmt.Println(volumetype)
*/
package volumetypes