minio / minio-py

MinIO Client SDK for Python
https://docs.min.io/docs/python-client-quickstart-guide.html
Apache License 2.0
851 stars 325 forks source link

Add UserTags support to list_objects API #1381

Closed angrybat closed 10 months ago

angrybat commented 10 months ago

This adds the tags property to the Object class which can be set in the constructor of the class. This defaults to an empty Tags class.

The http response already contains the tags in the xml response under the text in the "UserTags" key. The fromxml method has been modified to set the tags to a populated version of the Tags class. This used the added Tags.object_from_user_tags_text method.

The Tags.object_from_user_tags_text method is a new method that creates a Tags class instance for Objects from a string in the format "key1=value1&key2=value2". This is the format the tags are in the text of the "UserTags" key.

angrybat commented 10 months ago

@balamurugana out of interest how come filtering by UserTags should be done outside of minio-py?

The list_objects function has a prefix parameter that allows you to filter by path. How come that is different to filtering by UserTags?

The filtering I have added here is optional. So the original functionality of the function is preserved.

balamurugana commented 10 months ago

@balamurugana out of interest how come filtering by UserTags should be done outside of minio-py?

The list_objects function has a prefix parameter that allows you to filter by path. How come that is different to filtering by UserTags?

The filtering I have added here is optional. So the original functionality of the function is preserved.

Filtering by prefix and other parameters are done at server side whereas UserTags filtering is done at client side in this PR which we don't want.

angrybat commented 10 months ago

Can I get a second review please