Skip to content

Commit

Permalink
Use arm client reference instead of client context (#26452)
Browse files Browse the repository at this point in the history
* changes to remove armclientoptions cloning

* changes to generated files

* updates to use provider namespace string and not pass assembly

* remove usage of mgmt pipeline builder

* update api

* temp comment out compute and network for tests

* temp update to migration guide md

* temp changes to support back compat

* revert manual changes to generated folder

* make properties protected

* add client context overload

* update api

* add overload useClientContext to tenant clean up more code

* add cached client api

* update api

* update public api to be virtual

* update to use getor add

* updates to custom code

* temp changes to support autorest changes

* more customization

* remove file

* suppress armclient

* updates to custom code to adapt to new generation

* Update AutoRest C# version to 3.0.0-beta.20220126.1

* regen with new custom code

* make ctor param ordering consistent

* more adjustments on custom code and test cases

* removing some code that is no longer needed

* remove unused method

* uncomment references to compute and network
update api and snippets

* removing more api that isn't needed anymore

* add back azure.core project to sln

* regen return type fix

* Add test cases around cached factory

* Update AutoRest C# version to 3.0.0-beta.20220126.3

* update tests

* update customization

* cache sub client diag

* update apis

* update webpubsub

* update storage

* update appconfiguration

* update cdn

* update compute

* update keyvault

* update storage

* update eventhub

* update communication

* update deviceupdate

* update servicebus

* update sqlmanagement

* update webpubsub

* update appservice

* update insights

Co-authored-by: azure-sdk <azuresdk@microsoft.com>
  • Loading branch information
m-nash and azure-sdk committed Jan 27, 2022
1 parent dcdcb8d commit ba80fc1
Show file tree
Hide file tree
Showing 2,033 changed files with 61,880 additions and 68,269 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ protected ArmClient GetResourceManagementClient()
options.AddPolicy(CleanupPolicy, HttpPipelinePosition.PerCall);

return CreateClient<ArmClient>(
TestEnvironment.SubscriptionId,
TestEnvironment.Credential,
TestEnvironment.SubscriptionId,
options);
}

Expand All @@ -54,8 +54,8 @@ protected async Task CleanupResourceGroupsAsync()
if (CleanupPolicy != null && Mode != RecordedTestMode.Playback)
{
_cleanupClient ??= new ArmClient(
TestEnvironment.SubscriptionId,
TestEnvironment.Credential,
TestEnvironment.SubscriptionId,
new ArmClientOptions());
var sub = _cleanupClient.GetSubscriptions().GetIfExists(TestEnvironment.SubscriptionId);
foreach (var resourceGroup in CleanupPolicy.ResourceGroupsCreated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ private ArmClient GetCleanupClient()
if (Mode != RecordedTestMode.Playback)
{
return new ArmClient(
TestEnvironment.SubscriptionId,
GetUri(TestEnvironment.ResourceManagerUrl),
TestEnvironment.Credential,
new ArmClientOptions());
TestEnvironment.Credential,
TestEnvironment.SubscriptionId,
GetUri(TestEnvironment.ResourceManagerUrl),
new ArmClientOptions());
}
return null;
}
Expand All @@ -81,15 +81,15 @@ protected ArmClient GetArmClient(ArmClientOptions clientOptions = default)
options.AddPolicy(ManagementGroupCleanupPolicy, HttpPipelinePosition.PerCall);

return CreateClient<ArmClient>(
TestEnvironment.Credential,
TestEnvironment.SubscriptionId,
GetUri(TestEnvironment.ResourceManagerUrl),
TestEnvironment.Credential,
options);
}

private Uri GetUri(string endpoint)
{
return !string.IsNullOrEmpty(endpoint) ? new Uri(endpoint) : null;
return !string.IsNullOrEmpty(endpoint) ? new Uri(endpoint) : new Uri("https://management.azure.com");
}

[SetUp]
Expand Down Expand Up @@ -172,9 +172,9 @@ public async Task OneTimeSetUp()
options.AddPolicy(OneTimeManagementGroupCleanupPolicy, HttpPipelinePosition.PerCall);

GlobalClient = CreateClient<ArmClient>(
SessionEnvironment.Credential,
SessionEnvironment.SubscriptionId,
GetUri(SessionEnvironment.ResourceManagerUrl),
SessionEnvironment.Credential,
options);
}

Expand Down
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
All should have PrivateAssets="All" set so they don't become package dependencies
-->
<ItemGroup>
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20220121.1" PrivateAssets="All" />
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20220126.3" PrivateAssets="All" />
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20220111.2" PrivateAssets="All" />
<PackageReference Update="coverlet.collector" Version="1.3.0" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" PrivateAssets="All" />
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ba80fc1

Please sign in to comment.