github.com/kyma-project/kyma-environment-broker@v0.0.1/common/hyperscaler/azure/config.go (about)

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