github.com/aldelo/common@v1.5.1/wrapper/aws/awsregion/awsregion.go (about) 1 package awsregion 2 3 import "strings" 4 5 /* 6 * Copyright 2020-2023 Aldelo, LP 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 // DO NOT EDIT - auto generated via tool 22 23 // go:generate gen-enumer -type AWSRegion 24 25 type AWSRegion int 26 27 const ( 28 UNKNOWN AWSRegion = 0 29 30 AWS_us_west_2_oregon AWSRegion = 1 31 AWS_us_east_1_nvirginia AWSRegion = 2 32 AWS_eu_west_2_london AWSRegion = 3 33 AWS_eu_central_1_frankfurt AWSRegion = 4 34 AWS_ap_southeast_1_singapore AWSRegion = 5 35 AWS_ap_east_1_hongkong AWSRegion = 6 36 AWS_ap_northeast_1_tokyo AWSRegion = 7 37 AWS_ap_southeast_2_sydney AWSRegion = 8 38 ) 39 40 // https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html 41 func GetAwsRegion(regionStr string) AWSRegion { 42 switch strings.ToLower(regionStr) { 43 case "us-west-2": 44 return AWS_us_west_2_oregon 45 case "us-east-1": 46 return AWS_us_east_1_nvirginia 47 case "eu-west-2": 48 return AWS_eu_west_2_london 49 case "eu-central-1": 50 return AWS_eu_central_1_frankfurt 51 case "ap-southeast-1": 52 return AWS_ap_southeast_1_singapore 53 case "ap-east-1": 54 return AWS_ap_east_1_hongkong 55 case "ap-northeast-1": 56 return AWS_ap_northeast_1_tokyo 57 case "ap-southeast-2": 58 return AWS_ap_southeast_2_sydney 59 default: 60 return UNKNOWN 61 } 62 } 63 64 const ( 65 _AWSRegionKey_0 = "UNKNOWN" 66 _AWSRegionKey_1 = "us-west-2" 67 _AWSRegionKey_2 = "us-east-1" 68 _AWSRegionKey_3 = "eu-west-2" 69 _AWSRegionKey_4 = "eu-central-1" 70 _AWSRegionKey_5 = "ap-southeast-1" 71 _AWSRegionKey_6 = "ap-east-1" 72 _AWSRegionKey_7 = "ap-northeast-1" 73 _AWSRegionKey_8 = "ap-southeast-2" 74 ) 75 76 const ( 77 _AWSRegionCaption_0 = "UNKNOWN" 78 _AWSRegionCaption_1 = "AWS_us_west_2_oregon" 79 _AWSRegionCaption_2 = "AWS_us_east_1_nvirginia" 80 _AWSRegionCaption_3 = "AWS_eu_west_2_london" 81 _AWSRegionCaption_4 = "AWS_eu_central_1_frankfurt" 82 _AWSRegionCaption_5 = "AWS_ap_southeast_1_singapore" 83 _AWSRegionCaption_6 = "AWS_ap_east_1_hongkong" 84 _AWSRegionCaption_7 = "AWS_ap_northeast_1_tokyo" 85 _AWSRegionCaption_8 = "AWS_ap_southeast_2_sydney" 86 ) 87 88 const ( 89 _AWSRegionDescription_0 = "UNKNOWN" 90 _AWSRegionDescription_1 = "AWS_us_west_2_oregon" 91 _AWSRegionDescription_2 = "AWS_us_east_1_nvirginia" 92 _AWSRegionDescription_3 = "AWS_eu_west_2_london" 93 _AWSRegionDescription_4 = "AWS_eu_central_1_frankfurt" 94 _AWSRegionDescription_5 = "AWS_ap_southeast_1_singapore" 95 _AWSRegionDescription_6 = "AWS_ap_east_1_hongkong" 96 _AWSRegionDescription_7 = "AWS_ap_northeast_1_tokyo" 97 _AWSRegionDescription_8 = "AWS_ap_southeast_2_sydney" 98 )