gophercloud: github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers Index | Files

package containers

import "github.com/rackspace/gophercloud/openstack/objectstorage/v1/containers"

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

Package Files

doc.go requests.go results.go urls.go

func ExtractInfo Uses

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

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

func ExtractNames Uses

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

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

func List Uses

func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

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.

type Container Uses

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.

type ContainerPage Uses

type ContainerPage struct {
    pagination.MarkerPageBase
}

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

func (ContainerPage) IsEmpty Uses

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

IsEmpty returns true if a ListResult contains no container names.

func (ContainerPage) LastMarker Uses

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

LastMarker returns the last container name in a ListResult.

type CreateHeader Uses

type CreateHeader struct {
    ContentLength int64     `mapstructure:"Content-Length"`
    ContentType   string    `mapstructure:"Content-Type"`
    Date          time.Time `mapstructure:"-"`
    TransID       string    `mapstructure:"X-Trans-Id"`
}

CreateHeader represents the headers returned in the response from a Create request.

type CreateOpts Uses

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 Uses

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

ToContainerCreateMap formats a CreateOpts into a map of headers.

type CreateOptsBuilder Uses

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

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

type CreateResult Uses

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 Uses

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

Create is a function that creates a new container.

func (CreateResult) Extract Uses

func (cr CreateResult) Extract() (CreateHeader, error)

Extract will return a struct of headers returned from a call to Create. To obtain a map of headers, call the ExtractHeader method on the CreateResult.

type DeleteHeader Uses

type DeleteHeader struct {
    ContentLength int64     `mapstructure:"Content-Length"`
    ContentType   string    `mapstructure:"Content-Type"`
    Date          time.Time `mapstructure:"-"`
    TransID       string    `mapstructure:"X-Trans-Id"`
}

DeleteHeader represents the headers returned in the response from a Delete request.

type DeleteResult Uses

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 Uses

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

Delete is a function that deletes a container.

func (DeleteResult) Extract Uses

func (dr DeleteResult) Extract() (DeleteHeader, error)

Extract will return a struct of headers returned from a call to Delete. To obtain a map of headers, call the ExtractHeader method on the DeleteResult.

type GetHeader Uses

type GetHeader struct {
    AcceptRanges     string    `mapstructure:"Accept-Ranges"`
    BytesUsed        int64     `mapstructure:"X-Account-Bytes-Used"`
    ContentLength    int64     `mapstructure:"Content-Length"`
    ContentType      string    `mapstructure:"Content-Type"`
    Date             time.Time `mapstructure:"-"`
    ObjectCount      int64     `mapstructure:"X-Container-Object-Count"`
    Read             string    `mapstructure:"X-Container-Read"`
    TransID          string    `mapstructure:"X-Trans-Id"`
    VersionsLocation string    `mapstructure:"X-Versions-Location"`
    Write            string    `mapstructure:"X-Container-Write"`
}

GetHeader represents the headers returned in the response from a Get request.

type GetResult Uses

type GetResult struct {
    gophercloud.HeaderResult
}

GetResult represents the result of a get operation.

func Get Uses

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) Extract Uses

func (gr GetResult) Extract() (GetHeader, error)

Extract will return a struct of headers returned from a call to Get. To obtain a map of headers, call the ExtractHeader method on the GetResult.

func (GetResult) ExtractMetadata Uses

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 Uses

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 Uses

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 Uses

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

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

type UpdateHeader Uses

type UpdateHeader struct {
    ContentLength int64     `mapstructure:"Content-Length"`
    ContentType   string    `mapstructure:"Content-Type"`
    Date          time.Time `mapstructure:"-"`
    TransID       string    `mapstructure:"X-Trans-Id"`
}

UpdateHeader represents the headers returned in the response from a Update request.

type UpdateOpts Uses

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 Uses

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

ToContainerUpdateMap formats a CreateOpts into a map of headers.

type UpdateOptsBuilder Uses

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

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

type UpdateResult Uses

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 Uses

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

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

func (UpdateResult) Extract Uses

func (ur UpdateResult) Extract() (UpdateHeader, error)

Extract will return a struct of headers returned from a call to Update. To obtain a map of headers, call the ExtractHeader method on the UpdateResult.

Package containers imports 6 packages (graph) and is imported by 85 packages. Updated 2016-08-03. Refresh now. Tools for package owners.