objectstorage v1 and orchestration v1 struct tags
diff --git a/openstack/orchestration/v1/stackresources/requests.go b/openstack/orchestration/v1/stackresources/requests.go
index 3ce40eb..f33c170 100644
--- a/openstack/orchestration/v1/stackresources/requests.go
+++ b/openstack/orchestration/v1/stackresources/requests.go
@@ -7,13 +7,9 @@
// Find retrieves stack resources for the given stack name.
func Find(c *gophercloud.ServiceClient, stackName string) FindResult {
- var res FindResult
-
- // Send request to API
- _, res.Err = c.Request("GET", findURL(c, stackName), &gophercloud.RequestOpts{
- JSONResponse: &res.Body,
- })
- return res
+ var r FindResult
+ _, res.Err = c.Get(findURL(c, stackName), &res.Body, nil)
+ return r
}
// ListOptsBuilder allows extensions to add additional parameters to the
@@ -32,16 +28,12 @@
// ToStackResourceListQuery formats a ListOpts into a query string.
func (opts ListOpts) ToStackResourceListQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
- if err != nil {
- return "", err
- }
- return q.String(), nil
+ return q.String(), err
}
// List makes a request against the API to list resources for the given stack.
func List(client *gophercloud.ServiceClient, stackName, stackID string, opts ListOptsBuilder) pagination.Pager {
url := listURL(client, stackName, stackID)
-
if opts != nil {
query, err := opts.ToStackResourceListQuery()
if err != nil {
@@ -49,65 +41,42 @@
}
url += query
}
-
- createPageFn := func(r pagination.PageResult) pagination.Page {
+ return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {
return ResourcePage{pagination.SinglePageBase(r)}
- }
-
- return pagination.NewPager(client, url, createPageFn)
+ })
}
// Get retreives data for the given stack resource.
func Get(c *gophercloud.ServiceClient, stackName, stackID, resourceName string) GetResult {
- var res GetResult
-
- // Send request to API
- _, res.Err = c.Get(getURL(c, stackName, stackID, resourceName), &res.Body, &gophercloud.RequestOpts{
- OkCodes: []int{200},
- })
- return res
+ var r GetResult
+ _, r.Err = c.Get(getURL(c, stackName, stackID, resourceName), &r.Body, nil)
+ return r
}
// Metadata retreives the metadata for the given stack resource.
func Metadata(c *gophercloud.ServiceClient, stackName, stackID, resourceName string) MetadataResult {
- var res MetadataResult
-
- // Send request to API
- _, res.Err = c.Get(metadataURL(c, stackName, stackID, resourceName), &res.Body, &gophercloud.RequestOpts{
- OkCodes: []int{200},
- })
- return res
+ var r MetadataResult
+ _, r.Err = c.Get(metadataURL(c, stackName, stackID, resourceName), &r.Body, nil)
+ return r
}
// ListTypes makes a request against the API to list resource types.
func ListTypes(client *gophercloud.ServiceClient) pagination.Pager {
- url := listTypesURL(client)
-
- createPageFn := func(r pagination.PageResult) pagination.Page {
+ return pagination.NewPager(client, listTypesURL(client), func(r pagination.PageResult) pagination.Page {
return ResourceTypePage{pagination.SinglePageBase(r)}
- }
-
- return pagination.NewPager(client, url, createPageFn)
+ })
}
// Schema retreives the schema for the given resource type.
func Schema(c *gophercloud.ServiceClient, resourceType string) SchemaResult {
- var res SchemaResult
-
- // Send request to API
- _, res.Err = c.Get(schemaURL(c, resourceType), &res.Body, &gophercloud.RequestOpts{
- OkCodes: []int{200},
- })
- return res
+ var r SchemaResult
+ _, r.Err = c.Get(schemaURL(c, resourceType), &r.Body, nil)
+ return r
}
// Template retreives the template representation for the given resource type.
func Template(c *gophercloud.ServiceClient, resourceType string) TemplateResult {
- var res TemplateResult
-
- // Send request to API
- _, res.Err = c.Get(templateURL(c, resourceType), &res.Body, &gophercloud.RequestOpts{
- OkCodes: []int{200},
- })
- return res
+ var r TemplateResult
+ _, r.Err = c.Get(templateURL(c, resourceType), &r.Body, nil)
+ return r
}