CloudFiles

class CloudFiles.CloudFiles(env, region=None)[source]

Bases: Cloud.Cloud

A class to interface into Rackspace Cloud Files.

service = 'Files'
getAccountMeta()[source]

Retrieves the number of containers and the total bytes stored in Cloud Files for the account.

Returns: Results header as string

setAccountMeta(metaDict)[source]

Allows for metadata entries to an account(TempURL or form posts etc)

Arguments: metaDict – Python dictionary of key/value pairs to be added.

Returns: status code

getContainers(attrDict={})[source]

Lists the available containers in the Cloud Files account.

Arguments: attrDict –

limit – For an integer value n, limits the number of results to n values. (Optional) marker – Given a string value x, return object names greater in value than the marker. (Optional) format – Specify either json or xml to return the respective serialized response. (Optional)
createContainer(container, metaDict=None)[source]

Create a container at the root of the CF account.

Arguments: container – container name (string) metaDict – A python dictionary with key/value pairs for metadata tags and desc etc.

Must be valid UTF-8 http header and take the format X-Container-Meta- etc.

Returns: status code

deleteContainer(container)[source]

Permanently remove a container. Must be empty

Arguments: container – container name (string)

Returns: status code

getContainerMeta(container)[source]

Retrieves metadata for a specified container.

Arguments: container – container name (string)

Returns: Header info as string

setContainerMeta(container, metaDict)[source]

Create or update metadata on a container.

Arguments: container – container name (string) metaDict – A python dictionary with key/value pairs for metadata tags and desc etc.

Must be valid UTF-8 http header and take the format X-Container-Meta- etc.

Returns: status code

getObjects(container, attrDict={})[source]

Retrieves a list of objects stored in the container. Additionally, there are a number of optional query parameters that can be used to refine the list results.

Arguments: container – container name (string) attrDict – dictionary containing any of the following

limit – For an integer value n, limits the number of results to n values. (Optional) marker – Return object names greater in value than the specified marker. (Optional) prefix – Causes the results to be limited to object names beginning with the substring (Optional) format – Specify either json or xml to return the respective serialized response. Default json (Optional) path – Return the object names nested in the pseudo path. (Optional) delimiter – Return all the object names nested in the container with given delimiter (Optional)

Returns: JSON results as python dict

getObject(container, myObject, headersList=None)[source]

Retrieves CF objects data.

Arguments: container – container name (string) myObject – object name(string) headersList – HTTP headers as documented in RFC 2616 as key/value in python dictionary. See api docs.

Returns: Binary content on success or status code on failure.

createObject(container, myObject, data, headersList=None)[source]

PUT object into CF container.

Arguments: container – container name (string) myObject – Object name(string) data – File object headersList – HTTP headers as documented in RFC 2616 as key/value in python dictionary. See api docs. (Optional)

Returns: Header results

copyObject(sourceContainer, sourceObject, destContainer, destObject)[source]

Copy object into CF container.

Arguments: sourceContainer – Name(str) sourceObject – Name(string) destContainer – Name(str) destinationObject – Name(string)

Returns: status code

deleteObject(container, myObject)[source]

Delete CF object.

Arguments: container – container name(str) myObject – object name(str)

Returns: status code

getObjectMeta(container, myObject)[source]

Retrieves object metadata.

Arguments: container – container name(str) myObject – object name(str)

Returns: Header info

setObjectMeta(container, myObject, metaDict)[source]

Replaces user defined metadata with supplied.

Arguments: container – container name(str) myObject – object name(str) metaDict – Python dictionary with key/values to be added. Keys must be prefixed with X-Object-Meta

Returns: status code

setCDNContainer(container, enabled=True, ttl=None)[source]

Enable or disable CDN services on a container.

Arguments: container – container name(str) enabled – bool (Optional) ttl – How long till CDN cache expires. The default TTL value is 259200 seconds, or 72 hours (Optional)

Returns: headers as string

getCDNContainers(attrDict={})[source]

Container list request from the CDN service. It will default to showing public and private containers.

Arguments: attrDict –

limit – Limits the number of results to n values. (Optional) marker – Return object names greater in value than the specified marker. (Optional) format – either json or xml for serialized output. Default json (Optional) enabledOnly – If True, only shows CDN enabled containers (Optional)

Returns: JSON results as python dict

setCDNContainerMeta(container, metaDict)[source]

Adjust CDN containers attributes.

Arguments: container – metaDict – Python dictionary with key/value pairs to append to container metadata

Returns: Headers as string

getCDNContainerMeta(container)[source]

Returns metadata for specified CDN container.

Arguments: container –

Returns: Headers as string

deleteCDNObject(container, myObject)[source]

Purge CDN cache for a published object. Limit 25/day

Arguments: container – myObject –

Returns: status code

Previous topic

CloudDNS

Next topic

CloudLB