Rackspace Auto Scale: Add policies Get()
diff --git a/rackspace/autoscale/v1/policies/results.go b/rackspace/autoscale/v1/policies/results.go
index e50ea78..e92d636 100644
--- a/rackspace/autoscale/v1/policies/results.go
+++ b/rackspace/autoscale/v1/policies/results.go
@@ -11,6 +11,21 @@
gophercloud.Result
}
+// Extract interprets any policyResult as a Policy, if possible.
+func (r policyResult) Extract() (*Policy, error) {
+ if r.Err != nil {
+ return nil, r.Err
+ }
+
+ var response struct {
+ Policy Policy `mapstructure:"policy"`
+ }
+
+ err := mapstructure.Decode(r.Body, &response)
+
+ return &response.Policy, err
+}
+
// CreateResult represents the result of a create operation.
type CreateResult struct {
policyResult
@@ -27,6 +42,11 @@
return commonExtractPolicies(res.Body)
}
+// GetResult temporarily contains the response from a Get call.
+type GetResult struct {
+ policyResult
+}
+
// Policy represents a scaling policy.
type Policy struct {
// UUID for the policy.