openstack abandon stack op and unit test
diff --git a/openstack/orchestration/v1/stacks/results.go b/openstack/orchestration/v1/stacks/results.go
index b648fb2..84d6f9e 100644
--- a/openstack/orchestration/v1/stacks/results.go
+++ b/openstack/orchestration/v1/stacks/results.go
@@ -253,9 +253,33 @@
return res.Stack, err
}
+// AbandonedStack represents the result of an Abandon operation.
type AbandonedStack struct {
+ Status string `mapstructure:"status"`
+ Name string `mapstructure:"name"`
+ Template string `mapstructure:"template"`
+ Action string `mapstructure:"action"`
+ ID string `mapstructure:"id"`
+ Resources map[string]interface{} `mapstructure:"resources"`
}
+// AbandonResult represents the result of an Abandon operation.
type AbandonResult struct {
gophercloud.Result
}
+
+// Extract returns a pointer to an AbandonedStack object and is called after an
+// Abandon operation.
+func (r AbandonResult) Extract() (*AbandonedStack, error) {
+ if r.Err != nil {
+ return nil, r.Err
+ }
+
+ var res AbandonedStack
+
+ if err := mapstructure.Decode(r.Body, &res); err != nil {
+ return nil, err
+ }
+
+ return &res, nil
+}