Closed robmarkcole closed 3 years ago
Hey, Thanks for this integration. Very helpful. Would you be able to add prefixes?
@macieys any suggestions on if it should be:
@robmarkcole, I would follow Ansible s3 module pattern if possible:
s3:
bucket: mybucket
object: /my/desired/key.txt
src: /usr/local/myfile.txt
It's very clean and simple. https://docs.ansible.com/ansible/2.3/s3_module.html
Right this is how minio integration is implemented also https://www.home-assistant.io/integrations/minio/
Right this is how minio integration is implemented also https://www.home-assistant.io/integrations/minio/
I see. Can we use key
attribute to provide the whole path then? i.e.
key: filename.txt
or if user wants it under some prefix:
key: prefix/filename.txt
Right now we are using the file_name as the key, which is a convenience but also lack flexibility.
s3_client.upload_file(Filename=file_path, Bucket=bucket, Key=file_name, ExtraArgs=extra_args)
In minio the key is required, and since this put
service is most likely to be called from an automation maybe there is not much benefit from having the key inferred as we do currently. I am inclined to adopt the approach of minio, with both key and bucket required, so that automations can be used identically on both S3 and minio.
Replacing with https://github.com/robmarkcole/HASS-S3/issues/11
Add optional boolean key_prefix (default false) which will be prepended to the file name:
false: "S3:my_bucket/file.jpg" true: "S3:my_bucket/some/path/file.jpg"