l.s.d.c.CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin) : class documentation

Part of libcloud.storage.drivers.cloudfiles View Source View In Hierarchy

Known subclasses: libcloud.storage.drivers.cloudfiles.CloudFilesSwiftStorageDriver, libcloud.storage.drivers.cloudfiles.CloudFilesUKStorageDriver, libcloud.storage.drivers.cloudfiles.CloudFilesUSStorageDriver

Base CloudFiles driver.

You should never create an instance of this class directly but use US/US
class.
Method __init__ @param key: API key or username to be used (required) @type key: C{str}
Method list_containers Return a list of containers.
Method list_container_objects Return a list of objects for the given container.
Method get_container Return a container instance.
Method get_object Return an object instance.
Method get_container_cdn_url Return a container CDN URL.
Method get_object_cdn_url Return a object CDN URL.
Method enable_container_cdn @inherits: L{StorageDriver.enable_container_cdn}
Method create_container Create a new container.
Method delete_container Delete a container.
Method download_object Download an object to the specified destination path.
Method download_object_as_stream Return a generator which yields object data.
Method upload_object Upload an object.
Method upload_object_via_stream Upload an object using an iterator.
Method delete_object Delete an object.
Method ex_purge_object_from_cdn Purge edge cache for the specified object.
Method ex_get_meta_data Get meta data
Method ex_multipart_upload_object Undocumented
Method ex_enable_static_website Enable serving a static website.
Method ex_set_error_page Set a custom error page which is displayed if file is not found and serving of a static website is enabled.
Method ex_set_account_metadata_temp_url_key Set the metadata header X-Account-Meta-Temp-URL-Key on your Cloud Files account.
Method ex_get_object_temp_url No summary
Method _upload_object_part Undocumented
Method _upload_object_manifest Undocumented
Method _get_more Undocumented
Method _put_object Undocumented
Method _encode_container_name Encode container name so it can be used as part of the HTTP request.
Method _encode_object_name Undocumented
Method _to_container_list Undocumented
Method _to_object_list Undocumented
Method _headers_to_container Undocumented
Method _headers_to_object Undocumented
Method _ex_connection_class_kwargs Return extra connection keyword arguments which are passed to the Connection class constructor.

Inherited from StorageDriver:

Method iterate_containers Return a generator of containers for the given account
Method iterate_container_objects Return a generator of objects for the given container.
Method enable_object_cdn Enable object CDN.
Method _get_object Call passed callback and start transfer of the object'
Method _save_object Save object to the provided path.
Method _upload_object Helper function for setting common request headers and calling the passed in callback which uploads an object.
Method _upload_data Upload data stored in a string.
Method _stream_data Stream a data over an http connection.
Method _upload_file Upload a file to the server.
Method _get_hash_function Return instantiated hash function for the hash type supported by the provider.

Inherited from OpenStackDriverMixin:

Method openstack_connection_kwargs @rtype: C{dict}
Method _get_argument_pairs Undocumented
def __init__(self, *args, **kwargs): (source)
@param    key:    API key or username to be used (required)
@type     key:    C{str}

@param    secret: Secret password to be used (required)
@type     secret: C{str}

@param    secure: Weither to use HTTPS or HTTP. Note: Some providers
                    only support HTTPS, and it is on by default.
@type     secure: C{bool}

@param    host: Override hostname used for connections.
@type     host: C{str}

@param    port: Override port used for connections.
@type     port: C{int}

@param    api_version: Optional API version. Only used by drivers
                         which support multiple API versions.
@type     api_version: C{str}

@rtype: C{None}
def list_containers(self): (source)
Return a list of containers.

@return: A list of Container instances.
@rtype: C{list} of L{Container}
def list_container_objects(self, container): (source)
Return a list of objects for the given container.

@param container: Container instance
@type container: L{Container}

@return: A list of Object instances.
@rtype: C{list} of L{Object}
def get_container(self, container_name): (source)
Return a container instance.

@param container_name: Container name.
@type container_name: C{str}

@return: L{Container} instance.
@rtype: L{Container}
def get_object(self, container_name, object_name): (source)
Return an object instance.

@param container_name: Container name.
@type  container_name: C{str}

@param object_name: Object name.
@type  object_name: C{str}

@return: L{Object} instance.
@rtype: L{Object}
def get_container_cdn_url(self, container): (source)
Return a container CDN URL.

@param container: Container instance
@type  container: L{Container}

@return: A CDN URL for this container.
@rtype: C{str}
def get_object_cdn_url(self, obj): (source)
Return a object CDN URL.

@param obj: Object instance
@type  obj: L{Object}

@return: A CDN URL for this object.
@rtype: C{str}
def enable_container_cdn(self, container, ex_ttl=None): (source)
@inherits: L{StorageDriver.enable_container_cdn}

@param ex_ttl: cache time to live
@type ex_ttl: C{int}
def create_container(self, container_name): (source)
Create a new container.

@type container_name: C{str}
@param container_name: Container name.

@return: C{Container} instance on success.
@rtype: L{Container}
def delete_container(self, container): (source)
Delete a container.

@type container: L{Container}
@param container: Container instance

