Acquire.Access._filewriterequest module¶
-
class
FileWriteRequest(source=None, destination=None, root=None, ignore_hidden=True, account=None, testing_key=None)[source]¶ Bases:
Acquire.Access._request.RequestThis class holds a request to write a file (or files) to a remote object store
-
account_uid()[source]¶ Return the UID of the account from which payment should be taken for the file storage
Returns: returns the UID of the account if valid else None Return type: str or None
-
accounting_service_url()[source]¶ Return the canonical URL of the service holding the account
Returns: If _accounting_service_url valid return return it else return None Return type: str or None
Return the authorisation behind this request
Returns: the authorisation behind this request Return type: Authorisation
-
checksums()[source]¶ Return the checksums of the files that are requested to be written
Returns: checksums of the files to be written Return type: list
-
destination_keys()[source]¶ Return the object store keys to which the files will be written
Returns: object store keys to which the files will be written Return type: list
-
static
expand_source_and_destination(source, destination, root=None, ignore_hidden=True)[source]¶ This function expands the passed source and destination objects into the list of absolute paths of local source files, and the full keys of those files once they are uploaded to the object store. This returns a pair of lists - the lists match the absolute path of the local file to the desired full key of the file in the object store
Parameters: - source (list) – list of source objects
- destination (list) – list of destinations for objects
- root (str, optional, default=None) – root key for objects
- ignore_hidden (bool, optional, default=True) – ignore
- files (hidden) –
-
filesizes()[source]¶ Return the sizes of the files that are requested to be written
Returns: size of the files to be written Return type: list
-
static
from_data(data)[source]¶ Create a request from a JSON object
Parameters: data (str) – an object serialised as a JSON object Returns: a FileWriteRequest object created from the JSON data Return type: FileWriteRequest
-
is_null()[source]¶ Return whether or not this is a null request
Returns: True if UID set, else False Return type: bool
-
resource_key()[source]¶ Function to return a string that can be used as a summary key for this resource request
- Returns:
- None or str : None if instance is null, else string containing uid and checksum
-
source_filenames()[source]¶ Return the filenames of the files to be copied. Note that this information is only available in the copy of the object that created the request - it is not saved when this object is serialised to json as we don’t want to leak potentially sensitive data to the object store
Returns: list of files to be copied Return type: list
-