comment types; remove ok codes
diff --git a/openstack/storage/v1/accounts/accounts.go b/openstack/storage/v1/accounts/accounts.go
index ae8ba19..c460e45 100644
--- a/openstack/storage/v1/accounts/accounts.go
+++ b/openstack/storage/v1/accounts/accounts.go
@@ -4,11 +4,14 @@
"strings"
)
+// UpdateOpts is a structure that contains parameters for updating, creating, or deleting an
+// account's metadata.
type UpdateOpts struct {
Metadata map[string]string
Headers map[string]string
}
+// GetOpts is a structure that contains parameters for getting an account's metadata.
type GetOpts struct {
Headers map[string]string
}
diff --git a/openstack/storage/v1/accounts/requests.go b/openstack/storage/v1/accounts/requests.go
index d5afbcd..7b84497 100644
--- a/openstack/storage/v1/accounts/requests.go
+++ b/openstack/storage/v1/accounts/requests.go
@@ -6,6 +6,7 @@
"net/http"
)
+// GetResult is a *http.Response that is returned from a call to the Get function.
type GetResult *http.Response
// Update is a function that creates, updates, or deletes an account's metadata.
@@ -25,7 +26,6 @@
url := c.GetAccountURL()
_, err = perigee.Request("POST", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{204},
})
return err
}
@@ -45,7 +45,6 @@
url := c.GetAccountURL()
resp, err := perigee.Request("HEAD", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{204},
})
return &resp.HttpResponse, err
}
diff --git a/openstack/storage/v1/client.go b/openstack/storage/v1/client.go
index f19ba4e..f616038 100644
--- a/openstack/storage/v1/client.go
+++ b/openstack/storage/v1/client.go
@@ -13,6 +13,7 @@
token *identity.Token
}
+// NewClient creates and returns a *Client.
func NewClient(e string, a identity.AuthResults, o identity.AuthOptions) *Client {
return &Client{
endpoint: e,
@@ -21,19 +22,26 @@
}
}
+// GetAccountURL returns the URI for making Account requests. This function is exported to allow
+// the 'Accounts' subpackage to use it. It is not meant for public consumption.
func (c *Client) GetAccountURL() string {
return fmt.Sprintf("%s", c.endpoint)
}
+// GetContainerURL returns the URI for making Container requests. This function is exported to allow
+// the 'Containers' subpackage to use it. It is not meant for public consumption.
func (c *Client) GetContainerURL(container string) string {
return fmt.Sprintf("%s/%s", c.endpoint, container)
}
+// GetObjectURL returns the URI for making Object requests. This function is exported to allow
+// the 'Objects' subpackage to use it. It is not meant for public consumption.
func (c *Client) GetObjectURL(container, object string) string {
return fmt.Sprintf("%s/%s/%s", c.endpoint, container, object)
}
-// GetHeaders is a function that sets the header for token authentication against a client's endpoint.
+// GetHeaders is a function that gets the header for token authentication against a client's endpoint.
+// This function is exported to allow the subpackages to use it. It is not meant for public consumption.
func (c *Client) GetHeaders() (map[string]string, error) {
t, err := c.getAuthToken()
if err != nil {
diff --git a/openstack/storage/v1/containers/containers.go b/openstack/storage/v1/containers/containers.go
index 2a5efe1..3a00647 100644
--- a/openstack/storage/v1/containers/containers.go
+++ b/openstack/storage/v1/containers/containers.go
@@ -6,30 +6,37 @@
"strings"
)
+// Container is a structure that holds information related to a storage container.
type Container map[string]interface{}
+// ListOpts is a structure that holds parameters for listing containers.
type ListOpts struct {
Full bool
Params map[string]string
}
+// CreateOpts is a structure that holds parameters for creating a container.
type CreateOpts struct {
Name string
Metadata map[string]string
Headers map[string]string
}
+// DeleteOpts is a structure that holds parameters for deleting a container.
type DeleteOpts struct {
Name string
Params map[string]string
}
+// UpdateOpts is a structure that holds parameters for updating, creating, or deleting a
+// container's metadata.
type UpdateOpts struct {
Name string
Metadata map[string]string
Headers map[string]string
}
+// GetOpts is a structure that holds parameters for getting a container's metadata.
type GetOpts struct {
Name string
Metadata map[string]string
diff --git a/openstack/storage/v1/containers/requests.go b/openstack/storage/v1/containers/requests.go
index df7cc30..b6d3a89 100644
--- a/openstack/storage/v1/containers/requests.go
+++ b/openstack/storage/v1/containers/requests.go
@@ -7,7 +7,10 @@
"net/http"
)
+// ListResult is a *http.Response that is returned from a call to the List function.
type ListResult *http.Response
+
+// GetResult is a *http.Response that is returned from a call to the Get function.
type GetResult *http.Response
// List is a function that retrieves all objects in a container. It also returns the details
@@ -30,7 +33,6 @@
url := c.GetAccountURL() + query
resp, err := perigee.Request("GET", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{200, 204},
Accept: contentType,
})
return &resp.HttpResponse, err
@@ -56,7 +58,6 @@
url := c.GetContainerURL(opts.Name)
_, err = perigee.Request("PUT", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{201, 204},
})
if err == nil {
ci = Container{
@@ -78,7 +79,6 @@
url := c.GetContainerURL(opts.Name) + query
_, err = perigee.Request("DELETE", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{204},
})
return err
}
@@ -101,7 +101,6 @@
url := c.GetContainerURL(opts.Name)
_, err = perigee.Request("POST", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{204},
})
return err
}
@@ -121,7 +120,6 @@
url := c.GetContainerURL(opts.Name)
resp, err := perigee.Request("HEAD", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{204},
})
return &resp.HttpResponse, err
}
diff --git a/openstack/storage/v1/objects/objects.go b/openstack/storage/v1/objects/objects.go
index 9575e0f..ab390fa 100644
--- a/openstack/storage/v1/objects/objects.go
+++ b/openstack/storage/v1/objects/objects.go
@@ -7,14 +7,17 @@
"strings"
)
+// Object is a structure that holds information related to a storage object.
type Object map[string]interface{}
+// ListOpts is a structure that holds parameters for listing objects.
type ListOpts struct {
Container string
Full bool
Params map[string]string
}
+// DownloadOpts is a structure that holds parameters for downloading an object.
type DownloadOpts struct {
Container string
Name string
@@ -22,6 +25,7 @@
Params map[string]string
}
+// CreateOpts is a structure that holds parameters for creating an object.
type CreateOpts struct {
Container string
Name string
@@ -31,6 +35,7 @@
Params map[string]string
}
+// CopyOpts is a structure that holds parameters for copying one object to another.
type CopyOpts struct {
Container string
Name string
@@ -40,12 +45,14 @@
Headers map[string]string
}
+// DeleteOpts is a structure that holds parameters for deleting an object.
type DeleteOpts struct {
Container string
Name string
Params map[string]string
}
+// GetOpts is a structure that holds parameters for getting an object's metadata.
type GetOpts struct {
Container string
Name string
@@ -53,6 +60,8 @@
Params map[string]string
}
+// UpdateOpts is a structure that holds parameters for updating, creating, or deleting an
+// object's metadata.
type UpdateOpts struct {
Container string
Name string
diff --git a/openstack/storage/v1/objects/requests.go b/openstack/storage/v1/objects/requests.go
index 615a59d..a7dff40 100644
--- a/openstack/storage/v1/objects/requests.go
+++ b/openstack/storage/v1/objects/requests.go
@@ -8,8 +8,13 @@
"net/http"
)
+// ListResult is a *http.Response that is returned from a call to the List function.
type ListResult *http.Response
+
+// DownloadResult is a *http.Response that is returned from a call to the Download function.
type DownloadResult *http.Response
+
+// GetResult is a *http.Response that is returned from a call to the Get function.
type GetResult *http.Response
// List is a function that retrieves all objects in a container. It also returns the details
@@ -32,7 +37,6 @@
url := c.GetContainerURL(opts.Container) + query
resp, err := perigee.Request("GET", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{200, 204},
Accept: contentType,
})
return &resp.HttpResponse, err
@@ -56,7 +60,6 @@
url := c.GetObjectURL(opts.Container, opts.Name) + query
resp, err := perigee.Request("GET", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{200},
})
return &resp.HttpResponse, err
}
@@ -93,7 +96,6 @@
_, err = perigee.Request("PUT", url, perigee.Options{
ReqBody: reqBody,
MoreHeaders: h,
- OkCodes: []int{201},
})
return err
}
@@ -114,7 +116,6 @@
url := c.GetObjectURL(opts.Container, opts.Name)
_, err = perigee.Request("COPY", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{201},
})
return err
}
@@ -131,7 +132,6 @@
url := c.GetObjectURL(opts.Container, opts.Name) + query
_, err = perigee.Request("DELETE", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{204},
})
return err
}
@@ -151,7 +151,6 @@
url := c.GetObjectURL(opts.Container, opts.Name)
resp, err := perigee.Request("HEAD", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{204},
})
return &resp.HttpResponse, err
}
@@ -174,7 +173,6 @@
url := c.GetObjectURL(opts.Container, opts.Name)
_, err = perigee.Request("POST", url, perigee.Options{
MoreHeaders: h,
- OkCodes: []int{202, 204},
})
return err
}