@return: True on success, False otherwise.
@rtype: C{bool}
def download_object(self, obj, destination_path, overwrite_existing=False, delete_on_failure=True): (source)
Download an object to the specified destination path.

@param obj: Object instance.
@type obj: L{Object}

@param destination_path: Full path to a file or a directory where the
                        incoming file will be saved.
@type destination_path: C{str}

@param overwrite_existing: True to overwrite an existing file,
    defaults to False.
@type overwrite_existing: C{bool}

@param delete_on_failure: True to delete a partially downloaded file if
the download was not successful (hash mismatch / file size).
@type delete_on_failure: C{bool}

@return: True if an object has been successfully downloaded, False
otherwise.
@rtype: C{bool}
def download_object_as_stream(self, obj, chunk_size=None): (source)
Return a generator which yields object data.

@param obj: Object instance
@type obj: L{Object}

@param chunk_size: Optional chunk size (in bytes).
@type chunk_size: C{int}

@rtype: C{object}
def upload_object(self, file_path, container, object_name, extra=None, verify_hash=True): (source)
Upload an object.

Note: This will override file with a same name if it already exists.
def upload_object_via_stream(self, iterator, container, object_name, extra=None): (source)
Upload an object using an iterator.

If a provider supports it, chunked transfer encoding is used and you
don't need to know in advance the amount of data to be uploaded.

Otherwise if a provider doesn't support it, iterator will be exhausted
so a total size for data to be uploaded can be determined.

Note: Exhausting the iterator means that the whole data must be
buffered in memory which might result in memory exhausting when
uploading a very large object.

If a file is located on a disk you are advised to use upload_object
function which uses fs.stat function to determine the file size and it
doesn't need to buffer whole object in the memory.

@type iterator: C{object}
@param iterator: An object which implements the iterator interface.

@type container: L{Container}
@param container: Destination container.

@type object_name: C{str}
@param object_name: Object name.

@type extra: C{dict}
@param extra: (optional) Extra attributes (driver specific). Note:
    This dictionary must contain a 'content_type' key which represents
    a content type of the stored object.

@rtype: C{object}
def delete_object(self, obj): (source)
Delete an object.

@type obj: L{Object}
@param obj: Object instance.

@return: C{bool} True on success.
@rtype: C{bool}
def ex_purge_object_from_cdn(self, obj, email=None): (source)
Purge edge cache for the specified object.

@param email: Email where a notification will be sent when the job
completes. (optional)
@type email: C{str}
def ex_get_meta_data(self): (source)
Get meta data

@rtype: C{dict}
def ex_multipart_upload_object(self, file_path, container, object_name, chunk_size=33554432, extra=None, verify_hash=True): (source)
Undocumented
def ex_enable_static_website(self, container, index_file='index.html'): (source)
Enable serving a static website.

@param container: Container instance
@type container: L{Container}

@param index_file: Name of the object which becomes an index page for
every sub-directory in this container.
@type index_file: C{str}

@rtype: C{bool}
def ex_set_error_page(self, container, file_name='error.html'): (source)
Set a custom error page which is displayed if file is not found and
serving of a static website is enabled.

@param container: Container instance
@type container: L{Container}

@param file_name: Name of the object which becomes the error page.
@type file_name: C{str}

@rtype: C{bool}
def ex_set_account_metadata_temp_url_key(self, key): (source)
Set the metadata header X-Account-Meta-Temp-URL-Key on your Cloud
Files account.

@param key: X-Account-Meta-Temp-URL-Key
@type key: C{str}

@rtype: C{bool}
def ex_get_object_temp_url(self, obj, method='GET', timeout=60): (source)
Create a temporary URL to allow others to retrieve or put objects
in your Cloud Files account for as long or as short a time as you
wish.  This method is specifically for allowing users to retrieve
or update an object.

@param obj: The object that you wish to make temporarily public
@type obj: L{Object}

@param method: Which method you would like to allow, 'PUT' or 'GET'
@type method: C{str}

@param timeout: Time (in seconds) after which you want the TempURL
to expire.
@type timeout: C{int}

@rtype: C{bool}
def _upload_object_part(self, container, object_name, part_number, iterator, verify_hash=True): (source)
Undocumented
def _upload_object_manifest(self, container, object_name, extra=None, verify_hash=True): (source)
Undocumented
def _get_more(self, last_key, value_dict): (source)
Undocumented
def _put_object(self, container, object_name, upload_func, upload_func_kwargs, extra=None, file_path=None, iterator=None, verify_hash=True): (source)
Undocumented
def _encode_container_name(self, name): (source)
Encode container name so it can be used as part of the HTTP request.
def _encode_object_name(self, name): (source)
Undocumented
def _to_container_list(self, response): (source)
Undocumented
def _to_object_list(self, response, container): (source)
Undocumented
def _headers_to_container(self, name, headers): (source)
Undocumented
def _headers_to_object(self, name, container, headers): (source)
Undocumented
def _ex_connection_class_kwargs(self): (source)
Return extra connection keyword arguments which are passed to the
Connection class constructor.
API Documentation for libcloud, generated by pydoctor at 2013-07-01 17:02:02.