diff --git a/GNUmakefile b/GNUmakefile deleted file mode 100644 index a434e73..0000000 --- a/GNUmakefile +++ /dev/null @@ -1,23 +0,0 @@ -DIR?=./autorest/ - -default: build - -build: fmt - go install $(DIR) - -test: - go test $(DIR) || exit 1 - -vet: - @echo "go vet ." - @go vet $(DIR)... ; if [ $$? -eq 1 ]; then \ - echo ""; \ - echo "Vet found suspicious constructs. Please check the reported constructs"; \ - echo "and fix them if necessary before submitting the code for review."; \ - exit 1; \ - fi - -fmt: - gofmt -w $(DIR) - -.PHONY: build test vet fmt diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8eaebea --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +DIR?=./autorest/ + +default: build + +build: fmt + cd $(DIR); go install + +test: + cd $(DIR); go test -v + +vet: + cd $(DIR); go vet + +fmt: + gofmt -w $(DIR) + +.PHONY: build test vet fmt diff --git a/autorest/azure/environments.go b/autorest/azure/environments.go index b67eddb..b0a5376 100644 --- a/autorest/azure/environments.go +++ b/autorest/azure/environments.go @@ -34,8 +34,10 @@ const ( var environments = map[string]Environment{ "AZURECHINACLOUD": ChinaCloud, "AZUREGERMANCLOUD": GermanCloud, + "AZURECLOUD": PublicCloud, "AZUREPUBLICCLOUD": PublicCloud, - "AZUREUSGOVERNMENTCLOUD": USGovernmentCloud, + "AZUREUSGOVERNMENT": USGovernmentCloud, + "AZUREUSGOVERNMENTCLOUD": USGovernmentCloud, //TODO: deprecate } // ResourceIdentifier contains a set of Azure resource IDs. diff --git a/autorest/azure/environments_test.go b/autorest/azure/environments_test.go index 923e04b..5bf9c66 100644 --- a/autorest/azure/environments_test.go +++ b/autorest/azure/environments_test.go @@ -176,6 +176,11 @@ func TestEnvironmentFromName(t *testing.T) { t.Errorf("Expected to get GermanCloud for %q", name) } + name = "AzureCloud" + if env, _ := EnvironmentFromName(name); env != PublicCloud { + t.Errorf("Expected to get PublicCloud for %q", name) + } + name = "azurepubliccloud" if env, _ := EnvironmentFromName(name); env != PublicCloud { t.Errorf("Expected to get PublicCloud for %q", name) @@ -196,6 +201,16 @@ func TestEnvironmentFromName(t *testing.T) { t.Errorf("Expected to get USGovernmentCloud for %q", name) } + name = "azureusgovernment" + if env, _ := EnvironmentFromName(name); env != USGovernmentCloud { + t.Errorf("Expected to get USGovernmentCloud for %q", name) + } + + name = "AzureUSGovernment" + if env, _ := EnvironmentFromName(name); env != USGovernmentCloud { + t.Errorf("Expected to get USGovernmentCloud for %q", name) + } + name = "thisisnotarealcloudenv" if _, err := EnvironmentFromName(name); err == nil { t.Errorf("Expected to get an error for %q", name)