blob: 683a434a05321c0aa84d0272db31c467baeddb27 [file] [log] [blame]
Jon Perrittefe6d1f2015-02-09 12:04:06 -07001package buildinfo
2
3import (
4 "github.com/mitchellh/mapstructure"
5 "github.com/rackspace/gophercloud"
6)
7
Jon Perritt99f63122015-02-11 12:39:55 -07008// Revision represents the API/Engine revision of a Heat deployment.
Jon Perrittefe6d1f2015-02-09 12:04:06 -07009type Revision struct {
10 Revision string `mapstructure:"revision"`
11}
12
13// BuildInfo represents the build information for a Heat deployment.
14type BuildInfo struct {
15 API Revision `mapstructure:"api"`
16 Engine Revision `mapstructure:"engine"`
17}
18
19// GetResult represents the result of a Get operation.
20type GetResult struct {
21 gophercloud.Result
22}
23
24// Extract returns a pointer to a BuildInfo object and is called after a
25// Get operation.
26func (r GetResult) Extract() (*BuildInfo, error) {
27 if r.Err != nil {
28 return nil, r.Err
29 }
30
31 var res BuildInfo
32 if err := mapstructure.Decode(r.Body, &res); err != nil {
33 return nil, err
34 }
35
36 return &res, nil
37}