From f4d7e41f241217981a4965200f69a298438651e7 Mon Sep 17 00:00:00 2001 From: Vincent Feltz Date: Fri, 12 Jun 2020 17:04:16 +0200 Subject: [PATCH] s3: add Scaleway provider - fixes #4338 --- backend/s3/s3.go | 51 ++++++++++++++++++++++++++++++++++++++++++---- docs/content/s3.md | 2 +- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index e55d85ecd..d287375c2 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -96,6 +96,9 @@ func init() { }, { Value: "Netease", Help: "Netease Object Storage (NOS)", + }, { + Value: "Scaleway", + Help: "Scaleway Object Storage", }, { Value: "StackPath", Help: "StackPath Object Storage", @@ -176,10 +179,21 @@ func init() { Value: "sa-east-1", Help: "South America (Sao Paulo) Region\nNeeds location constraint sa-east-1.", }}, + }, { + Name: "region", + Help: "Region to connect to.", + Provider: "Scaleway", + Examples: []fs.OptionExample{{ + Value: "nl-ams", + Help: "Amsterdam, The Netherlands", + }, { + Value: "fr-par", + Help: "Paris, France", + }}, }, { Name: "region", Help: "Region to connect to.\nLeave blank if you are using an S3 clone and you don't have a region.", - Provider: "!AWS,Alibaba", + Provider: "!AWS,Alibaba,Scaleway", Examples: []fs.OptionExample{{ Value: "", Help: "Use this if unsure. Will use v4 signatures and an empty region.", @@ -361,6 +375,17 @@ func init() { Value: "oss-me-east-1.aliyuncs.com", Help: "Middle East 1 (Dubai)", }}, + }, { + Name: "endpoint", + Help: "Endpoint for Scaleway Object Storage.", + Provider: "Scaleway", + Examples: []fs.OptionExample{{ + Value: "s3.nl-ams.scw.cloud", + Help: "Amsterdam Endpoint", + }, { + Value: "s3.fr-par.scw.cloud", + Help: "Paris Endpoint", + }}, }, { Name: "endpoint", Help: "Endpoint for StackPath Object Storage.", @@ -378,7 +403,7 @@ func init() { }, { Name: "endpoint", Help: "Endpoint for S3 API.\nRequired when using an S3 clone.", - Provider: "!AWS,IBMCOS,Alibaba,StackPath", + Provider: "!AWS,IBMCOS,Alibaba,Scaleway,StackPath", Examples: []fs.OptionExample{{ Value: "objects-us-east-1.dream.io", Help: "Dream Objects endpoint", @@ -565,7 +590,7 @@ func init() { }, { Name: "location_constraint", Help: "Location constraint - must be set to match the Region.\nLeave blank if not sure. Used when creating buckets only.", - Provider: "!AWS,IBMCOS,Alibaba,StackPath", + Provider: "!AWS,IBMCOS,Alibaba,Scaleway,StackPath", }, { Name: "acl", Help: `Canned ACL used when creating buckets and storing or copying objects. @@ -741,6 +766,21 @@ isn't set then "acl" is used instead.`, Value: "STANDARD_IA", Help: "Infrequent access storage mode.", }}, + }, { + // Mapping from here: https://www.scaleway.com/en/docs/object-storage-glacier/#-Scaleway-Storage-Classes + Name: "storage_class", + Help: "The storage class to use when storing new objects in S3.", + Provider: "Scaleway", + Examples: []fs.OptionExample{{ + Value: "", + Help: "Default", + }, { + Value: "STANDARD", + Help: "The Standard class for any upload; suitable for on-demand content like streaming or CDN.", + }, { + Value: "GLACIER", + Help: "Archived storage; prices are lower, but it needs to be restored first to be accessed.", + }}, }, { Name: "upload_cutoff", Help: `Cutoff for switching to chunked upload @@ -1149,9 +1189,12 @@ func s3Connection(opt *Options) (*s3.S3, *session.Session, error) { if opt.Region == "" { opt.Region = "us-east-1" } - if opt.Provider == "AWS" || opt.Provider == "Alibaba" || opt.Provider == "Netease" || opt.UseAccelerateEndpoint { + if opt.Provider == "AWS" || opt.Provider == "Alibaba" || opt.Provider == "Netease" || opt.Provider == "Scaleway" || opt.UseAccelerateEndpoint { opt.ForcePathStyle = false } + if opt.Provider == "Scaleway" && opt.MaxUploadParts > 1000 { + opt.MaxUploadParts = 1000 + } awsConfig := aws.NewConfig(). WithMaxRetries(0). // Rely on rclone's retry logic WithCredentials(cred). diff --git a/docs/content/s3.md b/docs/content/s3.md index 25d26e363..6d585264f 100644 --- a/docs/content/s3.md +++ b/docs/content/s3.md @@ -1675,6 +1675,7 @@ Scaleway provides an S3 interface which can be configured for use with rclone li ``` [scaleway] type = s3 +provider = Scaleway env_auth = false endpoint = s3.nl-ams.scw.cloud access_key_id = SCWXXXXXXXXXXXXXX @@ -1682,7 +1683,6 @@ secret_access_key = 1111111-2222-3333-44444-55555555555555 region = nl-ams location_constraint = acl = private -force_path_style = false server_side_encryption = storage_class = ```