/  Python Yamcs Client  /  Object Storage  /  Client

Client

class yamcs.client.StorageClient(ctx: Context)

Client for working with buckets and objects managed by Yamcs.

create_bucket(bucket_name: str)

Create a new bucket.

Parameters:

bucket_name – The name of the bucket.

download_object(bucket_name: str, object_name: str) bytes

Download an object.

Parameters:
  • bucket_name – The name of the bucket.

  • object_name – The object to fetch.

get_bucket(name: str, create=False) Bucket

Get a specific bucket.

Parameters:
  • name – The bucket name.

  • create – If specified, create the bucket if it does not yet exist.

list_buckets() Iterable[Bucket]

List the buckets.

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

List the objects for a bucket.

Parameters:
  • bucket_name – The name of the bucket.

  • 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.

remove_bucket(bucket_name: str)

Remove a bucket.

Parameters:

bucket_name – The name of the bucket.

remove_object(bucket_name: str, object_name: str)

Remove an object from a bucket.

Parameters:
  • bucket_name – The name of the bucket.

  • object_name – The object to remove.

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

Upload an object to a bucket.

Parameters:
  • bucket_name – The name of the bucket.

  • 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.