Documentation ¶
Index ¶
- Constants
- Variables
- func AlphanumericFormatFunc(s string) string
- func GenerateHash(s string) string
- func GetAvailabilityZone(location commonpb.Location, az int, cloud commonpb.CloudProvider) (string, error)
- func GetCloudLocation(location commonpb.Location, provider commonpb.CloudProvider) (string, error)
- func GetResourceId(prefix string, cloud commonpb.CloudProvider) string
- func GetVmSize(s commonpb.VmSize_Enum, c commonpb.CloudProvider) (string, error)
- func LowercaseAlphanumericAndDashFormatFunc(s string) string
- func LowercaseAlphanumericFormatFunc(s string) string
- func ParseCloudFromResourceId(resourceId string) commonpb.CloudProvider
- func ParseVmSize(size string, c commonpb.CloudProvider) commonpb.VmSize_Enum
- func RandomString(n int) string
- func RemoveSpecialChars(a string) string
- func StringInSlice(a string, list []string) bool
- func UniqueId(prefix string, suffix string, formatFunc FormatFunc) string
- type AwsResource
- type AzResource
- type FormatFunc
- type GcpResource
Constants ¶
View Source
const ( AWS = commonpb.CloudProvider_AWS AZURE = commonpb.CloudProvider_AZURE GCP = commonpb.CloudProvider_GCP )
Variables ¶
View Source
var AVAILABILITY_ZONES = map[commonpb.Location]map[commonpb.CloudProvider][]string{ commonpb.Location_EU_WEST_1: { AWS: []string{"eu-west-1a", "eu-west-1b", "eu-west-1c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"europe-west1-b", "europe-west1-c", "europe-west1-d"}, }, commonpb.Location_EU_WEST_2: { AWS: []string{"eu-west-2a", "eu-west-2b", "eu-west-2c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"europe-west2-a", "europe-west2-b", "europe-west2-c"}, }, commonpb.Location_EU_WEST_3: { AWS: []string{"eu-west-3a", "eu-west-3b", "eu-west-3c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"europe-west3-a", "europe-west3-b", "europe-west3-c"}, }, commonpb.Location_US_EAST_1: { AWS: []string{"us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"us-east4-a", "us-east4-b", "us-east4-c"}, }, commonpb.Location_US_EAST_2: { AWS: []string{"us-east-2a", "us-east-2b", "us-east-2c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"us-east5-a", "us-east5-b", "us-east5-c"}, }, commonpb.Location_US_WEST_1: { AWS: []string{"us-west-1a", "us-west-1c"}, AZURE: []string{"1", "2"}, GCP: []string{"us-west2-a", "us-west2-b", "us-west2-c"}, }, commonpb.Location_US_WEST_2: { AWS: []string{"us-west-2a", "us-west-2b", "us-west-2c", "us-west-2d"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"us-west1-a", "us-west1-b", "us-west1-c"}, }, commonpb.Location_EU_NORTH_1: { AWS: []string{"eu-north-1a", "eu-north-1b", "eu-north-1c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"europe-north1-a", "europe-north1-b", "europe-north1-c"}, }, commonpb.Location_EU_CENTRAL_1: { AWS: []string{"eu-central-1a", "eu-central-1b", "eu-central-1c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"europe-west3-a", "europe-west3-b", "europe-west3-c"}, }, commonpb.Location_SA_EAST_1: { AWS: []string{"sa-east-1a", "sa-east-1b", "sa-east-1c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"southamerica-east1-a", "southamerica-east1-b", "southamerica-east1-c"}, }, commonpb.Location_CA_CENTRAL_1: { AWS: []string{"ca-central-1a", "ca-central-1b", "ca-central-1d"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"northamerica-northeast1-a", "northamerica-northeast1-b", "northamerica-northeast1-c"}, }, commonpb.Location_AP_NORTH_EAST_1: { AWS: []string{"ap-northeast-1a", "ap-northeast-1b", "ap-northeast-1c", "ap-northeast-1d"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"asia-northeast1-a", "asia-northeast1-b", "asia-northeast1-c"}, }, commonpb.Location_AP_NORTH_EAST_2: { AWS: []string{"ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c", "ap-northeast-2d"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"asia-northeast3-a", "asia-northeast3-b", "asia-northeast3-c"}, }, commonpb.Location_AP_NORTH_EAST_3: { AWS: []string{"ap-northeast-3a", "ap-northeast-3b", "ap-northeast-3c"}, AZURE: []string{}, GCP: []string{"asia-northeast2-a", "asia-northeast2-b", "asia-northeast2-c"}, }, commonpb.Location_AP_SOUTH_EAST_2: { AWS: []string{"ap-southeast-2a", "ap-southeast-2b", "ap-southeast-2c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"australia-southeast1-a", "australia-southeast1-b", "australia-southeast1-c"}, }, commonpb.Location_AP_SOUTH_1: { AWS: []string{"ap-south-1a", "ap-south-1b", "ap-south-1c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"asia-south1-a", "asia-south1-b", "asia-south1-c"}, }, commonpb.Location_AP_SOUTH_EAST_1: { AWS: []string{"ap-southeast-1a", "ap-southeast-1b", "ap-southeast-1c"}, AZURE: []string{"1", "2", "3"}, GCP: []string{"asia-southeast1-a", "asia-southeast1-b", "asia-southeast1-c"}, }, }
View Source
var AwsAmiOwners = map[resourcespb.ImageReference_OperatingSystemDistribution]string{ resourcespb.ImageReference_UBUNTU: "099720109477", resourcespb.ImageReference_CENT_OS: "125523088429", resourcespb.ImageReference_DEBIAN: "136693071363", }
View Source
var DBSIZE = map[commonpb.DatabaseSize_Enum]map[commonpb.CloudProvider]string{ commonpb.DatabaseSize_MICRO: { commonpb.CloudProvider_AWS: "db.t2.micro", commonpb.CloudProvider_AZURE: "GP_Gen5_2", commonpb.CloudProvider_GCP: "db-f1-micro", }, commonpb.DatabaseSize_SMALL: { commonpb.CloudProvider_AWS: "db.t2.small", commonpb.CloudProvider_AZURE: "GP_Gen5_4", commonpb.CloudProvider_GCP: "db-g1-small", }, commonpb.DatabaseSize_MEDIUM: { commonpb.CloudProvider_AWS: "db.t2.medium", commonpb.CloudProvider_AZURE: "GP_Gen5_6", commonpb.CloudProvider_GCP: "db-n1-standard-1", }, }
View Source
var LOCATION = map[commonpb.Location]map[commonpb.CloudProvider]string{ commonpb.Location_EU_WEST_1: { AWS: "eu-west-1", AZURE: "northeurope", GCP: "europe-west1", }, commonpb.Location_EU_WEST_2: { AWS: "eu-west-2", AZURE: "uksouth", GCP: "europe-west2", }, commonpb.Location_EU_WEST_3: { AWS: "eu-west-3", AZURE: "francecentral", GCP: "europe-west9", }, commonpb.Location_US_EAST_1: { AWS: "us-east-1", AZURE: "eastus", GCP: "us-east4", }, commonpb.Location_US_EAST_2: { AWS: "us-east-2", AZURE: "eastus2", GCP: "us-east5", }, commonpb.Location_US_WEST_1: { AWS: "us-west-1", AZURE: "westus2", GCP: "us-west2", }, commonpb.Location_US_WEST_2: { AWS: "us-west-2", AZURE: "westus3", GCP: "us-west1", }, commonpb.Location_EU_NORTH_1: { AWS: "eu-north-1", AZURE: "swedencentral", GCP: "europe-north1", }, commonpb.Location_EU_CENTRAL_1: { AWS: "eu-central-1", AZURE: "germanywestcentral", GCP: "europe-west3", }, commonpb.Location_SA_EAST_1: { AWS: "sa-east-1", AZURE: "brazilsouth", GCP: "southamerica-east1", }, commonpb.Location_CA_CENTRAL_1: { AWS: "ca-central-1", AZURE: "canadacentral", GCP: "northamerica-northeast1", }, commonpb.Location_AP_NORTH_EAST_1: { AWS: "ap-northeast-1", AZURE: "japaneast", GCP: "asia-northeast1", }, commonpb.Location_AP_NORTH_EAST_2: { AWS: "ap-northeast-2", AZURE: "koreacentral", GCP: "asia-northeast3", }, commonpb.Location_AP_NORTH_EAST_3: { AWS: "ap-northeast-3", AZURE: "japanwest", GCP: "asia-northeast2", }, commonpb.Location_AP_SOUTH_EAST_2: { AWS: "ap-southeast-2", AZURE: "australiaeast", GCP: "australia-southeast1", }, commonpb.Location_AP_SOUTH_1: { AWS: "ap-south-1", AZURE: "centralindia", GCP: "asia-south1", }, commonpb.Location_AP_SOUTH_EAST_1: { AWS: "ap-southeast-1", AZURE: "southeastasia", GCP: "asia-southeast1", }, }
View Source
var VMSIZE = map[commonpb.VmSize_Enum]map[commonpb.CloudProvider]string{ commonpb.VmSize_GENERAL_NANO: { commonpb.CloudProvider_AWS: "t2.nano", commonpb.CloudProvider_AZURE: "Standard_B1ls", commonpb.CloudProvider_GCP: "f1-micro", }, commonpb.VmSize_GENERAL_MICRO: { commonpb.CloudProvider_AWS: "t2.micro", commonpb.CloudProvider_AZURE: "Standard_B1s", commonpb.CloudProvider_GCP: "e2-micro", }, commonpb.VmSize_GENERAL_SMALL: { commonpb.CloudProvider_AWS: "t2.small", commonpb.CloudProvider_AZURE: "Standard_B1ms", commonpb.CloudProvider_GCP: "e2-small", }, commonpb.VmSize_GENERAL_MEDIUM: { commonpb.CloudProvider_AWS: "t2.medium", commonpb.CloudProvider_AZURE: "Standard_B2s", commonpb.CloudProvider_GCP: "e2-medium", }, commonpb.VmSize_GENERAL_LARGE: { commonpb.CloudProvider_AWS: "t2.large", commonpb.CloudProvider_AZURE: "Standard_B2ms", commonpb.CloudProvider_GCP: "e2-standard-2", }, commonpb.VmSize_GENERAL_XLARGE: { commonpb.CloudProvider_AWS: "t2.xlarge", commonpb.CloudProvider_AZURE: "Standard_B4ms", commonpb.CloudProvider_GCP: "e2-standard-4", }, commonpb.VmSize_GENERAL_2XLARGE: { commonpb.CloudProvider_AWS: "t2.2xlarge", commonpb.CloudProvider_AZURE: "Standard_B8ms", commonpb.CloudProvider_GCP: "e2-standard-8", }, commonpb.VmSize_COMPUTE_LARGE: { commonpb.CloudProvider_AWS: "c4.large", commonpb.CloudProvider_AZURE: "Standard_F2s_v2", commonpb.CloudProvider_GCP: "c2d-highcpu-2", }, commonpb.VmSize_COMPUTE_XLARGE: { commonpb.CloudProvider_AWS: "c4.xlarge", commonpb.CloudProvider_AZURE: "Standard_F4s_v2", commonpb.CloudProvider_GCP: "c2d-highcpu-4", }, commonpb.VmSize_COMPUTE_2XLARGE: { commonpb.CloudProvider_AWS: "c4.2xlarge", commonpb.CloudProvider_AZURE: "Standard_F8s_v2", commonpb.CloudProvider_GCP: "c2d-highcpu-8", }, commonpb.VmSize_COMPUTE_4XLARGE: { commonpb.CloudProvider_AWS: "c4.4xlarge", commonpb.CloudProvider_AZURE: "Standard_F16s_v2", commonpb.CloudProvider_GCP: "c2d-highcpu-16", }, commonpb.VmSize_COMPUTE_8XLARGE: { commonpb.CloudProvider_AWS: "c4.8xlarge", commonpb.CloudProvider_AZURE: "Standard_F48s_v2", commonpb.CloudProvider_GCP: "c2d-highcpu-32", }, commonpb.VmSize_MEMORY_LARGE: { commonpb.CloudProvider_AWS: "r6i.large", commonpb.CloudProvider_AZURE: "Standard_E2s_v5", commonpb.CloudProvider_GCP: "e2-highmem-2", }, commonpb.VmSize_MEMORY_XLARGE: { commonpb.CloudProvider_AWS: "r6i.xlarge", commonpb.CloudProvider_AZURE: "Standard_E4s_v5", commonpb.CloudProvider_GCP: "e2-highmem-4", }, commonpb.VmSize_MEMORY_2XLARGE: { commonpb.CloudProvider_AWS: "r6i.2xlarge", commonpb.CloudProvider_AZURE: "Standard_E8s_v5", commonpb.CloudProvider_GCP: "e2-highmem-8", }, commonpb.VmSize_MEMORY_4XLARGE: { commonpb.CloudProvider_AWS: "r6i.4xlarge", commonpb.CloudProvider_AZURE: "Standard_E16s_v5", commonpb.CloudProvider_GCP: "e2-highmem-16", }, commonpb.VmSize_MEMORY_8XLARGE: { commonpb.CloudProvider_AWS: "r6i.8xlarge", commonpb.CloudProvider_AZURE: "Standard_E32s_v5", commonpb.CloudProvider_GCP: "n2-highmem-32", }, commonpb.VmSize_MEMORY_12XLARGE: { commonpb.CloudProvider_AWS: "r6i.12xlarge", commonpb.CloudProvider_AZURE: "Standard_E48s_v5", commonpb.CloudProvider_GCP: "n2-highmem-48", }, commonpb.VmSize_MEMORY_16XLARGE: { commonpb.CloudProvider_AWS: "r6i.16xlarge", commonpb.CloudProvider_AZURE: "Standard_E64s_v5", commonpb.CloudProvider_GCP: "n2-highmem-64", }, }
Functions ¶
func AlphanumericFormatFunc ¶
func GenerateHash ¶ added in v0.1.54
func GetAvailabilityZone ¶
func GetCloudLocation ¶
func GetResourceId ¶ added in v0.1.56
func GetResourceId(prefix string, cloud commonpb.CloudProvider) string
func GetVmSize ¶ added in v0.1.48
func GetVmSize(s commonpb.VmSize_Enum, c commonpb.CloudProvider) (string, error)
func LowercaseAlphanumericAndDashFormatFunc ¶ added in v0.1.53
func ParseCloudFromResourceId ¶ added in v0.1.56
func ParseCloudFromResourceId(resourceId string) commonpb.CloudProvider
func ParseVmSize ¶ added in v0.1.57
func ParseVmSize(size string, c commonpb.CloudProvider) commonpb.VmSize_Enum
func RandomString ¶
func RemoveSpecialChars ¶
func StringInSlice ¶
func UniqueId ¶
func UniqueId(prefix string, suffix string, formatFunc FormatFunc) string
UniqueId generates a stable string composed of prefix+suffix and a 4 char hash. Prefix can be any size but will be sliced if bigger than 16 chars. Suffix can have 4 chars at most. Returns a string with at most 24 chars.
Types ¶
type AwsResource ¶
type AwsResource struct { output.TerraformResource `hcl:",squash"` Tags map[string]string `hcl:"tags" hcle:"omitempty"` }
func NewAwsResource ¶
func NewAwsResource(resourceId string, name string) *AwsResource
func NewAwsResourceWithDeps ¶ added in v0.1.38
func NewAwsResourceWithDeps(resourceId string, name string, deps []string) *AwsResource
func NewAwsResourceWithIdOnly ¶
func NewAwsResourceWithIdOnly(resourceId string) *AwsResource
func (*AwsResource) SetName ¶
func (r *AwsResource) SetName(name string)
type AzResource ¶
type AzResource struct { output.TerraformResource `hcl:",squash"` ResourceGroupName string `hcl:"resource_group_name,expr" hcle:"omitempty"` Name string `hcl:"name" hcle:"omitempty"` Location string `hcl:"location" hcle:"omitempty"` }
func NewAzResource ¶
func NewAzResource(resourceId string, name string, rgName string, location string) *AzResource
func (*AzResource) SetName ¶
func (r *AzResource) SetName(name string)
type FormatFunc ¶
type GcpResource ¶ added in v0.1.46
type GcpResource struct { output.TerraformResource `hcl:",squash"` Name string `hcl:"name" hcle:"omitempty" json:"name"` Project string `hcl:"project" hcle:"omitempty"` // output SelfLink string `json:"self_link" hcle:"omitempty"` }
func NewGcpResource ¶ added in v0.1.46
func NewGcpResource(resourceId string, name string, project string) *GcpResource
func NewGcpResourceWithNoProject ¶ added in v0.1.53
func NewGcpResourceWithNoProject(resourceId string, name string) *GcpResource
func (*GcpResource) SetName ¶ added in v0.1.46
func (r *GcpResource) SetName(name string)
Click to show internal directories.
Click to hide internal directories.