Skip to content

Commit f4e2d27

Browse files
feat(naming): extend conventions, add germany west
correcting naming conventions correcting vm shorts Adding germanywestcentral gwc
1 parent 8c5814e commit f4e2d27

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

pkg/naming/convention.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package naming
22

33
import (
44
"fmt"
5-
"github.com/ahmetb/go-linq/v3"
6-
"github.com/conplementag/cops-hq/v2/pkg/naming/resources"
75
"regexp"
86
"strconv"
97
"strings"
8+
9+
"github.com/ahmetb/go-linq/v3"
10+
"github.com/conplementag/cops-hq/v2/pkg/naming/resources"
1011
)
1112

1213
type namingConvention struct {
@@ -56,6 +57,11 @@ var namingConventions = []namingConvention{
5657
{resources.AppRegistration, 3, 120, true, true, true, CaseInsensitive},
5758
{resources.ClaimsMappingPolicy, 3, 120, true, true, true, CaseInsensitive},
5859
{resources.CustomAuthenticationExtension, 3, 120, true, true, true, CaseInsensitive},
60+
{resources.VirtualMachineWindows, 1, 15, true, true, false, CaseInsensitive},
61+
{resources.VirtualMachineLinux, 1, 64, true, true, false, CaseInsensitive},
62+
{resources.NetworkInterfaceCard, 2, 64, true, true, true, CaseInsensitive},
63+
{resources.AppServicePlan, 1, 60, true, true, false, CaseInsensitive},
64+
{resources.AppService, 2, 43, true, true, false, CaseInsensitive},
5965
}
6066

6167
func findNamingConvention(resourceType resources.AzureResourceType) namingConvention {

pkg/naming/regions/azure_region_abbriviations.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ package regions
22

33
import (
44
"errors"
5+
56
"github.com/sirupsen/logrus"
67
)
78

89
var azureRegionAbbreviations = map[string]string{
910
// naming convention is region code (e.g. n as in north, one letter) and country code (e.g. eu as in europe, two letter)
10-
"northeurope": "neu",
11-
"westeurope": "weu",
12-
"francecentral": "cfr",
13-
"eastus": "eus",
14-
"westus": "wus",
15-
"centralus": "cus",
16-
"canadaeast": "eca",
11+
"northeurope": "neu",
12+
"westeurope": "weu",
13+
"francecentral": "cfr",
14+
"eastus": "eus",
15+
"westus": "wus",
16+
"centralus": "cus",
17+
"canadaeast": "eca",
18+
"germanywestcentral": "gwc",
1719
}
1820

1921
func GetAbbreviatedRegion(region string) string {

pkg/naming/resources/azure_resource_type.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,9 @@ const (
3838
AppRegistration AzureResourceType = "app"
3939
ClaimsMappingPolicy AzureResourceType = "cmp"
4040
CustomAuthenticationExtension AzureResourceType = "authext"
41+
VirtualMachineLinux AzureResourceType = "vml"
42+
VirtualMachineWindows AzureResourceType = "vmw"
43+
NetworkInterfaceCard AzureResourceType = "nic"
44+
AppServicePlan AzureResourceType = "asp"
45+
AppService AzureResourceType = "as"
4146
)

0 commit comments

Comments
 (0)