containers

package
v0.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2015 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package containers contains functionality for working with Object Storage container resources. A container serves as a logical namespace for objects that are placed inside it - an object with the same name in two different containers represents two different objects.

In addition to containing objects, you can also use the container to control access to objects by using an access control list (ACL).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractNames

func ExtractNames(page pagination.Page) ([]string, error)

ExtractNames is a function that takes a ListResult and returns the containers' names.

func List

List is a function that retrieves containers associated with the account as well as account metadata. It returns a pager which can be iterated with the EachPage function.

Types

type Container

type Container struct {
	// The total number of bytes stored in the container.
	Bytes int `json:"bytes" mapstructure:"bytes"`

	// The total number of objects stored in the container.
	Count int `json:"count" mapstructure:"count"`

	// The name of the container.
	Name string `json:"name" mapstructure:"name"`
}

Container represents a container resource.

func ExtractInfo

func ExtractInfo(page pagination.Page) ([]Container, error)

ExtractInfo is a function that takes a ListResult and returns the containers' information.

type ContainerPage

type ContainerPage struct {
	pagination.MarkerPageBase
}

ContainerPage is the page returned by a pager when traversing over a collection of containers.

func (ContainerPage) IsEmpty

func (r ContainerPage) IsEmpty() (bool, error)

IsEmpty returns true if a ListResult contains no container names.

func (ContainerPage) LastMarker

func (r ContainerPage) LastMarker() (string, error)

LastMarker returns the last container name in a ListResult.

type CreateOpts

type CreateOpts struct {
	Metadata          map[string]string
	ContainerRead     string `h:"X-Container-Read"`
	ContainerSyncTo   string `h:"X-Container-Sync-To"`
	ContainerSyncKey  string `h:"X-Container-Sync-Key"`
	ContainerWrite    string `h:"X-Container-Write"`
	ContentType       string `h:"Content-Type"`
	DetectContentType bool   `h:"X-Detect-Content-Type"`
	IfNoneMatch       string `h:"If-None-Match"`
	VersionsLocation  string `h:"X-Versions-Location"`
}

CreateOpts is a structure that holds parameters for creating a container.

func (CreateOpts) ToContainerCreateMap

func (opts CreateOpts) ToContainerCreateMap() (map[string]string, error)

ToContainerCreateMap formats a CreateOpts into a map of headers.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToContainerCreateMap() (map[string]string, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

type CreateResult struct {
	gophercloud.HeaderResult
}

CreateResult represents the result of a create operation. To extract the the headers from the HTTP response, you can invoke the 'ExtractHeader' method on the result struct.

func Create

func Create(c *gophercloud.ServiceClient, containerName string, opts CreateOptsBuilder) CreateResult

Create is a function that creates a new container.

type DeleteResult

type DeleteResult struct {
	gophercloud.HeaderResult
}

DeleteResult represents the result of a delete operation. To extract the the headers from the HTTP response, you can invoke the 'ExtractHeader' method on the result struct.

func Delete

func Delete(c *gophercloud.ServiceClient, containerName string) DeleteResult

Delete is a function that deletes a container.

type GetResult

type GetResult struct {
	gophercloud.HeaderResult
}

GetResult represents the result of a get operation.

func Get

func Get(c *gophercloud.ServiceClient, containerName string) GetResult

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 (GetResult) ExtractMetadata

func (gr GetResult) ExtractMetadata() (map[string]string, error)

ExtractMetadata is a function that takes a GetResult (of type *http.Response) and returns the custom metadata associated with the container.

type ListOpts

type ListOpts struct {
	Full      bool
	Limit     int    `q:"limit"`
	Marker    string `q:"marker"`
	EndMarker string `q:"end_marker"`
	Format    string `q:"format"`
	Prefix    string `q:"prefix"`
	Delimiter string `q:"delimiter"`
}

ListOpts is a structure that holds options for listing containers.

func (ListOpts) ToContainerListParams

func (opts ListOpts) ToContainerListParams() (bool, string, error)

ToContainerListParams formats a ListOpts into a query string and boolean representing whether to list complete information for each container.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToContainerListParams() (bool, string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type UpdateOpts

type UpdateOpts struct {
	Metadata               map[string]string
	ContainerRead          string `h:"X-Container-Read"`
	ContainerSyncTo        string `h:"X-Container-Sync-To"`
	ContainerSyncKey       string `h:"X-Container-Sync-Key"`
	ContainerWrite         string `h:"X-Container-Write"`
	ContentType            string `h:"Content-Type"`
	DetectContentType      bool   `h:"X-Detect-Content-Type"`
	RemoveVersionsLocation string `h:"X-Remove-Versions-Location"`
	VersionsLocation       string `h:"X-Versions-Location"`
}

UpdateOpts is a structure that holds parameters for updating, creating, or deleting a container's metadata.

func (UpdateOpts) ToContainerUpdateMap

func (opts UpdateOpts) ToContainerUpdateMap() (map[string]string, error)

ToContainerUpdateMap formats a CreateOpts into a map of headers.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToContainerUpdateMap() (map[string]string, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

type UpdateResult struct {
	gophercloud.HeaderResult
}

UpdateResult represents the result of an update operation. To extract the the headers from the HTTP response, you can invoke the 'ExtractHeader' method on the result struct.

func Update

func Update(c *gophercloud.ServiceClient, containerName string, opts UpdateOptsBuilder) UpdateResult

Update is a function that creates, updates, or deletes a container's metadata.

Jump to

Keyboard shortcuts

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