Open d3cxxxx opened 1 year ago
Here is the updated list (updated RegionInfo.kt file in app/src/main/java/com/alexsci/android/lambdarunner/aws/ folder). I don't know how to create a PR on github, hence pasting the file here. This code fixes #5.
`package com.alexsci.android.lambdarunner.aws
import java.lang.RuntimeException import java.util.*
class RegionInfo { companion object { private const val ALL_REGIONS_GROUP = "All Regions"
private val displayNames: Map<String, Map<String, String>> = mapOf(
"United States" to mapOf(
"us-east-1" to "N. Virginia",
"us-east-2" to "Ohio",
"us-west-1" to "N. California",
"us-west-2" to "Oregon"
),
"Africa" to mapOf(
"af-south-1" to "Cape Town"
),
"Asia Pacific" to mapOf(
"ap-east-1" to "Hong Kong",
"ap-south-1" to "Mumbai",
"ap-south-2" to "Hyderabad",
"ap-southeast-1" to "Singapore",
"ap-southeast-2" to "Sydney",
"ap-southeast-3" to "Jakarta",
"ap-northeast-1" to "Tokyo",
"ap-northeast-2" to "Seoul",
"ap-northeast-3" to "Osaka"
),
"Canada" to mapOf(
"ca-central-1" to "Montreal"
),
"China" to mapOf(
"cn-north-1" to "Beijing"
),
"Middle East" to mapOf(
"me-south-1" to "Bahrain",
"me-central-1" to "UAE"
),
"European Union" to mapOf(
"eu-west-1" to "Ireland",
"eu-west-2" to "London",
"eu-west-3" to "Paris",
"eu-south-1" to "Milan",
"eu-south-2" to "Spain",
"eu-north-1" to "Stockholm",
"eu-central-1" to "Frankfurt",
"eu-central-2" to "Zurich"
),
"GovCloud" to mapOf(
"us-gov-east-1" to "US-East",
"us-gov-west-1" to "Northwest"
),
"South America" to mapOf(
"sa-east-1" to "Saõ Paulo"
)
)
fun groups(): Array<String> {
return arrayOf(ALL_REGIONS_GROUP).plus(displayNames.keys.toTypedArray())
}
fun groupForCode(regionCode: String): String {
for (item in displayNames) {
if (item.value.containsKey(regionCode)) {
return item.key
}
}
throw RuntimeException("Unexpected region $regionCode")
}
fun displayNameForCode(regionCode: String): String {
for (item in displayNames) {
val displayName = item.value[regionCode]
if (displayName != null) {
return displayName
}
}
throw RuntimeException("Unexpected region $regionCode")
}
fun regionCodesForRegionGroup(groupName: String): Array<String> {
if (! displayNames.containsKey(groupName)) {
val res = LinkedList<String>()
for (groupInfo in displayNames.values) {
res.addAll(groupInfo.keys)
}
return res.toTypedArray().sortedArray()
} else {
return displayNames[groupName]!!.keys.toTypedArray()
}
}
}
} `
AWS now supports more regions than what is listed in the project. The updated list can be found at: https://docs.aws.amazon.com/general/latest/gr/lambda-service.html