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

package objects

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

Package objects contains functionality for working with Object Storage object resources. An object is a resource that represents and contains data - such as documents, images, and so on. You can also store custom metadata with an object.

Index

Package Files

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

func CreateTempURL Uses

func CreateTempURL(c *gophercloud.ServiceClient, containerName, objectName string, opts CreateTempURLOpts) (string, error)

CreateTempURL is a function for creating a temporary URL for an object. It allows users to have "GET" or "POST" access to a particular tenant's object for a limited amount of time.

func ExtractInfo Uses

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

ExtractInfo is a function that takes a page of objects and returns their full information.

func ExtractNames Uses

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

ExtractNames is a function that takes a page of objects and returns only their names.

func List Uses

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

List is a function that retrieves all objects in a container. It also returns the details for the container. To extract only the object information or names, pass the ListResult response to the ExtractInfo or ExtractNames function, respectively.

type CopyHeader Uses

type CopyHeader struct {
    ContentLength          int64     `mapstructure:"Content-Length"`
    ContentType            string    `mapstructure:"Content-Type"`
    CopiedFrom             string    `mapstructure:"X-Copied-From"`
    CopiedFromLastModified time.Time `mapstructure:"-"`
    Date                   time.Time `mapstructure:"-"`
    ETag                   string    `mapstructure:"Etag"`
    LastModified           time.Time `mapstructure:"-"`
    TransID                string    `mapstructure:"X-Trans-Id"`
}

CopyHeader represents the headers returned in the response from a Copy request.

type CopyOpts Uses

type CopyOpts struct {
    Metadata           map[string]string
    ContentDisposition string `h:"Content-Disposition"`
    ContentEncoding    string `h:"Content-Encoding"`
    ContentType        string `h:"Content-Type"`
    Destination        string `h:"Destination,required"`
}

CopyOpts is a structure that holds parameters for copying one object to another.

func (CopyOpts) ToObjectCopyMap Uses

func (opts CopyOpts) ToObjectCopyMap() (map[string]string, error)

ToObjectCopyMap formats a CopyOpts into a map of headers.

type CopyOptsBuilder Uses

type CopyOptsBuilder interface {
    ToObjectCopyMap() (map[string]string, error)
}

CopyOptsBuilder allows extensions to add additional parameters to the Copy request.

type CopyResult Uses

type CopyResult struct {
    gophercloud.HeaderResult
}

CopyResult represents the result of a copy operation.

func Copy Uses

func Copy(c *gophercloud.ServiceClient, containerName, objectName string, opts CopyOptsBuilder) CopyResult

Copy is a function that copies one object to another.

func (CopyResult) Extract Uses

func (cr CopyResult) Extract() (CopyHeader, error)

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

type CreateHeader Uses

type CreateHeader struct {
    ContentLength int64     `mapstructure:"Content-Length"`
    ContentType   string    `mapstructure:"Content-Type"`
    Date          time.Time `mapstructure:"-"`
    ETag          string    `mapstructure:"Etag"`
    LastModified  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
    CacheControl       string `h:"Cache-Control"`
    ContentDisposition string `h:"Content-Disposition"`
    ContentEncoding    string `h:"Content-Encoding"`
    ContentLength      int64  `h:"Content-Length"`
    ContentType        string `h:"Content-Type"`
    CopyFrom           string `h:"X-Copy-From"`
    DeleteAfter        int    `h:"X-Delete-After"`
    DeleteAt           int    `h:"X-Delete-At"`
    DetectContentType  string `h:"X-Detect-Content-Type"`
    ETag               string `h:"ETag"`
    IfNoneMatch        string `h:"If-None-Match"`
    ObjectManifest     string `h:"X-Object-Manifest"`
    TransferEncoding   string `h:"Transfer-Encoding"`
    Expires            string `q:"expires"`
    MultipartManifest  string `q:"multipart-manifest"`
    Signature          string `q:"signature"`
}

CreateOpts is a structure that holds parameters for creating an object.

func (CreateOpts) ToObjectCreateParams Uses

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

ToObjectCreateParams formats a CreateOpts into a query string and map of headers.

type CreateOptsBuilder Uses

