Container

class object_storage.container.Container(name, headers=None, client=None)[source]

Container class. Encapsulates Storage containers.

constructor for Container

@param name: container name @param headers: init headers to use when initializing the container @param client: object_storage.client instance.

exists()[source]

Tries to load the container to check existance

@raises ResponseError @return: boolean, true if exists else false

load(cdn=True)[source]

load data for the container

@param cdn: True if you want CDN information; default=True @return: object_storage.container, self

get_info()[source]

loads data if not already available and returns the properties

properties[source]

loads data if not already available and returns the properties

props

loads data if not already available and returns the properties

headers[source]

loads data if not already available and returns the raw headers for the container

meta[source]

loads data if not already available and returns the metadata for the container

path[source]

returns path of the container

url[source]

Returns the url of the container

is_dir()[source]

Returns if the container is a directory (always True)

set_metadata(meta)[source]

Sets metadata for the container

@param meta: dict of metadata on the container @raises ResponseError

create()[source]

Create container

@raises ResponseError @return: Containert - self

delete(recursive=False)[source]

Delete container

@param recursive: true if you want to delete all of the
objects in the container as well.

@raises ResponseError @return: True

delete_all_objects()[source]

Deletes all objects in the container

@raises ResponseError

delete_object(obj)[source]

Deletes an object in the container

@param obj: object name to delete @raises ResponseError

rename(new_container)[source]

Rename container. Will not work if container is not empty.

@param new_container: new container name @raises ResponseError

objects(limit=None, marker=None, base_only=False, headers=None)[source]

Lists objects in the container.

@param limit: limit of results to return. @param marker: start listing after this object name @param base_only: only return the base objects.

container/object not container/dir/object

@param headers: extra headers to use in the request @raises ResponseError @return: list of StorageObject instances

set_ttl(ttl)[source]

Set time to live for CDN

@param ttl: time in seconds to set as the TTL @raises ResponseError

set_read_acl(acl)[source]

Set read ACL

@param acl: ACL to set for the container @raises ResponseError

set_write_acl(acl)[source]

Set write ACL

@param acl: ACL to set for the container @raises ResponseError

make_public(ttl=1440)[source]

Make container public

@param ttl: time in seconds to set as the TTL @raises ResponseError

enable_cdn(ttl=1440)

Make container public

@param ttl: time in seconds to set as the TTL @raises ResponseError

make_private()[source]

Make container private (empty ACL)

@raises ResponseError

disable_cdn()

Make container private (empty ACL)

@raises ResponseError

search(q, options=None, **kwargs)[source]

Search within container.

get_object(name)[source]

Calls get_object() on the client.

storage_object(name, headers=None)[source]

Creates a new instance of Object

load_from_filename(filename)[source]

Creates an object from a file. Uses the basename of the file path as the object name.

make_request(method, path=None, *args, **kwargs)[source]

Makes a request on the resource.

Previous topic

Client

Next topic

StorageObject

This Page