Don't paginate autoscale webhook create results
diff --git a/rackspace/autoscale/v1/webhooks/requests.go b/rackspace/autoscale/v1/webhooks/requests.go
index 2a07357..bfdb01a 100644
--- a/rackspace/autoscale/v1/webhooks/requests.go
+++ b/rackspace/autoscale/v1/webhooks/requests.go
@@ -78,15 +78,9 @@
return res
}
- resp, err := client.Post(createURL(client, groupID, policyID), reqBody, &res.Body, nil)
+ _, res.Err = client.Post(createURL(client, groupID, policyID), reqBody, &res.Body, nil)
- if err != nil {
- res.Err = err
- return res
- }
-
- pr := pagination.PageResultFromParsed(resp, res.Body)
- return CreateResult{pagination.SinglePageBase(pr)}
+ return res
}
// Get requests the details of a single webhook with the given ID.
diff --git a/rackspace/autoscale/v1/webhooks/requests_test.go b/rackspace/autoscale/v1/webhooks/requests_test.go
index 0eed1c2..925c29e 100644
--- a/rackspace/autoscale/v1/webhooks/requests_test.go
+++ b/rackspace/autoscale/v1/webhooks/requests_test.go
@@ -67,7 +67,7 @@
},
}
- webhooks, err := Create(client, groupID, policyID, opts).ExtractWebhooks()
+ webhooks, err := Create(client, groupID, policyID, opts).Extract()
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, FirstWebhook, webhooks[0])
diff --git a/rackspace/autoscale/v1/webhooks/results.go b/rackspace/autoscale/v1/webhooks/results.go
index 2774dd3..ac64d56 100644
--- a/rackspace/autoscale/v1/webhooks/results.go
+++ b/rackspace/autoscale/v1/webhooks/results.go
@@ -26,16 +26,15 @@
return &response.Webhook, err
}
-// CreateResult represents the result of a create operation. Multiple webhooks
-// can be created in a single call, so the result should be treated as a typical
-// pagination Page. ExtractWebhooks() can be used to extract a slice of
-// Webhooks from a single page.
+// CreateResult represents the result of a create operation.
type CreateResult struct {
- pagination.SinglePageBase
+ webhookResult
}
-// ExtractWebhooks extracts a slice of Webhooks from a CreateResult.
-func (res CreateResult) ExtractWebhooks() ([]Webhook, error) {
+// Extract extracts a slice of Webhooks from a CreateResult. Multiple webhooks
+// can be created in a single operation, so the result of a create is always a
+// list of webhooks.
+func (res CreateResult) Extract() ([]Webhook, error) {
if res.Err != nil {
return nil, res.Err
}