type CreateOptsBuilder interface {
    ToObjectCreateParams() (map[string]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.

func Create Uses

func Create(c *gophercloud.ServiceClient, containerName, objectName string, content io.ReadSeeker, opts CreateOptsBuilder) CreateResult

Create is a function that creates a new object or replaces an existing object. If the returned response's ETag header fails to match the local checksum, the failed request will automatically be retried up to a maximum of 3 times.

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 CreateTempURLOpts Uses

type CreateTempURLOpts struct {
    // (REQUIRED) Method is the HTTP method to allow for users of the temp URL. Valid values
    // are "GET" and "POST".
    Method HTTPMethod
    // (REQUIRED) TTL is the number of seconds the temp URL should be active.
    TTL int
    // (Optional) Split is the string on which to split the object URL. Since only
    // the object path is used in the hash, the object URL needs to be parsed. If
    // empty, the default OpenStack URL split point will be used ("/v1/").
    Split string
}

CreateTempURLOpts are options for creating a temporary URL for an object.

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 DeleteOpts Uses

type DeleteOpts struct {
    MultipartManifest string `q:"multipart-manifest"`
}

DeleteOpts is a structure that holds parameters for deleting an object.

func (DeleteOpts) ToObjectDeleteQuery Uses

func (opts DeleteOpts) ToObjectDeleteQuery() (string, error)

ToObjectDeleteQuery formats a DeleteOpts into a query string.

type DeleteOptsBuilder Uses

type DeleteOptsBuilder interface {
    ToObjectDeleteQuery() (string, error)
}

DeleteOptsBuilder allows extensions to add additional parameters to the Delete request.

type DeleteResult Uses

type DeleteResult struct {
    gophercloud.HeaderResult
}

DeleteResult represents the result of a delete operation.

func Delete Uses

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

Delete is a function that deletes an object.

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 DownloadHeader Uses

type DownloadHeader struct {
    AcceptRanges       string    `mapstructure:"Accept-Ranges"`
    ContentDisposition string    `mapstructure:"Content-Disposition"`
    ContentEncoding    string    `mapstructure:"Content-Encoding"`
    ContentLength      int64     `mapstructure:"Content-Length"`
    ContentType        string    `mapstructure:"Content-Type"`
    Date               time.Time `mapstructure:"-"`
    DeleteAt           time.Time `mapstructure:"-"`
    ETag               string    `mapstructure:"Etag"`
    LastModified       time.Time `mapstructure:"-"`
    ObjectManifest     string    `mapstructure:"X-Object-Manifest"`
    StaticLargeObject  bool      `mapstructure:"X-Static-Large-Object"`
    TransID            string    `mapstructure:"X-Trans-Id"`
}

DownloadHeader represents the headers returned in the response from a Download request.

type DownloadOpts Uses

type DownloadOpts struct {
    IfMatch           string    `h:"If-Match"`
    IfModifiedSince   time.Time `h:"If-Modified-Since"`
    IfNoneMatch       string    `h:"If-None-Match"`
    IfUnmodifiedSince time.Time `h:"If-Unmodified-Since"`
    Range             string    `h:"Range"`
    Expires           string    `q:"expires"`
    MultipartManifest string    `q:"multipart-manifest"`
    Signature         string    `q:"signature"`
}

DownloadOpts is a structure that holds parameters for downloading an object.

func (DownloadOpts) ToObjectDownloadParams Uses

func (opts DownloadOpts) ToObjectDownloadParams() (map[string]string, string, error)

ToObjectDownloadParams formats a DownloadOpts into a query string and map of headers.

type DownloadOptsBuilder Uses

type DownloadOptsBuilder interface {
    ToObjectDownloadParams() (map[string]string, string, error)
}

DownloadOptsBuilder allows extensions to add additional parameters to the Download request.

type DownloadResult Uses

type DownloadResult struct {
    gophercloud.HeaderResult
    Body io.ReadCloser
}

DownloadResult is a *http.Response that is returned from a call to the Download function.

func Download Uses

func Download(c *gophercloud.ServiceClient, containerName, objectName string, opts DownloadOptsBuilder) DownloadResult

Download is a function that retrieves the content and metadata for an object. To extract just the content, pass the DownloadResult response to the ExtractContent function.

func (DownloadResult) Extract Uses

func (dr DownloadResult) Extract() (DownloadHeader, error)

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

func (DownloadResult) ExtractContent Uses

func (dr DownloadResult) ExtractContent() ([]byte, error)

ExtractContent is a function that takes a DownloadResult's io.Reader body and reads all available data into a slice of bytes. Please be aware that due the nature of io.Reader is forward-only - meaning that it can only be read once and not rewound. You can recreate a reader from the output of this function by using bytes.NewReader(downloadBytes)

type GetHeader Uses

type GetHeader struct {
    ContentDisposition string    `mapstructure:"Content-Disposition"`
    ContentEncoding    string    `mapstructure:"Content-Encoding"`
    ContentLength      int64     `mapstructure:"Content-Length"`
    ContentType        string    `mapstructure:"Content-Type"`
    Date               time.Time `mapstructure:"-"`
    DeleteAt           time.Time `mapstructure:"-"`
    ETag               string    `mapstructure:"Etag"`
    LastModified       time.Time `mapstructure:"-"`
    ObjectManifest     string    `mapstructure:"X-Object-Manifest"`
    StaticLargeObject  bool      `mapstructure:"X-Static-Large-Object"`
    TransID            string    `mapstructure:"X-Trans-Id"`
}

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

type GetOpts Uses

type GetOpts struct {
    Expires   string `q:"expires"`
    Signature string `q:"signature"`
}

GetOpts is a structure that holds parameters for getting an object's metadata.

func (GetOpts) ToObjectGetQuery Uses

func (opts GetOpts) ToObjectGetQuery() (string, error)

ToObjectGetQuery formats a GetOpts into a query string.

type GetOptsBuilder Uses

type GetOptsBuilder interface {
    ToObjectGetQuery() (string, error)
}

GetOptsBuilder allows extensions to add additional parameters to the Get request.

type GetResult Uses

type GetResult struct {
    gophercloud.HeaderResult
}

GetResult is a *http.Response that is returned from a call to the Get function.

func Get Uses

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

Get is a function that retrieves the metadata of an object. 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 object.

type HTTPMethod Uses

type HTTPMethod string

HTTPMethod represents an HTTP method string (e.g. "GET").

var (
    // GET represents an HTTP "GET" method.
    GET HTTPMethod = "GET"
    // POST represents an HTTP "POST" method.
    POST HTTPMethod = "POST"
)

type ListOpts Uses

type ListOpts struct {
    // Full is a true/false value that represents the amount of object information
    // returned. If Full is set to true, then the content-type, number of bytes, hash
    // date last modified, and name are returned. If set to false or not set, then
    // only the object names are returned.
    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"`
    Path      string `q:"path"`
}

ListOpts is a structure that holds parameters for listing objects.

func (ListOpts) ToObjectListParams Uses

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

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

type ListOptsBuilder Uses

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

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

type Object Uses

type Object struct {
    // Bytes is the total number of bytes that comprise the object.
    Bytes int64 `json:"bytes" mapstructure:"bytes"`

    // ContentType is the content type of the object.
    ContentType string `json:"content_type" mapstructure:"content_type"`

    // Hash represents the MD5 checksum value of the object's content.
    Hash string `json:"hash" mapstructure:"hash"`

    // LastModified is the RFC3339Milli time the object was last modified, represented
    // as a string. For any given object (obj), this value may be parsed to a time.Time:
    // lastModified, err := time.Parse(gophercloud.RFC3339Milli, obj.LastModified)
    LastModified string `json:"last_modified" mapstructure:"last_modified"`

    // Name is the unique name for the object.
    Name string `json:"name" mapstructure:"name"`
}

Object is a structure that holds information related to a storage object.

type ObjectPage Uses

type ObjectPage struct {
    pagination.MarkerPageBase
}

ObjectPage is a single page of objects that is returned from a call to the List function.

func (ObjectPage) IsEmpty Uses

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

IsEmpty returns true if a ListResult contains no object names.

func (ObjectPage) LastMarker Uses

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

LastMarker returns the last object name in a ListResult.

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
    ContentDisposition string `h:"Content-Disposition"`
    ContentEncoding    string `h:"Content-Encoding"`
    ContentType        string `h:"Content-Type"`
    DeleteAfter        int    `h:"X-Delete-After"`
    DeleteAt           int    `h:"X-Delete-At"`
    DetectContentType  bool   `h:"X-Detect-Content-Type"`
}

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

func (UpdateOpts) ToObjectUpdateMap Uses

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

ToObjectUpdateMap formats a UpdateOpts into a map of headers.

type UpdateOptsBuilder Uses

type UpdateOptsBuilder interface {
    ToObjectUpdateMap() (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.

func Update Uses

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

Update is a function that creates, updates, or deletes an object'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 objects imports 14 packages (graph) and is imported by 55 packages. Updated 2016-07-28. Refresh now. Tools for package owners.