github.com/gophercloud/gophercloud@v1.11.0/openstack/compute/v2/extensions/extendedserverattributes/doc.go (about) 1 /* 2 Package extendedserverattributes provides the ability to extend a 3 server result with the extended usage information. 4 5 Example to Get basic extended information: 6 7 type serverAttributesExt struct { 8 servers.Server 9 extendedserverattributes.ServerAttributesExt 10 } 11 var serverWithAttributesExt serverAttributesExt 12 13 err := servers.Get(computeClient, "d650a0ce-17c3-497d-961a-43c4af80998a").ExtractInto(&serverWithAttributesExt) 14 if err != nil { 15 panic(err) 16 } 17 18 fmt.Printf("%+v\n", serverWithAttributesExt) 19 20 Example to get additional fields with microversion 2.3 or later 21 22 computeClient.Microversion = "2.3" 23 result := servers.Get(computeClient, "d650a0ce-17c3-497d-961a-43c4af80998a") 24 25 reservationID, err := extendedserverattributes.ExtractReservationID(result.Result) 26 if err != nil { 27 panic(err) 28 } 29 fmt.Printf("%s\n", reservationID) 30 31 launchIndex, err := extendedserverattributes.ExtractLaunchIndex(result.Result) 32 if err != nil { 33 panic(err) 34 } 35 fmt.Printf("%d\n", launchIndex) 36 37 ramdiskID, err := extendedserverattributes.ExtractRamdiskID(result.Result) 38 if err != nil { 39 panic(err) 40 } 41 fmt.Printf("%s\n", ramdiskID) 42 43 kernelID, err := extendedserverattributes.ExtractKernelID(result.Result) 44 if err != nil { 45 panic(err) 46 } 47 fmt.Printf("%s\n", kernelID) 48 49 hostname, err := extendedserverattributes.ExtractHostname(result.Result) 50 if err != nil { 51 panic(err) 52 } 53 fmt.Printf("%s\n", hostname) 54 55 rootDeviceName, err := extendedserverattributes.ExtractRootDeviceName(result.Result) 56 if err != nil { 57 panic(err) 58 } 59 fmt.Printf("%s\n", rootDeviceName) 60 61 userData, err := extendedserverattributes.ExtractUserData(result.Result) 62 if err != nil { 63 panic(err) 64 } 65 fmt.Printf("%s\n", userData) 66 */ 67 package extendedserverattributes