blob: 968a3ec672c9ca47c5b0e9a33896edccc81ca5a1 [file] [log] [blame]
package stacktemplates
import (
"github.com/mitchellh/mapstructure"
"github.com/rackspace/gophercloud"
)
type Template struct {
Description string `mapstructure:"description"`
HeatTemplateVersion string `mapstructure:"heat_template_version"`
Parameters map[string]interface{} `mapstructure:"parameters"`
Resources map[string]interface{} `mapstructure:"resources"`
}
type GetResult struct {
gophercloud.Result
}
func (r GetResult) Extract() (*Template, error) {
if r.Err != nil {
return nil, r.Err
}
var res Template
if err := mapstructure.Decode(r.Body, &res); err != nil {
return nil, err
}
return &res, nil
}
type ValidatedTemplate struct {
Description string
Parameters map[string]interface{}
}
type ValidateResult struct {
gophercloud.Result
}
func (r ValidateResult) Extract() (*ValidatedTemplate, error) {
if r.Err != nil {
return nil, r.Err
}
var res ValidatedTemplate
if err := mapstructure.Decode(r.Body, &res); err != nil {
return nil, err
}
return &res, nil
}