/  Python Yamcs Client  /  Object Storage  /  Model

Model

class yamcs.storage.model.Bucket(proto, storage_client: StorageClient)
property created: datetime

When this bucket was created.

delete()

Remove this bucket in its entirety.

delete_object(object_name: str)

Remove an object from this bucket.

Parameters:

object_name – The object to remove.

property directory: Optional[str]

Bucket root directory. This field is only set when the bucket is mapped to the file system. Therefore it is not set for buckets that store objects in RocksDB.

download_object(object_name: str) bytes

Download an object.

Parameters:

object_name – The object to fetch.

list_objects(prefix: Optional[str] = None, delimiter: Optional[str] = None)

List the objects for this bucket.

Parameters:
  • prefix – If specified, only objects that start with this prefix are listed.

  • delimiter – If specified, return only objects whose name do not contain the delimiter after the prefix. For the other objects, the response contains (in the prefix response parameter) the name truncated after the delimiter. Duplicates are omitted.

property max_object_count: Optional[int]

Maximum allowed number of objects.

property max_size: Optional[int]

Maximum allowed total size of all objects.

property name: str

Name of this bucket.

property object_count: int

Number of objects in this bucket.

property size: int

Total size in bytes of this bucket (excluding metadata).

upload_object(object_name: str, file_obj: Union[str, IO], content_type: Optional[str] = None, metadata: Optional[Mapping[str, str]] = None)

Upload an object to this bucket.

Parameters:
  • object_name – The target name of the object.

  • file_obj – The file (or file-like object) to upload.

  • content_type – The content type associated to this object. This is mainly useful when accessing an object directly via a web browser. If unspecified, a content type may be automatically derived from the specified file_obj.

  • metadata – Optional metadata associated to this object.

class yamcs.storage.model.ObjectInfo(proto, bucket, storage_client)
property created: datetime

Return when this object was created (or re-created).

delete()

Remove this object.

download()

Download this object.

property name: str

The name of this object.

property size: int

Size in bytes of this object (excluding metadata).

upload(file_obj: Union[str, IO], metadata: Optional[Mapping[str, str]] = None)

Replace the content of this object.

Parameters:
  • file_obj – The file (or file-like object) to upload.

  • metadata – Optional metadata associated to this object.

class yamcs.storage.model.ObjectListing(proto, bucket, storage_client)
property objects: List[ObjectInfo]

The objects in this listing.

property prefixes: List[str]

The prefixes in this listing.