forked from gophercloud/gophercloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
67 lines (54 loc) · 1.75 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
/*
Package extendedserverattributes provides the ability to extend a
server result with the extended usage information.
Example to Get basic extended information:
type serverAttributesExt struct {
servers.Server
extendedserverattributes.ServerAttributesExt
}
var serverWithAttributesExt serverAttributesExt
err := servers.Get(computeClient, "d650a0ce-17c3-497d-961a-43c4af80998a").ExtractInto(&serverWithAttributesExt)
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", serverWithAttributesExt)
Example to get additional fields with microversion 2.3 or later
computeClient.Microversion = "2.3"
result := servers.Get(computeClient, "d650a0ce-17c3-497d-961a-43c4af80998a")
reservationID, err := extendedserverattributes.ExtractReservationID(result.Result)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", reservationID)
launchIndex, err := extendedserverattributes.ExtractLaunchIndex(result.Result)
if err != nil {
panic(err)
}
fmt.Printf("%d\n", launchIndex)
ramdiskID, err := extendedserverattributes.ExtractRamdiskID(result.Result)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", ramdiskID)
kernelID, err := extendedserverattributes.ExtractKernelID(result.Result)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", kernelID)
hostname, err := extendedserverattributes.ExtractHostname(result.Result)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", hostname)
rootDeviceName, err := extendedserverattributes.ExtractRootDeviceName(result.Result)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", rootDeviceName)
userData, err := extendedserverattributes.ExtractUserData(result.Result)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", userData)
*/
package extendedserverattributes