From f226f2dfb1eefdfd0fa044dd319ba81443d9eece Mon Sep 17 00:00:00 2001 From: Andrei Smirnov Date: Fri, 5 May 2023 11:44:25 +0300 Subject: [PATCH] s3: add petabox.io to s3 providers --- README.md | 1 + backend/s3/s3.go | 57 ++++++++++++++- docs/content/_index.md | 1 + docs/content/s3.md | 161 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 216 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6ecaf766d..57ae36cc8 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ Rclone *("rsync for cloud storage")* is a command-line program to sync files and * Oracle Object Storage [:page_facing_up:](https://rclone.org/oracleobjectstorage/) * ownCloud [:page_facing_up:](https://rclone.org/webdav/#owncloud) * pCloud [:page_facing_up:](https://rclone.org/pcloud/) + * Petabox [:page_facing_up:](https://rclone.org/s3/#petabox) * PikPak [:page_facing_up:](https://rclone.org/pikpak/) * premiumize.me [:page_facing_up:](https://rclone.org/premiumizeme/) * put.io [:page_facing_up:](https://rclone.org/putio/) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index b1f284107..e6cf4eea1 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -66,7 +66,7 @@ import ( func init() { fs.Register(&fs.RegInfo{ Name: "s3", - Description: "Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, GCS, ArvanCloud, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Liara, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi", + Description: "Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, GCS, ArvanCloud, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Liara, Lyve Cloud, Minio, Netease, Petabox, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi", NewFs: NewFs, CommandHelp: commandHelp, Config: func(ctx context.Context, name string, m configmap.Mapper, config fs.ConfigIn) (*fs.ConfigOut, error) { @@ -136,6 +136,9 @@ func init() { }, { Value: "Netease", Help: "Netease Object Storage (NOS)", + }, { + Value: "Petabox", + Help: "Petabox Object Storage", }, { Value: "RackCorp", Help: "RackCorp Object Storage", @@ -440,10 +443,30 @@ func init() { Value: "eu-south-2", Help: "Logrono, Spain", }}, + }, { + Name: "region", + Help: "Region where your bucket will be created and your data stored.\n", + Provider: "Petabox", + Examples: []fs.OptionExample{{ + Value: "us-east-1", + Help: "US East (N. Virginia)", + }, { + Value: "eu-central-1", + Help: "Europe (Frankfurt)", + }, { + Value: "ap-southeast-1", + Help: "Asia Pacific (Singapore)", + }, { + Value: "me-south-1", + Help: "Middle East (Bahrain)", + }, { + Value: "sa-east-1", + Help: "South America (São Paulo)", + }}, }, { 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,ChinaMobile,Cloudflare,IONOS,ArvanCloud,Liara,Qiniu,RackCorp,Scaleway,Storj,TencentCOS,HuaweiOBS,IDrive", + Provider: "!AWS,Alibaba,ChinaMobile,Cloudflare,IONOS,Petabox,ArvanCloud,Liara,Qiniu,RackCorp,Scaleway,Storj,TencentCOS,HuaweiOBS,IDrive", Examples: []fs.OptionExample{{ Value: "", Help: "Use this if unsure.\nWill use v4 signatures and an empty region.", @@ -768,6 +791,30 @@ func init() { Value: "s3-eu-south-2.ionoscloud.com", Help: "Logrono, Spain", }}, + }, { + Name: "endpoint", + Help: "Endpoint for Petabox S3 Object Storage.\n\nSpecify the endpoint from the same region.", + Provider: "Petabox", + Required: true, + Examples: []fs.OptionExample{{ + Value: "s3.petabox.io", + Help: "US East (N. Virginia)", + }, { + Value: "s3.us-east-1.petabox.io", + Help: "US East (N. Virginia)", + }, { + Value: "s3.eu-central-1.petabox.io", + Help: "Europe (Frankfurt)", + }, { + Value: "s3.ap-southeast-1.petabox.io", + Help: "Asia Pacific (Singapore)", + }, { + Value: "s3.me-south-1.petabox.io", + Help: "Middle East (Bahrain)", + }, { + Value: "s3.sa-east-1.petabox.io", + Help: "South America (São Paulo)", + }}, }, { // Liara endpoints: https://liara.ir/landing/object-storage Name: "endpoint", @@ -1109,7 +1156,7 @@ func init() { }, { Name: "endpoint", Help: "Endpoint for S3 API.\n\nRequired when using an S3 clone.", - Provider: "!AWS,IBMCOS,IDrive,IONOS,TencentCOS,HuaweiOBS,Alibaba,ChinaMobile,GCS,Liara,ArvanCloud,Scaleway,StackPath,Storj,RackCorp,Qiniu", + Provider: "!AWS,IBMCOS,IDrive,IONOS,TencentCOS,HuaweiOBS,Alibaba,ChinaMobile,GCS,Liara,ArvanCloud,Scaleway,StackPath,Storj,RackCorp,Qiniu,Petabox", Examples: []fs.OptionExample{{ Value: "objects-us-east-1.dream.io", Help: "Dream Objects endpoint", @@ -1593,7 +1640,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,HuaweiOBS,ChinaMobile,Cloudflare,IBMCOS,IDrive,IONOS,Liara,ArvanCloud,Qiniu,RackCorp,Scaleway,StackPath,Storj,TencentCOS", + Provider: "!AWS,Alibaba,HuaweiOBS,ChinaMobile,Cloudflare,IBMCOS,IDrive,IONOS,Liara,ArvanCloud,Qiniu,RackCorp,Scaleway,StackPath,Storj,TencentCOS,Petabox", }, { Name: "acl", Help: `Canned ACL used when creating buckets and storing or copying objects. @@ -2881,6 +2928,8 @@ func setQuirks(opt *Options) { // listObjectsV2 supported - https://api.ionos.com/docs/s3/#Basic-Operations-get-Bucket-list-type-2 virtualHostStyle = false urlEncodeListings = false + case "Petabox": + // No quirks case "Liara": virtualHostStyle = false urlEncodeListings = false diff --git a/docs/content/_index.md b/docs/content/_index.md index a3539fa6e..97b473e56 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -152,6 +152,7 @@ WebDAV or S3, that work out of the box.) {{< provider name="Oracle Object Storage" home="https://www.oracle.com/cloud/storage/object-storage" config="/oracleobjectstorage/" >}} {{< provider name="ownCloud" home="https://owncloud.org/" config="/webdav/#owncloud" >}} {{< provider name="pCloud" home="https://www.pcloud.com/" config="/pcloud/" >}} +{{< provider name="Petabox" home="https://petabox.io/" config="/s3/#petabox" >}} {{< provider name="PikPak" home="https://mypikpak.com/" config="/pikpak/" >}} {{< provider name="premiumize.me" home="https://premiumize.me/" config="/premiumizeme/" >}} {{< provider name="put.io" home="https://put.io/" config="/putio/" >}} diff --git a/docs/content/s3.md b/docs/content/s3.md index 0452bfa88..8ab7e41b1 100644 --- a/docs/content/s3.md +++ b/docs/content/s3.md @@ -24,6 +24,7 @@ The S3 backend can be used with a number of different providers: {{< provider name="IONOS Cloud" home="https://cloud.ionos.com/storage/object-storage" config="/s3/#ionos" >}} {{< provider name="Liara Object Storage" home="https://liara.ir/landing/object-storage" config="/s3/#liara-cloud" >}} {{< 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" >}} {{< provider name="RackCorp Object Storage" home="https://www.rackcorp.com/" config="/s3/#RackCorp" >}} {{< provider name="Scaleway" home="https://www.scaleway.com/en/object-storage/" config="/s3/#scaleway" >}} @@ -5362,6 +5363,166 @@ For Netease NOS configure as per the configurator `rclone config` setting the provider `Netease`. This will automatically set `force_path_style = false` which is necessary for it to run properly. +### Petabox + +Here is an example of making a [Petabox](https://petabox.io/) +configuration. First run: + +```bash +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 +n/s> n + +Enter name for new remote. +name> My Petabox Storage + +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, ... + \ "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 / Petabox Object Storage + \ (Petabox) +[snip] +provider> Petabox + +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> YOUR_ACCESS_KEY_ID + +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> YOUR_SECRET_ACCESS_KEY + +Option region. +Region where your bucket will be created and your data stored. +Choose a number from below, or type in your own value. +Press Enter to leave empty. + 1 / US East (N. Virginia) + \ (us-east-1) + 2 / Europe (Frankfurt) + \ (eu-central-1) + 3 / Asia Pacific (Singapore) + \ (ap-southeast-1) + 4 / Middle East (Bahrain) + \ (me-south-1) + 5 / South America (São Paulo) + \ (sa-east-1) +region> 1 + +Option endpoint. +Endpoint for Petabox S3 Object Storage. +Specify the endpoint from the same region. +Choose a number from below, or type in your own value. + 1 / US East (N. Virginia) + \ (s3.petabox.io) + 2 / US East (N. Virginia) + \ (s3.us-east-1.petabox.io) + 3 / Europe (Frankfurt) + \ (s3.eu-central-1.petabox.io) + 4 / Asia Pacific (Singapore) + \ (s3.ap-southeast-1.petabox.io) + 5 / Middle East (Bahrain) + \ (s3.me-south-1.petabox.io) + 6 / South America (São Paulo) + \ (s3.sa-east-1.petabox.io) +endpoint> 1 + +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) + / Owner gets FULL_CONTROL. + 2 | The AllUsers group gets READ access. + \ (public-read) + / Owner gets FULL_CONTROL. + 3 | The AllUsers group gets READ and WRITE access. + | Granting this on a bucket is generally not recommended. + \ (public-read-write) + / Owner gets FULL_CONTROL. + 4 | The AuthenticatedUsers group gets READ access. + \ (authenticated-read) + / Object owner gets FULL_CONTROL. + 5 | Bucket owner gets READ access. + | If you specify this canned ACL when creating a bucket, Amazon S3 ignores it. + \ (bucket-owner-read) + / Both the object owner and the bucket owner get FULL_CONTROL over the object. + 6 | If you specify this canned ACL when creating a bucket, Amazon S3 ignores it. + \ (bucket-owner-full-control) +acl> 1 + +Edit advanced config? +y) Yes +n) No (default) +y/n> No + +Configuration complete. +Options: +- type: s3 +- provider: Petabox +- access_key_id: YOUR_ACCESS_KEY_ID +- secret_access_key: YOUR_SECRET_ACCESS_KEY +- region: us-east-1 +- endpoint: s3.petabox.io +Keep this "My Petabox Storage" 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. + +``` +[My Petabox Storage] +type = s3 +provider = Petabox +access_key_id = YOUR_ACCESS_KEY_ID +secret_access_key = YOUR_SECRET_ACCESS_KEY +region = us-east-1 +endpoint = s3.petabox.io +``` + ### Storj Storj is a decentralized cloud storage which can be used through its