From 9c8853332b0704114167da2938bd4cba0b800b07 Mon Sep 17 00:00:00 2001 From: Lei Jin Date: Fri, 25 Jun 2021 12:20:06 +0800 Subject: [PATCH] Update subscription client to 2021-01-01 --- .../Accounts.Test/AzureRMProfileTests.cs | 6 +++--- .../AzureRMProfileTestsForMultitenant.cs | 20 +++++++++---------- .../Mocks/MockSubscriptionClientFactory.cs | 4 ++-- ...ockSubscriptionClientFactoryVersion2019.cs | 4 ++-- .../SubscriptionClientSwitchTest.cs | 2 +- .../Models/SubscriptionClientProxy.cs | 4 ++-- .../SubscriptionClientWrapper.cs | 1 - .../SubscriptionClientWrapper.cs | 12 +++++------ .../Cmdlets/ConnectAccount.cs | 8 ++++---- 9 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/Accounts/Accounts.Test/AzureRMProfileTests.cs b/src/Accounts/Accounts.Test/AzureRMProfileTests.cs index 0ad30c46bb60..58691a049436 100644 --- a/src/Accounts/Accounts.Test/AzureRMProfileTests.cs +++ b/src/Accounts/Accounts.Test/AzureRMProfileTests.cs @@ -20,7 +20,7 @@ using Microsoft.Azure.Commands.Profile.Models; using Microsoft.Azure.Commands.Profile.Test; using Microsoft.Azure.Commands.ScenarioTest; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01.Models; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01.Models; using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.Rest; using Microsoft.Rest.Azure; @@ -144,7 +144,7 @@ public void SpecifyTenantAndSubscriptionIdSucceed() null, false, null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); } [Fact] @@ -179,7 +179,7 @@ public void SubscriptionIdNotExist() null, false, null)); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); } [Fact] diff --git a/src/Accounts/Accounts.Test/AzureRMProfileTestsForMultitenant.cs b/src/Accounts/Accounts.Test/AzureRMProfileTestsForMultitenant.cs index a1931913369c..3cc14f878dc2 100644 --- a/src/Accounts/Accounts.Test/AzureRMProfileTestsForMultitenant.cs +++ b/src/Accounts/Accounts.Test/AzureRMProfileTestsForMultitenant.cs @@ -301,7 +301,7 @@ public void LoginByTenant() false, null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, azureRmProfile.DefaultContext.Tenant.Id.ToString()); Assert.Equal(subscriptionA, azureRmProfile.DefaultContext.Subscription.Id.ToString()); } @@ -344,7 +344,7 @@ public void LoginBySubscriptionInMultitenantsHomeFirst() false, null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, azureRmProfile.DefaultContext.Tenant.Id.ToString()); Assert.Equal(subscriptionA, azureRmProfile.DefaultContext.Subscription.Id.ToString()); } @@ -390,7 +390,7 @@ public void LoginBySubscriptionInMultitenantsHomeSecond() false, null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, azureRmProfile.DefaultContext.Tenant.Id.ToString()); Assert.Equal(subscriptionA, azureRmProfile.DefaultContext.Subscription.Id.ToString()); } @@ -434,7 +434,7 @@ public void LoginBySubscriptionInManagedByTenants() false, null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantB, azureRmProfile.DefaultContext.Tenant.Id.ToString()); Assert.Equal(subscriptionC, azureRmProfile.DefaultContext.Subscription.Id.ToString()); } @@ -477,7 +477,7 @@ public void LoginBySubscriptionTenant() false, null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, azureRmProfile.DefaultContext.Tenant.Id.ToString()); Assert.Equal(subscriptionB, azureRmProfile.DefaultContext.Subscription.Id.ToString()); } @@ -591,7 +591,7 @@ public void SetContextByValidTenant() var client = GetProfileClient(); var context = client.SetCurrentContext(null, tenantA); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, context.Tenant.Id.ToString()); Assert.Equal(subscriptionA, context.Subscription.Id.ToString()); } @@ -627,7 +627,7 @@ public void SetContextBySubscriptionIdInHomeTenant() var client = GetProfileClient(); var context = client.SetCurrentContext(subscriptionA, null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, context.Tenant.Id.ToString()); Assert.Equal(subscriptionA, context.Subscription.Id.ToString()); } @@ -664,7 +664,7 @@ public void SetContextBySubscriptionNameInHomeTenant() var client = GetProfileClient(); var context = client.SetCurrentContext(subscriptionName.ToString(), null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, context.Tenant.Id.ToString()); Assert.Equal(subscriptionA, context.Subscription.Id.ToString()); } @@ -699,7 +699,7 @@ public void SetContextBySubscriptionInManagedByTenants() var client = GetProfileClient(); var context = client.SetCurrentContext(subscriptionC.ToString(), null); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, context.Tenant.Id.ToString()); Assert.Equal(subscriptionC, context.Subscription.Id.ToString()); } @@ -735,7 +735,7 @@ public void SetContextBySubscriptionTenant() var subscriptionName = (JObject.Parse(subscriptionListA[subscriptionB]))["displayName"]; var context = client.SetCurrentContext(subscriptionName.ToString(), tenantA); - Assert.Equal("2019-06-01", client.SubscriptionAndTenantClient.ApiVersion); + Assert.Equal("2021-01-01", client.SubscriptionAndTenantClient.ApiVersion); Assert.Equal(tenantA, context.Tenant.Id.ToString()); Assert.Equal(subscriptionB, context.Subscription.Id.ToString()); } diff --git a/src/Accounts/Accounts.Test/Mocks/MockSubscriptionClientFactory.cs b/src/Accounts/Accounts.Test/Mocks/MockSubscriptionClientFactory.cs index 0f525fab3226..ff87519ed830 100644 --- a/src/Accounts/Accounts.Test/Mocks/MockSubscriptionClientFactory.cs +++ b/src/Accounts/Accounts.Test/Mocks/MockSubscriptionClientFactory.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01.Models; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01.Models; using Microsoft.Rest.Azure; using Moq; using System; diff --git a/src/Accounts/Accounts.Test/Mocks/MockSubscriptionClientFactoryVersion2019.cs b/src/Accounts/Accounts.Test/Mocks/MockSubscriptionClientFactoryVersion2019.cs index e50a8ddd74b9..fc50cc41d353 100644 --- a/src/Accounts/Accounts.Test/Mocks/MockSubscriptionClientFactoryVersion2019.cs +++ b/src/Accounts/Accounts.Test/Mocks/MockSubscriptionClientFactoryVersion2019.cs @@ -12,8 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01.Models; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01.Models; using Microsoft.Rest.Azure; using Moq; using System; diff --git a/src/Accounts/Accounts.Test/SubscriptionClientSwitchTest.cs b/src/Accounts/Accounts.Test/SubscriptionClientSwitchTest.cs index fa373d89780a..2428e7258345 100644 --- a/src/Accounts/Accounts.Test/SubscriptionClientSwitchTest.cs +++ b/src/Accounts/Accounts.Test/SubscriptionClientSwitchTest.cs @@ -17,7 +17,7 @@ using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Profile.Test.Mocks; using Microsoft.Azure.Commands.ScenarioTest; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01.Models; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01.Models; using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.Rest.Azure; using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; diff --git a/src/Accounts/Accounts/Models/SubscriptionClientProxy.cs b/src/Accounts/Accounts/Models/SubscriptionClientProxy.cs index df0c9eb6061e..1f32028530e1 100644 --- a/src/Accounts/Accounts/Models/SubscriptionClientProxy.cs +++ b/src/Accounts/Accounts/Models/SubscriptionClientProxy.cs @@ -20,7 +20,7 @@ using System.Collections.Concurrent; using System.Threading; using SubscriptionClientVersion2016 = Microsoft.Azure.Commands.ResourceManager.Common.Utilities.SubscriptionClientWrapper; -using SubscriptionClientVersion2019 = Microsoft.Azure.Commands.ResourceManager.Common.Utilities.Version2019_06_01.SubscriptionClientWrapper; +using SubscriptionClientVersion2021 = Microsoft.Azure.Commands.ResourceManager.Common.Utilities.Version2021_01_01.SubscriptionClientWrapper; namespace Microsoft.Azure.Commands.Profile.Models { @@ -63,7 +63,7 @@ static public SubscritpionClientCandidates Instance private SubscritpionClientCandidates() { - Enqueue(new SubscriptionClientVersion2019()); + Enqueue(new SubscriptionClientVersion2021()); Enqueue(new SubscriptionClientVersion2016()); } diff --git a/src/Accounts/Accounts/Models/Version2016_06_01/SubscriptionClientWrapper.cs b/src/Accounts/Accounts/Models/Version2016_06_01/SubscriptionClientWrapper.cs index 891150d07773..bbb32a4e2d4b 100644 --- a/src/Accounts/Accounts/Models/Version2016_06_01/SubscriptionClientWrapper.cs +++ b/src/Accounts/Accounts/Models/Version2016_06_01/SubscriptionClientWrapper.cs @@ -15,7 +15,6 @@ using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Common.Paging; -using Microsoft.Azure.Commands.ResourceManager.Version2019_06_01.Customized; using Microsoft.Azure.Internal.Subscriptions; using Microsoft.Azure.Internal.Subscriptions.Models; using Microsoft.Azure.Internal.Subscriptions.Models.Utilities; diff --git a/src/Accounts/Accounts/Models/Version2019_06_01/SubscriptionClientWrapper.cs b/src/Accounts/Accounts/Models/Version2019_06_01/SubscriptionClientWrapper.cs index 1179c72338c8..405a75b0c54f 100644 --- a/src/Accounts/Accounts/Models/Version2019_06_01/SubscriptionClientWrapper.cs +++ b/src/Accounts/Accounts/Models/Version2019_06_01/SubscriptionClientWrapper.cs @@ -15,22 +15,22 @@ using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Common.Paging; -using Microsoft.Azure.Commands.ResourceManager.Version2019_06_01.Customized; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01.Models; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01.Models.Utilities; +using Microsoft.Azure.Commands.ResourceManager.Version2021_01_01.Utilities; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01.Models; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01.Models.Utilities; using Microsoft.Rest; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System.Collections.Generic; using System.Linq; -namespace Microsoft.Azure.Commands.ResourceManager.Common.Utilities.Version2019_06_01 +namespace Microsoft.Azure.Commands.ResourceManager.Common.Utilities.Version2021_01_01 { internal class SubscriptionClientWrapper : ISubscriptionClientWrapper { public SubscriptionClientWrapper() { - ApiVersion = "2019-06-01"; + ApiVersion = "2021-01-01"; } public IList ListAccountTenants(IAccessToken accessToken, IAzureEnvironment environment) diff --git a/src/Accounts/Authentication.Test/Cmdlets/ConnectAccount.cs b/src/Accounts/Authentication.Test/Cmdlets/ConnectAccount.cs index 978a42435fbd..cff2ddd3c76d 100644 --- a/src/Accounts/Authentication.Test/Cmdlets/ConnectAccount.cs +++ b/src/Accounts/Authentication.Test/Cmdlets/ConnectAccount.cs @@ -18,10 +18,10 @@ using Microsoft.Azure.Commands.Common.Authentication.Models; using Microsoft.Azure.Commands.Common.Authentication.ResourceManager; using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.Azure.Commands.ResourceManager.Version2019_06_01.Customized; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01.Models; -using Microsoft.Azure.Management.ResourceManager.Version2019_06_01.Models.Utilities; +using Microsoft.Azure.Commands.ResourceManager.Version2021_01_01.Utilities; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01.Models; +using Microsoft.Azure.Management.ResourceManager.Version2021_01_01.Models.Utilities; using Microsoft.Rest; using Microsoft.WindowsAzure.Commands.Utilities.Common; using System;