objectstorage v1 and orchestration v1 struct tags
diff --git a/openstack/objectstorage/v1/containers/requests.go b/openstack/objectstorage/v1/containers/requests.go
index b2160c3..f575ea7 100644
--- a/openstack/objectstorage/v1/containers/requests.go
+++ b/openstack/objectstorage/v1/containers/requests.go
@@ -26,10 +26,7 @@
// representing whether to list complete information for each container.
func (opts ListOpts) ToContainerListParams() (bool, string, error) {
q, err := gophercloud.BuildQueryString(opts)
- if err != nil {
- return false, "", err
- }
- return opts.Full, q.String(), nil
+ return opts.Full, q.String(), err
}
// List is a function that retrieves containers associated with the account as
@@ -51,13 +48,11 @@
}
}
- createPage := func(r pagination.PageResult) pagination.Page {
+ pager := pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {
p := ContainerPage{pagination.MarkerPageBase{PageResult: r}}
p.MarkerPageBase.Owner = p
return p
- }
-
- pager := pagination.NewPager(c, url, createPage)
+ })
pager.Headers = headers
return pager
}
@@ -95,37 +90,34 @@
// Create is a function that creates a new container.
func Create(c *gophercloud.ServiceClient, containerName string, opts CreateOptsBuilder) CreateResult {
- var res CreateResult
- h := c.AuthenticatedHeaders()
-
+ var r CreateResult
+ h := make(map[string]string)
if opts != nil {
headers, err := opts.ToContainerCreateMap()
if err != nil {
- res.Err = err
- return res
+ r.Err = err
+ return r
}
-
for k, v := range headers {
h[k] = v
}
}
-
resp, err := c.Request("PUT", createURL(c, containerName), &gophercloud.RequestOpts{
MoreHeaders: h,
OkCodes: []int{201, 202, 204},
})
if resp != nil {
- res.Header = resp.Header
+ r.Header = resp.Header
}
- res.Err = err
- return res
+ r.Err = err
+ return r
}
// Delete is a function that deletes a container.
func Delete(c *gophercloud.ServiceClient, containerName string) DeleteResult {
- var res DeleteResult
- _, res.Err = c.Delete(deleteURL(c, containerName), nil)
- return res
+ var r DeleteResult
+ _, r.Err = c.Delete(deleteURL(c, containerName), nil)
+ return r
}
// UpdateOptsBuilder allows extensions to add additional parameters to the
@@ -163,43 +155,41 @@
// Update is a function that creates, updates, or deletes a container's
// metadata.
func Update(c *gophercloud.ServiceClient, containerName string, opts UpdateOptsBuilder) UpdateResult {
- var res UpdateResult
- h := c.AuthenticatedHeaders()
-
+ var r UpdateResult
+ h := make(map[string]string)
if opts != nil {
headers, err := opts.ToContainerUpdateMap()
if err != nil {
- res.Err = err
- return res
+ r.Err = err
+ return r
}
for k, v := range headers {
h[k] = v
}
}
-
resp, err := c.Request("POST", updateURL(c, containerName), &gophercloud.RequestOpts{
MoreHeaders: h,
OkCodes: []int{201, 202, 204},
})
if resp != nil {
- res.Header = resp.Header
+ r.Header = resp.Header
}
- res.Err = err
- return res
+ r.Err = err
+ return r
}
// Get is a function that retrieves the metadata of a container. To extract just
// the custom metadata, pass the GetResult response to the ExtractMetadata
// function.
func Get(c *gophercloud.ServiceClient, containerName string) GetResult {
- var res GetResult
+ var r GetResult
resp, err := c.Request("HEAD", getURL(c, containerName), &gophercloud.RequestOpts{
OkCodes: []int{200, 204},
})
if resp != nil {
- res.Header = resp.Header
+ r.Header = resp.Header
}
- res.Err = err
- return res
+ r.Err = err
+ return r
}