1 Star 0 Fork 0

powerpaas/machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
utils.go 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
Simon Thulbourn 提交于 2015-01-23 22:39 . Adds region defaults
package amazonec2
import (
"errors"
)
var (
errInvalidRegion = errors.New("invalid region specified")
errNoVpcs = errors.New("No VPCs found in region")
errMachineFailure = errors.New("Machine failed to start")
errNoIP = errors.New("No IP Address associated with the instance")
errComplete = errors.New("Complete")
)
type region struct {
AmiId string
}
var regionDetails map[string]*region = map[string]*region{
"ap-northeast-1": {"ami-44f1e245"},
"ap-southeast-1": {"ami-f95875ab"},
"ap-southeast-2": {"ami-890b62b3"},
"cn-north-1": {"ami-fe7ae8c7"},
"eu-west-1": {"ami-823686f5"},
"eu-central-1": {"ami-ac1524b1"},
"sa-east-1": {"ami-c770c1da"},
"us-east-1": {"ami-4ae27e22"},
"us-west-1": {"ami-d1180894"},
"us-west-2": {"ami-898dd9b9"},
"us-gov-west-1": {"ami-cf5630ec"},
}
func awsRegionsList() []string {
var list []string
for k := range regionDetails {
list = append(list, k)
}
return list
}
func validateAwsRegion(region string) (string, error) {
for _, v := range awsRegionsList() {
if v == region {
return region, nil
}
}
return "", errInvalidRegion
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/powerpaas/machine.git
git@gitee.com:powerpaas/machine.git
powerpaas
machine
machine
v0.2.0-rc2

搜索帮助