s3-endpoints.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * MinIO Go Library for Amazon S3 Compatible Cloud Storage
  3. * Copyright 2015-2017 MinIO, Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package minio
  18. // awsS3EndpointMap Amazon S3 endpoint map.
  19. var awsS3EndpointMap = map[string]string{
  20. "us-east-1": "s3.dualstack.us-east-1.amazonaws.com",
  21. "us-east-2": "s3.dualstack.us-east-2.amazonaws.com",
  22. "us-west-2": "s3.dualstack.us-west-2.amazonaws.com",
  23. "us-west-1": "s3.dualstack.us-west-1.amazonaws.com",
  24. "ca-central-1": "s3.dualstack.ca-central-1.amazonaws.com",
  25. "eu-west-1": "s3.dualstack.eu-west-1.amazonaws.com",
  26. "eu-west-2": "s3.dualstack.eu-west-2.amazonaws.com",
  27. "eu-west-3": "s3.dualstack.eu-west-3.amazonaws.com",
  28. "eu-central-1": "s3.dualstack.eu-central-1.amazonaws.com",
  29. "eu-north-1": "s3.dualstack.eu-north-1.amazonaws.com",
  30. "eu-south-1": "s3.dualstack.eu-south-1.amazonaws.com",
  31. "ap-east-1": "s3.dualstack.ap-east-1.amazonaws.com",
  32. "ap-south-1": "s3.dualstack.ap-south-1.amazonaws.com",
  33. "ap-southeast-1": "s3.dualstack.ap-southeast-1.amazonaws.com",
  34. "ap-southeast-2": "s3.dualstack.ap-southeast-2.amazonaws.com",
  35. "ap-northeast-1": "s3.dualstack.ap-northeast-1.amazonaws.com",
  36. "ap-northeast-2": "s3.dualstack.ap-northeast-2.amazonaws.com",
  37. "ap-northeast-3": "s3.dualstack.ap-northeast-3.amazonaws.com",
  38. "af-south-1": "s3.dualstack.af-south-1.amazonaws.com",
  39. "me-south-1": "s3.dualstack.me-south-1.amazonaws.com",
  40. "sa-east-1": "s3.dualstack.sa-east-1.amazonaws.com",
  41. "us-gov-west-1": "s3.dualstack.us-gov-west-1.amazonaws.com",
  42. "us-gov-east-1": "s3.dualstack.us-gov-east-1.amazonaws.com",
  43. "cn-north-1": "s3.dualstack.cn-north-1.amazonaws.com.cn",
  44. "cn-northwest-1": "s3.dualstack.cn-northwest-1.amazonaws.com.cn",
  45. }
  46. // getS3Endpoint get Amazon S3 endpoint based on the bucket location.
  47. func getS3Endpoint(bucketLocation string) (s3Endpoint string) {
  48. s3Endpoint, ok := awsS3EndpointMap[bucketLocation]
  49. if !ok {
  50. // Default to 's3.dualstack.us-east-1.amazonaws.com' endpoint.
  51. s3Endpoint = "s3.dualstack.us-east-1.amazonaws.com"
  52. }
  53. return s3Endpoint
  54. }