Documentation
¶
Index ¶
- type Client
- func (c *Client) CreateContainer(input *CreateContainerInput) (*Container, error)
- func (c *Client) DeleteContainer(input *DeleteContainerInput) error
- func (c *Client) GetContainer(input *GetContainerInput) (*Container, error)
- func (c *Client) Objects() *ObjectClient
- func (c *Client) UpdateContainer(input *UpdateContainerInput) (*Container, error)
- type Container
- type CreateContainerInput
- type CreateObjectInput
- type DeleteContainerInput
- type DeleteObjectInput
- type GetContainerInput
- type GetObjectInput
- type ObjectClient
- type ObjectInfo
- type UpdateContainerInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.9.3
type Client struct {
// contains filtered or unexported fields
}
Client represents an authenticated storage client, with storage credentials and an api client.
func NewStorageClient ¶
NewStorageClient returns an authenticate storage client
func (*Client) CreateContainer ¶ added in v0.9.3
func (c *Client) CreateContainer(input *CreateContainerInput) (*Container, error)
CreateContainer creates a new Container with the given name, key and enabled flag.
func (*Client) DeleteContainer ¶ added in v0.9.3
func (c *Client) DeleteContainer(input *DeleteContainerInput) error
DeleteContainer deletes the Container with the given name.
func (*Client) GetContainer ¶ added in v0.9.3
func (c *Client) GetContainer(input *GetContainerInput) (*Container, error)
GetContainer retrieves the Container with the given name.
func (*Client) Objects ¶ added in v0.9.3
func (c *Client) Objects() *ObjectClient
Objects returns an object client
func (*Client) UpdateContainer ¶ added in v0.9.3
func (c *Client) UpdateContainer(input *UpdateContainerInput) (*Container, error)
UpdateContainer updates the key and enabled flag of the Container with the given name.
type Container ¶
type Container struct { // The name of the Container Name string // A container access control list (ACL) that grants read access. ReadACLs []string // A container access control list (ACL) that grants write access WriteACLs []string // The secret key value for temporary URLs. PrimaryKey string // The second secret key value for temporary URLs. SecondaryKey string // List of origins to be allowed to make cross-origin Requests. AllowedOrigins []string // List of headers exposed to the user agent (e.g. browser) in the actual request response. ExposedHeaders []string // Maximum age in seconds for the origin to hold the preflight results. MaxAge int // Maximum size of the container, in bytes QuotaBytes int // Maximum object count of the container QuotaCount int // Map of custom Container X-Container-Meta-{name} name value pairs CustomMetadata map[string]string // Georeplication Policy (undocumented) GeoreplicationPolicy []string }
Container describes an existing Container.
type CreateContainerInput ¶
type CreateContainerInput struct { // The unique name for the container. The container name must be from 1 to 256 characters long and can // start with any character and contain any pattern. Character set must be UTF-8. The container name // cannot contain a slash (/) character because this character delimits the container and object name. // For example, /account/container/object. // Required Name string `json:"name"` // Sets a container access control list (ACL) that grants read access. // Optional ReadACLs []string // Sets a container access control list (ACL) that grants read access. // Optional WriteACLs []string // Sets a secret key value for temporary URLs. // Optional PrimaryKey string // Sets a second secret key value for temporary URLs. // Optional SecondaryKey string // Sets the list of origins allowed to make cross-origin requests. // Optional AllowedOrigins []string // List of headers exposed to the user agent (e.g. browser) in the actual request response. // Optional ExposedHeaders []string // Sets the maximum age in seconds for the origin to hold the preflight results. // Optional MaxAge int // Sets the Maximum size of the container, in bytes // Optional QuotaBytes int // Sets the Maximum object count of the container // Optional QuotaCount int // Map of custom Container X-Container-Meta-{name} name value pairs // Optional CustomMetadata map[string]string }
CreateContainerInput defines an Container to be created.
type CreateObjectInput ¶ added in v0.3.0
type CreateObjectInput struct { // Name of the object. // Required Name string // Body of the request to use. Accepts an io.ReadSeeker, so options are open to // the downstream consumer // Required Body io.ReadSeeker // Name of the container to place the object // Required Container string // Override the behavior of the browser. // Optional ContentDisposition string // Set the content-encoding metadata // Optional ContentEncoding string // Changes the MIME type for the object // Optional - Defaults to 'text/plain' ContentType string // Specify the `container/object` to copy from. Must be UTF-8 encoded // and the name of the container and object must be URL-encoded // Optional CopyFrom string // Specify the date and time in UNIX Epoch time stamp format when the system // removes the object DeleteAt int // Specify the map of object metadata name values pairs for X-Object-Meta-{name} ObjectMetadata map[string]string // MD5 checksum value of the request body. Unquoted // Strongly recommended, not required. ETag string // Sets the transfer encoding. Can only be "chunked" or nil. // Requires content-length to be 0 if set. // Optional TransferEncoding string }
CreateObjectInput struct for a Create Method to create a storage object TODO: Add query parameters if needed
type DeleteContainerInput ¶
type DeleteContainerInput struct { // The name of the Container // Required Name string `json:"name"` }
DeleteContainerInput describes the container to delete
type DeleteObjectInput ¶ added in v0.3.0
type DeleteObjectInput struct { // ID is the container name + "/" + object name // Optional - Either ID or Name + Container are required ID string // Name of the Object to delete // Optional - Either ID or Name + Container are required Name string // Name of the container // Optional - Either ID or Name + Container are required Container string }
DeleteObjectInput struct for deleting objects TODO: Add query parameters if needed
type GetContainerInput ¶
type GetContainerInput struct { // The name of the Container // Required Name string `json:"name"` }
GetContainerInput describes the container to get
type GetObjectInput ¶ added in v0.3.0
type GetObjectInput struct { // ID of the object (container/object) // Optional - Either ID or Name + Container are required ID string // Name of the object to get details on // Optional - Either ID or Name + Container are required Name string // Name of the container // Optional - Either ID or Name + Container are required Container string // Range of data to receive. Must be specified via a byte range: // bytes=-5; bytes=10-15. Accept the entire string here, as multiple ranges // can be specified with a comma delimiter // Optional Range string // If set to true, Object Storage queries all replicas to return the most recent one. // If you omit this header, Object Storage responds faster after it finds one valid replica. // Because setting this header to true is more expensive for the back end, use it only when // it is absolutely needed. // Optional Newest bool }
GetObjectInput details on a storage object TODO: Add query parameters if needed
type ObjectClient ¶ added in v0.3.0
type ObjectClient struct {
Client
}
ObjectClient details the parameters needed for a storage object client
func (*ObjectClient) CreateObject ¶ added in v0.3.0
func (c *ObjectClient) CreateObject(input *CreateObjectInput) (*ObjectInfo, error)
CreateObject creates a new Object inside of a container.
func (*ObjectClient) DeleteObject ¶ added in v0.3.0
func (c *ObjectClient) DeleteObject(input *DeleteObjectInput) error
DeleteObject will delete the supplied object
func (*ObjectClient) GetObject ¶ added in v0.3.0
func (c *ObjectClient) GetObject(input *GetObjectInput) (*ObjectInfo, error)
GetObject accepts a input struct, returns an info struct
type ObjectInfo ¶ added in v0.3.0
type ObjectInfo struct { // ID is the container name + "/" object name for convenience ID string // Name of the object Name string // Type of ranges the object accepts AcceptRanges string // Name of the container Container string // Optional: Specifies the override behavior for the browser ContentDisposition string // Optional: Content's Encoding header ContentEncoding string // Length of the object in bytes ContentLength int // Type of the content ContentType string // Date of the transaction in ISO 8601 format. // Null value means the token never expires Date string // For objects smaller than 5GB, MD5 checksum of the object content. // Otherwise MD5 sum of the concatenated string of MD5 sums and ETAGS // for each segment of the manifest. Enclosed in double-quote characters Etag string // Date and time when the object was created/modified. ISO 8601. LastModified string // Optional: Date+Time in EPOCH that the object will be deleted. DeleteAt int // Optional: The dynamic large object manifest object. ObjectManifest string // Optional: The map of object metadata name values pairs for X-Object-Meta-{name} ObjectMetadata map[string]string // Date and time in UNIX EPOCH when the account, container, _or_ object // was initially created as a current version. Timestamp string // Transaction ID of the request - Used for bug reports to service providers TransactionID string }
ObjectInfo describes an existing object Optional values may not be passed in as response headers TODO: Add query parameters if needed
type UpdateContainerInput ¶
type UpdateContainerInput struct { // The name of the Container // Required Name string `json:"name"` // Updates a container access control list (ACL) that grants read access. // Optional ReadACLs []string // Updates a container access control list (ACL) that grants write access. // Optional WriteACLs []string // Updates the secret key value for temporary URLs. // Optional PrimaryKey string // Update the second secret key value for temporary URLs. // Optional SecondaryKey string // Updates the list of origins allowed to make cross-origin requests. // Optional AllowedOrigins []string // List of headers exposed to the user agent (e.g. browser) in the actual request response. // Optional ExposedHeaders []string // Updates the maximum age in seconds for the origin to hold the preflight results. // Optional MaxAge int // Updates the Maximum size of the container, in bytes // Optional QuotaBytes int // Updates the Maximum object count of the container // Optional QuotaCount int // Updates custom Container X-Container-Meta-{name} name value pairs // Optional CustomMetadata map[string]string // Remove custom Container X-Container-Meta-{name} headers // Optional RemoveCustomMetadata []string }
UpdateContainerInput defines an Container to be updated