forked from kyma-project/control-plane
/
config.go
71 lines (63 loc) · 1.96 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package azure
import (
"github.com/Azure/go-autorest/autorest/azure"
"github.com/pkg/errors"
)
type Config struct {
clientID string
clientSecret string
tenantID string
subscriptionID string
location string
authorizationServerURL string
userAgent string
cloudName string
keepResources bool
environment *azure.Environment
}
func NewDefaultConfig() *Config {
return &Config{
userAgent: "kyma-environment-broker",
cloudName: "AzurePublicCloud",
keepResources: false,
}
}
func (c *Config) GetLocation() string {
return c.location
}
func (c *Config) Environment() (*azure.Environment, error) {
if c.environment != nil {
return c.environment, nil
}
env, err := azure.EnvironmentFromName(c.cloudName)
if err != nil {
return nil, errors.Wrapf(err, "while creating azure environment - invalid cloud name [%s]", c.cloudName)
}
c.environment = &env
return c.environment, nil
}
// see internal/broker/plans.go for list of available gcp regions
func gcpToAzureRegionMapping() map[string]string {
return map[string]string{
"asia-east1": "westeurope",
"asia-east2": "westeurope",
"asia-northeast1": "westeurope",
"asia-northeast2": "westeurope",
"asia-south1": "westeurope",
"asia-southeast1": "westeurope",
"australia-southeast1": "westeurope",
"europe-north1": "westeurope",
"europe-west1": "westeurope",
"europe-west2": "westeurope",
"europe-west3": "westeurope",
"europe-west4": "westeurope",
"europe-west6": "westeurope",
"northamerica-northeast1": "westus2",
"southamerica-east1": "westus2",
"us-central1": "westus2",
"us-east1": "westus2",
"us-east4": "westus2",
"us-west1": "westus2",
"us-west2": "westus2",
}
}