s3-endpoints.go (3006B)
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 18 package minio 19 20 // awsS3EndpointMap Amazon S3 endpoint map. 21 var awsS3EndpointMap = map[string]string{ 22 "us-east-1": "s3.dualstack.us-east-1.amazonaws.com", 23 "us-east-2": "s3.dualstack.us-east-2.amazonaws.com", 24 "us-west-2": "s3.dualstack.us-west-2.amazonaws.com", 25 "us-west-1": "s3.dualstack.us-west-1.amazonaws.com", 26 "ca-central-1": "s3.dualstack.ca-central-1.amazonaws.com", 27 "eu-west-1": "s3.dualstack.eu-west-1.amazonaws.com", 28 "eu-west-2": "s3.dualstack.eu-west-2.amazonaws.com", 29 "eu-west-3": "s3.dualstack.eu-west-3.amazonaws.com", 30 "eu-central-1": "s3.dualstack.eu-central-1.amazonaws.com", 31 "eu-central-2": "s3.dualstack.eu-central-2.amazonaws.com", 32 "eu-north-1": "s3.dualstack.eu-north-1.amazonaws.com", 33 "eu-south-1": "s3.dualstack.eu-south-1.amazonaws.com", 34 "eu-south-2": "s3.dualstack.eu-south-2.amazonaws.com", 35 "ap-east-1": "s3.dualstack.ap-east-1.amazonaws.com", 36 "ap-south-1": "s3.dualstack.ap-south-1.amazonaws.com", 37 "ap-south-2": "s3.dualstack.ap-south-2.amazonaws.com", 38 "ap-southeast-1": "s3.dualstack.ap-southeast-1.amazonaws.com", 39 "ap-southeast-2": "s3.dualstack.ap-southeast-2.amazonaws.com", 40 "ap-northeast-1": "s3.dualstack.ap-northeast-1.amazonaws.com", 41 "ap-northeast-2": "s3.dualstack.ap-northeast-2.amazonaws.com", 42 "ap-northeast-3": "s3.dualstack.ap-northeast-3.amazonaws.com", 43 "af-south-1": "s3.dualstack.af-south-1.amazonaws.com", 44 "me-central-1": "s3.dualstack.me-central-1.amazonaws.com", 45 "me-south-1": "s3.dualstack.me-south-1.amazonaws.com", 46 "sa-east-1": "s3.dualstack.sa-east-1.amazonaws.com", 47 "us-gov-west-1": "s3.dualstack.us-gov-west-1.amazonaws.com", 48 "us-gov-east-1": "s3.dualstack.us-gov-east-1.amazonaws.com", 49 "cn-north-1": "s3.dualstack.cn-north-1.amazonaws.com.cn", 50 "cn-northwest-1": "s3.dualstack.cn-northwest-1.amazonaws.com.cn", 51 "ap-southeast-3": "s3.dualstack.ap-southeast-3.amazonaws.com", 52 "ap-southeast-4": "s3.dualstack.ap-southeast-4.amazonaws.com", 53 } 54 55 // getS3Endpoint get Amazon S3 endpoint based on the bucket location. 56 func getS3Endpoint(bucketLocation string) (s3Endpoint string) { 57 s3Endpoint, ok := awsS3EndpointMap[bucketLocation] 58 if !ok { 59 // Default to 's3.dualstack.us-east-1.amazonaws.com' endpoint. 60 s3Endpoint = "s3.dualstack.us-east-1.amazonaws.com" 61 } 62 return s3Endpoint 63 }