named return vars
diff --git a/openstack/cdn/v1/base/requests.go b/openstack/cdn/v1/base/requests.go
index 15f8346..99e7309 100644
--- a/openstack/cdn/v1/base/requests.go
+++ b/openstack/cdn/v1/base/requests.go
@@ -4,18 +4,14 @@
// Get retrieves the home document, allowing the user to discover the
// entire API.
-func Get(c *gophercloud.ServiceClient) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient) (r GetResult) {
_, r.Err = c.Get(getURL(c), &r.Body, nil)
- return r
}
// Ping retrieves a ping to the server.
-func Ping(c *gophercloud.ServiceClient) PingResult {
- var r PingResult
+func Ping(c *gophercloud.ServiceClient) (r PingResult) {
_, r.Err = c.Get(pingURL(c), nil, &gophercloud.RequestOpts{
OkCodes: []int{204},
MoreHeaders: map[string]string{"Accept": ""},
})
- return r
}
diff --git a/openstack/cdn/v1/flavors/requests.go b/openstack/cdn/v1/flavors/requests.go
index d42d1d7..fc05528 100644
--- a/openstack/cdn/v1/flavors/requests.go
+++ b/openstack/cdn/v1/flavors/requests.go
@@ -13,8 +13,6 @@
}
// Get retrieves a specific flavor based on its unique ID.
-func Get(c *gophercloud.ServiceClient, id string) GetResult {
- var r GetResult
+func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = c.Get(getURL(c, id), &r.Body, nil)
- return r
}
diff --git a/openstack/cdn/v1/serviceassets/requests.go b/openstack/cdn/v1/serviceassets/requests.go
index 3d0543e..e78508d 100644
--- a/openstack/cdn/v1/serviceassets/requests.go
+++ b/openstack/cdn/v1/serviceassets/requests.go
@@ -31,22 +31,20 @@
// it. For example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
-func Delete(c *gophercloud.ServiceClient, idOrURL string, opts DeleteOptsBuilder) DeleteResult {
+func Delete(c *gophercloud.ServiceClient, idOrURL string, opts DeleteOptsBuilder) (r DeleteResult) {
var url string
if strings.Contains(idOrURL, "/") {
url = idOrURL
} else {
url = deleteURL(c, idOrURL)
}
- var r DeleteResult
if opts != nil {
q, err := opts.ToCDNAssetDeleteParams()
if err != nil {
r.Err = err
- return r
+ return
}
url += q
}
_, r.Err = c.Delete(url, nil)
- return r
}
diff --git a/openstack/cdn/v1/services/requests.go b/openstack/cdn/v1/services/requests.go
index 9a0f54b..c0329d6 100644
--- a/openstack/cdn/v1/services/requests.go
+++ b/openstack/cdn/v1/services/requests.go
@@ -77,49 +77,34 @@
// ToCDNServiceCreateMap casts a CreateOpts struct to a map.
func (opts CreateOpts) ToCDNServiceCreateMap() (map[string]interface{}, error) {
-
- /*
- for _, origin := range opts.Origins {
- if origin.Rules == nil && len(opts.Origins) > 1 {
- return nil, no("Origins[].Rules")
- }
- }
- */
-
return gophercloud.BuildRequestBody(opts, "")
}
// Create accepts a CreateOpts struct and creates a new CDN service using the
// values provided.
-func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
- var r CreateResult
+func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToCDNServiceCreateMap()
if err != nil {
r.Err = err
return r
}
- // Send request to API
resp, err := c.Post(createURL(c), &b, nil, nil)
r.Header = resp.Header
r.Err = err
- return r
}
// Get retrieves a specific service based on its URL or its unique ID. For
// example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
-func Get(c *gophercloud.ServiceClient, idOrURL string) GetResult {
+func Get(c *gophercloud.ServiceClient, idOrURL string) (r GetResult) {
var url string
if strings.Contains(idOrURL, "/") {
url = idOrURL
} else {
url = getURL(c, idOrURL)
}
-
- var r GetResult
_, r.Err = c.Get(url, &r.Body, nil)
- return r
}
// Path is a JSON pointer location that indicates which service parameter is being added, replaced,
@@ -260,7 +245,7 @@
// URL or its ID. For example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
-func Update(c *gophercloud.ServiceClient, idOrURL string, opts UpdateOpts) UpdateResult {
+func Update(c *gophercloud.ServiceClient, idOrURL string, opts UpdateOpts) (r UpdateResult) {
var url string
if strings.Contains(idOrURL, "/") {
url = idOrURL
@@ -277,25 +262,20 @@
JSONBody: &b,
OkCodes: []int{202},
})
- var r UpdateResult
r.Header = resp.Header
r.Err = err
- return r
}
// Delete accepts a service's ID or its URL and deletes the CDN service
// associated with it. For example, both "96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0" and
// "https://global.cdn.api.rackspacecloud.com/v1.0/services/96737ae3-cfc1-4c72-be88-5d0e7cc9a3f0"
// are valid options for idOrURL.
-func Delete(c *gophercloud.ServiceClient, idOrURL string) DeleteResult {
+func Delete(c *gophercloud.ServiceClient, idOrURL string) (r DeleteResult) {
var url string
if strings.Contains(idOrURL, "/") {
url = idOrURL
} else {
url = deleteURL(c, idOrURL)
}
-
- var r DeleteResult
_, r.Err = c.Delete(url, nil)
- return r
}