Update Azure dependencies

* azure-sdk-for-go to 3.1.0-beta
 * go-autorest to 7.0.7
 * import dgrijalva/jwt-go at 3.0.0
This commit is contained in:
Christopher Boumenot 2016-07-20 12:09:41 -07:00
parent 323dc70ed6
commit 97b1915d51
3 changed files with 28 additions and 13 deletions

View File

@ -299,21 +299,37 @@ func setUserNamePassword(c *Config) {
} }
func setCloudEnvironment(c *Config) error { func setCloudEnvironment(c *Config) error {
lookup := map[string]string{
"CHINA": "AzureChinaCloud",
"CHINACLOUD": "AzureChinaCloud",
"AZURECHINACLOUD": "AzureChinaCloud",
"GERMAN": "AzureGermanCloud",
"GERMANCLOUD": "AzureGermanCloud",
"AZUREGERMANCLOUD": "AzureGermanCloud",
"GERMANY": "AzureGermanCloud",
"GERMANYCLOUD": "AzureGermanCloud",
"AZUREGERMANYCLOUD": "AzureGermanCloud",
"PUBLIC": "AzurePublicCloud",
"PUBLICCLOUD": "AzurePublicCloud",
"AZUREPUBLICCLOUD": "AzurePublicCloud",
"USGOVERNMENT": "AzureUSGovernmentCloud",
"USGOVERNMENTCLOUD": "AzureUSGovernmentCloud",
"AZUREUSGOVERNMENTCLOUD": "AzureUSGovernmentCloud",
}
name := strings.ToUpper(c.CloudEnvironmentName) name := strings.ToUpper(c.CloudEnvironmentName)
switch name { envName, ok := lookup[name]
case "CHINA", "CHINACLOUD", "AZURECHINACLOUD": if !ok {
c.cloudEnvironment = &azure.ChinaCloud
case "GERMAN", "GERMANCLOUD", "AZUREGERMANCLOUD":
c.cloudEnvironment = &azure.GermanCloud
case "PUBLIC", "PUBLICCLOUD", "AZUREPUBLICCLOUD":
c.cloudEnvironment = &azure.PublicCloud
case "USGOVERNMENT", "USGOVERNMENTCLOUD", "AZUREUSGOVERNMENTCLOUD":
c.cloudEnvironment = &azure.USGovernmentCloud
default:
return fmt.Errorf("There is no cloud envionment matching the name '%s'!", c.CloudEnvironmentName) return fmt.Errorf("There is no cloud envionment matching the name '%s'!", c.CloudEnvironmentName)
} }
return nil env, err := azure.EnvironmentFromName(envName)
c.cloudEnvironment = &env
return err
} }
func provideDefaultValues(c *Config) { func provideDefaultValues(c *Config) {

View File

@ -24,4 +24,3 @@ func TestVaultClientKeyVaultEndpointPreserveScheme(t *testing.T) {
t.Errorf("expected \"http://my.vault.azure.net/\", got %q", vaultUrl) t.Errorf("expected \"http://my.vault.azure.net/\", got %q", vaultUrl)
} }
} }

View File

@ -57,7 +57,7 @@ builder.
### Optional: ### Optional:
- `cloud_environment_name` (string) One of `Public`, `China`, `German`, or - `cloud_environment_name` (string) One of `Public`, `China`, `Germany`, or
`USGovernment`. Defaults to `Public`. Long forms such as `USGovernment`. Defaults to `Public`. Long forms such as
`USGovernmentCloud` and `AzureUSGovernmentCloud` are also supported. `USGovernmentCloud` and `AzureUSGovernmentCloud` are also supported.