Documentation
¶
Overview ¶
Package cdmi provides a client to perform the core container and object operations defined in the Cloud Data Management Interface specification.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) CreateContainer(containerPath string, parents bool) error
- func (c *Client) CreateObject(objectPath string, data io.Reader, createContainer bool) error
- func (c *Client) DeleteContainer(containerPath string) error
- func (c *Client) DeleteObject(objectPath string) error
- func (c *Client) GetObject(objectPath string) (io.ReadCloser, error)
- func (c *Client) ReadContainer(containerPath string) ([]string, error)
Constants ¶
const ( // Version default CDMI version used. Version = "1.1.1" // VersionHeader CDMI version header key. VersionHeader = "X-CDMI-Specification-Version" // ObjectHeader HTTP header for CDMI objects. ObjectHeader = "application/cdmi-object" // ContainerHeader HTTP header for CDMI containers. ContainerHeader = "application/cdmi-container" )
Variables ¶
var ( // ErrBadRequest error thrown when request contains invalid parameters or field names (HTTP status code 400). ErrBadRequest = errors.New("The request contains invalid parameters or field names") ErrUnauthorized = errors.New("The authentication credentials are missing or invalid") // ErrForbidden error thrown when client lacks the proper authorization to perform this request (HTTP status code 403). ErrForbidden = errors.New("The client lacks the proper authorization to perform this request") // ErrNotFound error thrown when resource was not found at the specified URI (HTTP status code 404). ErrNotFound = errors.New("The resource was not found at the specified URI") // ErrNotAcceptable error thrown when server is unable to provide the object in the content type specified in the Accept header (HTTP status code 406). ErrNotAcceptable = errors.New("The server is unable to provide the object in the content type specified in the Accept header") // ErrConflict error thrown when operation conflicts with a non-CDMI access protocol lock or has caused a state transition error on the server (HTTP status code 409). ErrConflict = errors.New("The operation conflicts with a non-CDMI access protocol lock or has caused a state transition error on the server") // ErrInternalServer error thrown when server fails (HTTP status code 500). ErrInternalServer = errors.New("Internal server error") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client represents a CDMI client.
func New ¶
New creates a new CDMI client. If the CDMI server doesn't implement auth, token must be an empty string.
func (*Client) CreateContainer ¶
CreateContainer creates a new container on the specified path. If parents is set to true, it creates the required parent directories.
func (*Client) CreateObject ¶
CreateObject creates a new object with the io.Reader data in the specified path. If createContainer is set to true it creates all required parent directories.
func (*Client) DeleteContainer ¶
DeleteContainer deletes a container including all its children.
func (*Client) DeleteObject ¶
DeleteObject deletes the specified object.