robmarkcole / HASS-S3

Home Assistant integration for S3
Apache License 2.0
22 stars 13 forks source link

Feature request: support S3 compatible services #33

Open masi opened 10 months ago

masi commented 10 months ago

boto3 lets you provide a URL for endpoint so you can access one of the other many service like Backblaze, Wasabi, Cloudflare etc.

As far I have understood you do not need to provide a region name when using a custom endpoint.

Using this resources: https://knowledgebase.wasabi.com/hc/en-us/articles/360015106031-What-are-the-service-URLs-for-Wasabi-s-different-regions https://www.backblaze.com/docs/en/cloud-storage-call-the-s3-compatible-api

Or you can supply "auto": https://developers.cloudflare.com/r2/reference/data-location/

A fork for Oracle Cloud Infrastructure uses both the endpoint and adds a single region name of OCI: https://github.com/dailow/HASS-S3/commit/39eb770726dfb816a0d66c038408263292dac41b https://docs.oracle.com/en-us/iaas/api/

Easiest implementation is probably that when a user configures a custom endpoint no default region is used. If none is configured, none is sent. If one is configured, it is not validated by the HASS custom component.

An alternative is to support only those services for which the allowed regions are known. In this scenario the endpoints are hardcoded or derived from the region name. So the user configures not an endpoint but a service, eg Wasabi, and a region.

Both ideas are not mutual exclusive. If a service name is configured the endpoint will be automatically generated. But a configured endpoint will act as an override.

masi commented 10 months ago

https://documentation.commvault.com/2023/essential/9237_supported_cloud_storage_s3_compatible_object_storage_vendors.html

And this list is IMHO not exhaustive. It misses eg Storj, IDrive e2, Cloudflare R2 and probably many more.

robmarkcole commented 10 months ago

@masi please create a PR implementing this feature - it would need to be tested against all supported services and not introduce any breaking changes, thanks