Skip to content

Commit

Permalink
Update subscription client to 2021-01-01
Browse files Browse the repository at this point in the history
  • Loading branch information
msJinLei committed Jun 25, 2021
1 parent 31d712f commit 9c88533
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 31 deletions.
6 changes: 3 additions & 3 deletions src/Accounts/Accounts.Test/AzureRMProfileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
20 changes: 10 additions & 10 deletions src/Accounts/Accounts.Test/AzureRMProfileTestsForMultitenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Accounts/Accounts.Test/SubscriptionClientSwitchTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Accounts/Accounts/Models/SubscriptionClientProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -63,7 +63,7 @@ static public SubscritpionClientCandidates Instance

private SubscritpionClientCandidates()
{
Enqueue(new SubscriptionClientVersion2019());
Enqueue(new SubscriptionClientVersion2021());
Enqueue(new SubscriptionClientVersion2016());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AzureTenant> ListAccountTenants(IAccessToken accessToken, IAzureEnvironment environment)
Expand Down
8 changes: 4 additions & 4 deletions src/Accounts/Authentication.Test/Cmdlets/ConnectAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9c88533

Please sign in to comment.