swift

package
v1.0.0-...-3228e4f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2017 License: LGPL-3.0 Imports: 10 Imported by: 8

Documentation

Index

Constants

View Source
const (
	Private    = ACL("")
	PublicRead = ACL(".r:*,.rlistings")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides a means to access the OpenStack Object Storage Service.

func New

func New(client client.Client) *Client

New creates a new Client.

func (*Client) CreateContainer

func (c *Client) CreateContainer(containerName string, acl ACL) error

CreateContainer creates a container with the given name.

func (*Client) DeleteContainer

func (c *Client) DeleteContainer(containerName string) error

DeleteContainer deletes the specified container.

func (*Client) DeleteObject

func (c *Client) DeleteObject(containerName, objectName string) error

DeleteObject removes an object from the storage system permanently.

func (*Client) GetObject

func (c *Client) GetObject(containerName, objectName string) (obj []byte, err error)

GetObject retrieves the specified object's data.

func (*Client) GetReader

func (c *Client) GetReader(containerName, objectName string) (io.ReadCloser, http.Header, error)

GetObject retrieves the specified object's data.

func (*Client) HeadObject

func (c *Client) HeadObject(containerName, objectName string) (http.Header, error)

HeadObject retrieves object metadata and other standard HTTP headers.

func (*Client) List

func (c *Client) List(containerName, prefix, delim, marker string, limit int) (contents []ContainerContents, err error)

GetObject retrieves the specified object's data.

func (*Client) PutObject

func (c *Client) PutObject(containerName, objectName string, data []byte) error

PutObject writes, or overwrites, an object's content and metadata.

func (*Client) PutReader

func (c *Client) PutReader(containerName, objectName string, r io.Reader, length int64) error

PutReader writes, or overwrites, an object's content and metadata.

func (*Client) SignedURL

func (c *Client) SignedURL(containerName, file string, expires time.Time) (string, error)

SignedURL returns a signed URL that allows anyone holding the URL to retrieve the object at path. The signature is valid until expires.

func (*Client) URL

func (c *Client) URL(containerName, file string) (string, error)

URL returns a non-signed URL that allows retrieving the object at path. It only works if the object is publicly readable (see SignedURL).

type ContainerContents

type ContainerContents struct {
	Name         string `json:"name"`
	Hash         string `json:"hash"`
	LengthBytes  int    `json:"bytes"`
	ContentType  string `json:"content_type"`
	LastModified string `json:"last_modified"`
}

ContainerContents describes a single container and its contents.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL