provider/openstack: gophercloud migration: Add a 'MapValueSpecs' function which can be used to convert

'value_specs' resource data to a map.
This commit is contained in:
Gavin Williams 2016-10-05 17:21:54 +01:00 committed by Joe Topjian
parent 796e076313
commit ffd5370213
1 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,15 @@ func CheckDeleted(d *schema.ResourceData, err error, msg string) error {
return fmt.Errorf("%s: %s", msg, err)
}
// MapValueSpecs converts ResourceData into a map
func MapValueSpecs(d *schema.ResourceData) map[string]string {
m := make(map[string]string)
for key, val := range d.Get("value_specs").(map[string]interface{}) {
m[key] = val.(string)
}
return m
}
// BuildRequest takes an opts struct and builds a request body for
// Gophercloud to execute
func BuildRequest(opts interface{}, parent string) (map[string]interface{}, error) {