Fix api interfaces for orchestration resources
Some of the interfaces don't correspond well to the values
expected by the requests and returned by api.
diff --git a/openstack/orchestration/v1/stacks/requests.go b/openstack/orchestration/v1/stacks/requests.go
index 0dd6af2..bd8e59e 100644
--- a/openstack/orchestration/v1/stacks/requests.go
+++ b/openstack/orchestration/v1/stacks/requests.go
@@ -2,6 +2,7 @@
import (
"errors"
+ "strings"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/pagination"
@@ -60,6 +61,8 @@
Parameters map[string]string
// (OPTIONAL) The timeout for stack creation in minutes.
Timeout int
+ // (OPTIONAL) A list of tags to assosciate with the Stack
+ Tags []string
}
// ToStackCreateMap casts a CreateOpts struct to a map.
@@ -97,6 +100,9 @@
s["timeout_mins"] = opts.Timeout
}
+ if opts.Tags != nil {
+ s["tags"] = strings.Join(opts.Tags, ",")
+ }
return s, nil
}
@@ -197,12 +203,12 @@
s["parameters"] = opts.Parameters
}
- if opts.Timeout == 0 {
- return nil, errors.New("Required field 'Timeout' not provided.")
+ if opts.Timeout != 0 {
+ s["timeout"] = opts.Timeout
}
s["timeout_mins"] = opts.Timeout
- return map[string]interface{}{"stack": s}, nil
+ return s, nil
}
// Adopt accepts an AdoptOpts struct and creates a new stack using the resources
@@ -329,6 +335,8 @@
Parameters map[string]string
// (OPTIONAL) The timeout for stack creation in minutes.
Timeout int
+ // (OPTIONAL) A list of tags to assosciate with the Stack
+ Tags []string
}
// ToStackUpdateMap casts a CreateOpts struct to a map.
@@ -359,6 +367,10 @@
s["timeout_mins"] = opts.Timeout
}
+ if opts.Tags != nil {
+ s["tags"] = strings.Join(opts.Tags, ",")
+ }
+
return s, nil
}