Acquire.ObjectStore._oci_objstore module¶
-
class
OCI_ObjectStore[source]¶ Bases:
objectThis is the backend that abstracts using the Oracle Cloud Infrastructure object store
-
static
close_par(par=None, par_uid=None, url_checksum=None)[source]¶ Close the passed PAR, which provides access to data in the passed bucket
Parameters: - par (PAR, default=None) – PAR to close bucket
- par_uid (str, default=None) – UID for PAR
- url_checksum (str, default=None) – Checksum to
- to PARRegistry (pass) –
Returns: None
-
static
create_bucket(bucket, bucket_name, compartment=None)[source]¶ Create and return a new bucket in the object store called ‘bucket_name’, optionally placing it into the compartment identified by ‘compartment’. This will raise an ObjectStoreError if this bucket already exists
Parameters: - bucket (dict) – Bucket to hold data
- bucket_name (str) – Name of bucket to create
- compartment (str) – Compartment in which to create bucket
Returns: New bucket
Return type: dict
-
static
create_par(bucket, encrypt_key, key=None, readable=True, writeable=False, duration=3600, cleanup_function=None)[source]¶ Create a pre-authenticated request for the passed bucket and key (if key is None then the request is for the entire bucket). This will return a PAR object that will contain a URL that can be used to access the object/bucket. If writeable is true, then the URL will also allow the object/bucket to be written to. PARs are time-limited. Set the lifetime in seconds by passing in ‘duration’ (by default this is one hour)
Parameters: - bucket (dict) – Bucket to create PAR for
- encrypt_key (PublicKey) – Public key to
- PAR (encrypt) –
- key (str, default=None) – Key
- readable (bool, default=True) – If bucket is readable
- writeable (bool, default=False) – If bucket is writeable
- duration (int, default=3600) – Duration PAR should be
- for in seconds (valid) –
- cleanup_function (function, default=None) – Cleanup
- to be passed to PARRegistry (function) –
Returns: Pre-authenticated request for the bucket
Return type:
-
static
delete_all_objects(bucket, prefix=None)[source]¶ Deletes all objects…
Parameters: - bucket (dict) – Bucket containing data
- prefix (str, default=None) – Prefix for data,
- unused (currently) –
- Returns:
- None
-
static
delete_bucket(bucket, force=False)[source]¶ Delete the passed bucket. This should be used with caution. Normally you can only delete a bucket if it is empty. If ‘force’ is True then it will remove all objects/pars from the bucket first, and then delete the bucket. This can cause a LOSS OF DATA!
Parameters: - bucket (dict) – Bucket to delete
- force (bool, default=False) – If True, delete even
- bucket is not empty. If False and bucket not empty (if) –
- PermissionError (raise) –
Returns: None
-
static
delete_object(bucket, key)[source]¶ Removes the object at ‘key’
Parameters: - bucket (dict) – Bucket containing data
- key (str) – Key for data
Returns: None
-
static
get_all_object_names(bucket, prefix=None)[source]¶ Returns the names of all objects in the passed bucket
Parameters: - bucket (dict) – Bucket containing data
- prefix (str) – Prefix for data
Returns: List of all objects in bucket
Return type: list
-
static
get_bucket(bucket, bucket_name, compartment=None, create_if_needed=True)[source]¶ Find and return a new bucket in the object store called ‘bucket_name’, optionally placing it into the compartment identified by ‘compartment’. If ‘create_if_needed’ is True then the bucket will be created if it doesn’t exist. Otherwise, if the bucket does not exist then an exception will be raised.
Parameters: - bucket (dict) – Bucket to hold data
- bucket_name (str) – Name of bucket to create
- compartment (str, default=None) – Compartment in which to create bucket
- create_if_needed (bool, default=None) – If True, create bucket, else do
- not –
Returns: New bucket
Return type: dict
-
static
get_bucket_name(bucket)[source]¶ Return the name of the passed bucket
Parameters: bucket (dict) – Bucket holding data Returns: Name of bucket Return type: str
-
static
get_object(bucket, key)[source]¶ Return the binary data contained in the key ‘key’ in the passed bucket
Parameters: - bucket (dict) – Bucket containing data
- key (str) – Key for data in bucket
Returns: Binary data
Return type: bytes
-
static
get_size_and_checksum(bucket, key)[source]¶ Return the object size (in bytes) and MD5 checksum of the object in the passed bucket at the specified key
Parameters: - bucket (dict) – Bucket containing data
- key (str) – Key for object
Returns: Size and MD5 checksum of object
Return type: tuple (int, str)
-
static
is_bucket_empty(bucket)[source]¶ Return whether or not the passed bucket is empty
Parameters: bucket (dict) – Bucket holding data Returns: True if bucket empty, else False Return type: bool
-
static