From 1b1719cdd1acd0b6dde2c075b79255b391cfc7c9 Mon Sep 17 00:00:00 2001 From: Charles Lowell <10964656+chlowell@users.noreply.github.com> Date: Tue, 26 Apr 2022 14:43:00 -0700 Subject: [PATCH] Rename AzurePublicCloud -> AzurePublic (#17733) --- sdk/azcore/CHANGELOG.md | 1 + sdk/azcore/arm/arm.go | 2 +- sdk/azcore/arm/runtime/pipeline.go | 2 +- sdk/azcore/arm/runtime/pipeline_test.go | 2 +- sdk/azcore/cloud/cloud.go | 4 ++-- sdk/azidentity/azidentity.go | 2 +- sdk/azidentity/azidentity_test.go | 4 ++-- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sdk/azcore/CHANGELOG.md b/sdk/azcore/CHANGELOG.md index 0e87951b9067..7c04a1862470 100644 --- a/sdk/azcore/CHANGELOG.md +++ b/sdk/azcore/CHANGELOG.md @@ -6,6 +6,7 @@ ### Breaking Changes * Renamed `cloud.Configuration.LoginEndpoint` to `.ActiveDirectoryAuthorityHost` +* Renamed `cloud.AzurePublicCloud` to `cloud.AzurePublic` * Removed `AuxiliaryTenants` field from `arm/ClientOptions` and `arm/policy/BearerTokenOptions` * Removed `TokenRequestOptions.TenantID` * `Poller[T].PollUntilDone()` now takes an `options *PollUntilDoneOptions` param instead of `freq time.Duration` diff --git a/sdk/azcore/arm/arm.go b/sdk/azcore/arm/arm.go index 055353650c98..3a0cb644295a 100644 --- a/sdk/azcore/arm/arm.go +++ b/sdk/azcore/arm/arm.go @@ -17,7 +17,7 @@ func init() { Audience: "https://management.core.usgovcloudapi.net", Endpoint: "https://management.usgovcloudapi.net", } - cloud.AzurePublicCloud.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{ + cloud.AzurePublic.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{ Audience: "https://management.core.windows.net/", Endpoint: "https://management.azure.com", } diff --git a/sdk/azcore/arm/runtime/pipeline.go b/sdk/azcore/arm/runtime/pipeline.go index a68054705ccb..6b9a242cea39 100644 --- a/sdk/azcore/arm/runtime/pipeline.go +++ b/sdk/azcore/arm/runtime/pipeline.go @@ -46,7 +46,7 @@ func NewPipeline(module, version string, cred azcore.TokenCredential, plOpts azr } func getConfiguration(o *azpolicy.ClientOptions) (cloud.ServiceConfiguration, error) { - c := cloud.AzurePublicCloud + c := cloud.AzurePublic if !reflect.ValueOf(o.Cloud).IsZero() { c = o.Cloud } diff --git a/sdk/azcore/arm/runtime/pipeline_test.go b/sdk/azcore/arm/runtime/pipeline_test.go index 239bce745a73..056a1c3a2d61 100644 --- a/sdk/azcore/arm/runtime/pipeline_test.go +++ b/sdk/azcore/arm/runtime/pipeline_test.go @@ -167,7 +167,7 @@ func TestPipelineWithCustomPolicies(t *testing.T) { } func TestPipelineAudience(t *testing.T) { - for _, c := range []cloud.Configuration{cloud.AzureChina, cloud.AzureGovernment, cloud.AzurePublicCloud} { + for _, c := range []cloud.Configuration{cloud.AzureChina, cloud.AzureGovernment, cloud.AzurePublic} { srv, close := mock.NewServer() defer close() srv.AppendResponse(mock.WithStatusCode(200)) diff --git a/sdk/azcore/cloud/cloud.go b/sdk/azcore/cloud/cloud.go index 232792ca4c5b..9d077a3e1260 100644 --- a/sdk/azcore/cloud/cloud.go +++ b/sdk/azcore/cloud/cloud.go @@ -15,8 +15,8 @@ var ( AzureGovernment = Configuration{ ActiveDirectoryAuthorityHost: "https://login.microsoftonline.us/", Services: map[ServiceName]ServiceConfiguration{}, } - // AzurePublicCloud contains configuration for Azure Public Cloud. - AzurePublicCloud = Configuration{ + // AzurePublic contains configuration for Azure Public Cloud. + AzurePublic = Configuration{ ActiveDirectoryAuthorityHost: "https://login.microsoftonline.com/", Services: map[ServiceName]ServiceConfiguration{}, } ) diff --git a/sdk/azidentity/azidentity.go b/sdk/azidentity/azidentity.go index 341601bdd98f..7a3e4454eb0a 100644 --- a/sdk/azidentity/azidentity.go +++ b/sdk/azidentity/azidentity.go @@ -42,7 +42,7 @@ func setAuthorityHost(cc cloud.Configuration) (string, error) { if len(cc.Services) > 0 { return "", errors.New("missing ActiveDirectoryAuthorityHost for specified cloud") } - host = cloud.AzurePublicCloud.ActiveDirectoryAuthorityHost + host = cloud.AzurePublic.ActiveDirectoryAuthorityHost if envAuthorityHost := os.Getenv(azureAuthorityHost); envAuthorityHost != "" { host = envAuthorityHost } diff --git a/sdk/azidentity/azidentity_test.go b/sdk/azidentity/azidentity_test.go index e936ba15adf5..10c33ac5abb5 100644 --- a/sdk/azidentity/azidentity_test.go +++ b/sdk/azidentity/azidentity_test.go @@ -156,7 +156,7 @@ func setEnvironmentVariables(t *testing.T, vars map[string]string) { } func Test_WellKnownHosts(t *testing.T) { - for _, cloud := range []cloud.Configuration{cloud.AzureChina, cloud.AzureGovernment, cloud.AzurePublicCloud} { + for _, cloud := range []cloud.Configuration{cloud.AzureChina, cloud.AzureGovernment, cloud.AzurePublic} { host, err := setAuthorityHost(cloud) if err != nil { t.Fatal(err) @@ -196,7 +196,7 @@ func Test_DefaultAuthorityHost(t *testing.T) { if err != nil { t.Fatal(err) } - if authorityHost != cloud.AzurePublicCloud.ActiveDirectoryAuthorityHost { + if authorityHost != cloud.AzurePublic.ActiveDirectoryAuthorityHost { t.Fatal("unexpected default host: " + authorityHost) } }