packer-cn/vendor/github.com/oracle/oci-go-sdk/common/common.go

44 lines
929 B
Go
Raw Normal View History

2018-04-11 05:20:07 -04:00
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
package common
import (
"strings"
)
//Region type for regions
type Region string
const (
//RegionSEA region SEA
RegionSEA Region = "sea"
//RegionPHX region PHX
RegionPHX Region = "us-phoenix-1"
//RegionIAD region IAD
RegionIAD Region = "us-ashburn-1"
//RegionFRA region FRA
RegionFRA Region = "eu-frankfurt-1"
2018-07-16 11:49:08 -04:00
//RegionLHR region LHR
RegionLHR Region = "uk-london-1"
2018-04-11 05:20:07 -04:00
)
//StringToRegion convert a string to Region type
func StringToRegion(stringRegion string) (r Region) {
switch strings.ToLower(stringRegion) {
case "sea":
r = RegionSEA
case "phx", "us-phoenix-1":
r = RegionPHX
case "iad", "us-ashburn-1":
r = RegionIAD
case "fra", "eu-frankfurt-1":
r = RegionFRA
2018-07-16 11:49:08 -04:00
case "lhr", "uk-london-1":
r = RegionLHR
2018-04-11 05:20:07 -04:00
default:
r = Region(stringRegion)
Debugf("region named: %s, is not recognized", stringRegion)
}
return
}