From 4568feb5f9570a0dbfd7479a38857bb93a5f6bb8 Mon Sep 17 00:00:00 2001 From: Bruno Fernandes <54373093+folkzb@users.noreply.github.com> Date: Thu, 6 Jun 2024 07:25:45 -0300 Subject: [PATCH] s3: Add Magalu S3 Object Storage as provider --- README.md | 1 + backend/s3/s3.go | 45 ++++++++++++++-- docs/content/_index.md | 1 + docs/content/s3.md | 120 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 163 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b3195441d..0c17cb6a8 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ Rclone *("rsync for cloud storage")* is a command-line program to sync files and * Liara Object Storage [:page_facing_up:](https://rclone.org/s3/#liara-object-storage) * Linkbox [:page_facing_up:](https://rclone.org/linkbox) * Linode Object Storage [:page_facing_up:](https://rclone.org/s3/#linode) + * Magalu Object Storage [:page_facing_up:](https://rclone.org/s3/#magalu) * Mail.ru Cloud [:page_facing_up:](https://rclone.org/mailru/) * Memset Memstore [:page_facing_up:](https://rclone.org/swift/) * Mega [:page_facing_up:](https://rclone.org/mega/) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index a17446f9f..29bdfab77 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -129,6 +129,9 @@ var providerOption = fs.Option{ }, { Value: "Linode", Help: "Linode Object Storage", + }, { + Value: "Magalu", + Help: "Magalu Object Storage", }, { Value: "Minio", Help: "Minio Object Storage", @@ -530,7 +533,7 @@ func init() { }, { Name: "region", Help: "Region to connect to.\n\nLeave blank if you are using an S3 clone and you don't have a region.", - Provider: "!AWS,Alibaba,ArvanCloud,ChinaMobile,Cloudflare,IONOS,Petabox,Liara,Linode,Qiniu,RackCorp,Scaleway,Storj,Synology,TencentCOS,HuaweiOBS,IDrive", + Provider: "!AWS,Alibaba,ArvanCloud,ChinaMobile,Cloudflare,IONOS,Petabox,Liara,Linode,Magalu,Qiniu,RackCorp,Scaleway,Storj,Synology,TencentCOS,HuaweiOBS,IDrive", Examples: []fs.OptionExample{{ Value: "", Help: "Use this if unsure.\nWill use v4 signatures and an empty region.", @@ -933,6 +936,19 @@ func init() { Value: "us-iad-1.linodeobjects.com", Help: "Washington, DC, (USA), us-iad-1", }}, + }, { + // Magalu endpoints: https://docs.magalu.cloud/docs/object-storage/how-to/copy-url + Name: "endpoint", + Help: "Endpoint for Magalu Object Storage API.", + Provider: "Magalu", + Examples: []fs.OptionExample{{ + Value: "br-se1.magaluobjects.com", + Help: "São Paulo, SP (BR), br-se1", + }, { + Value: "br-ne1.magaluobjects.com", + Help: "Fortaleza, CE (BR), br-ne1", + }, + }, }, { // oss endpoints: https://help.aliyun.com/document_detail/31837.html Name: "endpoint", @@ -1285,7 +1301,7 @@ func init() { }, { Name: "endpoint", Help: "Endpoint for S3 API.\n\nRequired when using an S3 clone.", - Provider: "!AWS,ArvanCloud,IBMCOS,IDrive,IONOS,TencentCOS,HuaweiOBS,Alibaba,ChinaMobile,GCS,Liara,Linode,Scaleway,StackPath,Storj,Synology,RackCorp,Qiniu,Petabox", + Provider: "!AWS,ArvanCloud,IBMCOS,IDrive,IONOS,TencentCOS,HuaweiOBS,Alibaba,ChinaMobile,GCS,Liara,Linode,MagaluCloud,Scaleway,StackPath,Storj,Synology,RackCorp,Qiniu,Petabox", Examples: []fs.OptionExample{{ Value: "objects-us-east-1.dream.io", Help: "Dream Objects endpoint", @@ -1394,6 +1410,14 @@ func init() { Value: "s3.ir-tbz-sh1.arvanstorage.ir", Help: "ArvanCloud Tabriz Iran (Shahriar) endpoint", Provider: "ArvanCloud", + }, { + Value: "br-se1.magaluobjects.com", + Help: "Magalu BR Southeast 1 endpoint", + Provider: "Magalu", + }, { + Value: "br-se1.magaluobjects.com", + Help: "Magalu BR Northest 1 endpoint", + Provider: "Magalu", }}, }, { Name: "location_constraint", @@ -1776,7 +1800,7 @@ func init() { }, { Name: "location_constraint", Help: "Location constraint - must be set to match the Region.\n\nLeave blank if not sure. Used when creating buckets only.", - Provider: "!AWS,Alibaba,ArvanCloud,HuaweiOBS,ChinaMobile,Cloudflare,IBMCOS,IDrive,IONOS,Leviia,Liara,Linode,Qiniu,RackCorp,Scaleway,StackPath,Storj,TencentCOS,Petabox", + Provider: "!AWS,Alibaba,ArvanCloud,HuaweiOBS,ChinaMobile,Cloudflare,IBMCOS,IDrive,IONOS,Leviia,Liara,Linode,Magalu,Qiniu,RackCorp,Scaleway,StackPath,Storj,TencentCOS,Petabox", }, { Name: "acl", Help: `Canned ACL used when creating buckets and storing or copying objects. @@ -2031,6 +2055,15 @@ If you leave it blank, this is calculated automatically from the sse_customer_ke Value: "STANDARD", Help: "Standard storage class", }}, + }, { + // Mapping from here: #todo + Name: "storage_class", + Help: "The storage class to use when storing new objects in Magalu.", + Provider: "Magalu", + Examples: []fs.OptionExample{{ + Value: "STANDARD", + Help: "Standard storage class", + }}, }, { // Mapping from here: https://intl.cloud.tencent.com/document/product/436/30925 Name: "storage_class", @@ -3173,6 +3206,12 @@ func setQuirks(opt *Options) { case "LyveCloud": useMultipartEtag = false // LyveCloud seems to calculate multipart Etags differently from AWS useAlreadyExists = false // untested + case "Magalu": + listObjectsV2 = false + virtualHostStyle = false + urlEncodeListings = false + useMultipartEtag = false + useAlreadyExists = false case "Minio": virtualHostStyle = false case "Netease": diff --git a/docs/content/_index.md b/docs/content/_index.md index 4b6af4663..1a535220f 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -141,6 +141,7 @@ WebDAV or S3, that work out of the box.) {{< provider name="Liara Object Storage" home="https://liara.ir/landing/object-storage" config="/s3/#liara-object-storage" >}} {{< provider name="Linkbox" home="https://linkbox.to/" config="/linkbox/" >}} {{< provider name="Linode Object Storage" home="https://www.linode.com/products/object-storage/" config="/s3/#linode" >}} +{{< provider name="Magalu" home="https://magalu.cloud/object-storage/" config="/s3/#magalu" >}} {{< provider name="Mail.ru Cloud" home="https://cloud.mail.ru/" config="/mailru/" >}} {{< provider name="Memset Memstore" home="https://www.memset.com/cloud/storage/" config="/swift/" >}} {{< provider name="Mega" home="https://mega.nz/" config="/mega/" >}} diff --git a/docs/content/s3.md b/docs/content/s3.md index 1d913727b..69f53a540 100644 --- a/docs/content/s3.md +++ b/docs/content/s3.md @@ -25,6 +25,7 @@ The S3 backend can be used with a number of different providers: {{< provider name="Leviia Object Storage" home="https://www.leviia.com/object-storage/" config="/s3/#leviia" >}} {{< provider name="Liara Object Storage" home="https://liara.ir/landing/object-storage" config="/s3/#liara-cloud" >}} {{< provider name="Linode Object Storage" home="https://www.linode.com/products/object-storage/" config="/s3/#linode" >}} +{{< provider name="Magalu Object Storage" home="https://magalu.cloud/object-storage/" config="/s3/#magalu" >}} {{< provider name="Minio" home="https://www.minio.io/" config="/s3/#minio" >}} {{< provider name="Petabox" home="https://petabox.io/" config="/s3/#petabox" >}} {{< provider name="Qiniu Cloud Object Storage (Kodo)" home="https://www.qiniu.com/en/products/kodo" config="/s3/#qiniu" >}} @@ -2305,7 +2306,7 @@ Option Storage. Type of storage to configure. Choose a number from below, or type in your own value. ... -XX / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Synology, Tencent COS and Wasabi +XX / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, Lyve Cloud, Minio, Magalu, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Synology, Tencent COS and Wasabi \ (s3) ... Storage> s3 @@ -4389,6 +4390,123 @@ secret_access_key = SECRET_ACCESS_KEY endpoint = eu-central-1.linodeobjects.com ``` +### Magalu {#magalu} + +Here is an example of making a [Magalu Object Storage](https://magalu.cloud/object-storage/) +configuration. First run: + + rclone config + +This will guide you through an interactive setup process. + +``` +No remotes found, make a new one? +n) New remote +s) Set configuration password +q) Quit config +n/s/q> n + +Enter name for new remote. +name> magalu + +Option Storage. +Type of storage to configure. +Choose a number from below, or type in your own value. +[snip] +XX / Amazon S3 Compliant Storage Providers including AWS, ...Magalu, ...and others + \ (s3) +[snip] +Storage> s3 + +Option provider. +Choose your S3 provider. +Choose a number from below, or type in your own value. +Press Enter to leave empty. +[snip] +XX / Magalu Object Storage + \ (Magalu) +[snip] +provider> Magalu + +Option env_auth. +Get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars). +Only applies if access_key_id and secret_access_key is blank. +Choose a number from below, or type in your own boolean value (true or false). +Press Enter for the default (false). + 1 / Enter AWS credentials in the next step. + \ (false) + 2 / Get AWS credentials from the environment (env vars or IAM). + \ (true) +env_auth> 1 + +Option access_key_id. +AWS Access Key ID. +Leave blank for anonymous access or runtime credentials. +Enter a value. Press Enter to leave empty. +access_key_id> ACCESS_KEY + +Option secret_access_key. +AWS Secret Access Key (password). +Leave blank for anonymous access or runtime credentials. +Enter a value. Press Enter to leave empty. +secret_access_key> SECRET_ACCESS_KEY + +Option endpoint. +Endpoint for Magalu Object Storage API. +Choose a number from below, or type in your own value. +Press Enter to leave empty. + 1 / São Paulo, SP (BR), br-se1 + \ (br-se1.magaluobjects.com) + 2 / Fortaleza, CE (BR), br-ne1 + \ (br-ne1.magaluobjects.com) +endpoint> 2 + +Option acl. +Canned ACL used when creating buckets and storing or copying objects. +This ACL is used for creating objects and if bucket_acl isn't set, for creating buckets too. +For more info visit https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl +Note that this ACL is applied when server-side copying objects as S3 +doesn't copy the ACL from the source but rather writes a fresh one. +If the acl is an empty string then no X-Amz-Acl: header is added and +the default (private) will be used. +Choose a number from below, or type in your own value. +Press Enter to leave empty. + / Owner gets FULL_CONTROL. + 1 | No one else has access rights (default). + \ (private) +[snip] +acl> + +Edit advanced config? +y) Yes +n) No (default) +y/n> n + +Configuration complete. +Options: +- type: s3 +- provider: magalu +- access_key_id: ACCESS_KEY +- secret_access_key: SECRET_ACCESS_KEY +- endpoint: br-ne1.magaluobjects.com +Keep this "magalu" remote? +y) Yes this is OK (default) +e) Edit this remote +d) Delete this remote +y/e/d> y +``` + +This will leave the config file looking like this. + +``` +[magalu] +type = s3 +provider = Magalu +access_key_id = ACCESS_KEY +secret_access_key = SECRET_ACCESS_KEY +endpoint = br-ne1.magaluobjects.com +``` + ### ArvanCloud {#arvan-cloud} [ArvanCloud](https://www.arvancloud.com/en/products/cloud-storage) ArvanCloud Object Storage goes beyond the limited traditional file storage.