forked from huaweicloud/huaweicloud-sdk-go
/
doc.go
46 lines (36 loc) · 1.06 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
/*
Package diskconfig provides information and interaction with the Disk Config
extension that works with the OpenStack Compute service.
Example of Obtaining the Disk Config of a Server
type ServerWithDiskConfig {
servers.Server
diskconfig.ServerDiskConfigExt
}
var allServers []ServerWithDiskConfig
allPages, err := servers.List(client, nil).AllPages()
if err != nil {
panic("Unable to retrieve servers: %s", err)
}
err = servers.ExtractServersInto(allPages, &allServers)
if err != nil {
panic("Unable to extract servers: %s", err)
}
for _, server := range allServers {
fmt.Println(server.DiskConfig)
}
Example of Creating a Server with Disk Config
serverCreateOpts := servers.CreateOpts{
Name: "server_name",
ImageRef: "image-uuid",
FlavorRef: "flavor-uuid",
}
createOpts := diskconfig.CreateOptsExt{
CreateOptsBuilder: serverCreateOpts,
DiskConfig: diskconfig.Manual,
}
server, err := servers.Create(computeClient, createOpts).Extract()
if err != nil {
panic("Unable to create server: %s", err)
}
*/
package diskconfig