Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Providers and ProviderOperations from Azure.ResourceManager.Resources into Azure.ResourceManager.Core-nibhati-5862 #21337

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
10f6ad0
Change the accessbility to virtual for Resource.Id
YalinLi0312 Mar 24, 2021
1db5501
merge
nisha-bhatia Apr 1, 2021
e98ceff
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Apr 12, 2021
2846fa4
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Apr 14, 2021
99fa023
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Apr 23, 2021
1937e2a
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia May 10, 2021
488c905
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia May 18, 2021
150dc73
WIP
nisha-bhatia May 19, 2021
ab64c01
WIP
nisha-bhatia May 20, 2021
16955bf
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia May 20, 2021
6fa6c95
WIP
nisha-bhatia May 20, 2021
c5cec5d
wip
nisha-bhatia May 25, 2021
79c4c69
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia May 25, 2021
996eaef
Update TenantOperations.cs
nisha-bhatia May 25, 2021
f1c5360
wip
nisha-bhatia May 26, 2021
c3c4890
WIP
nisha-bhatia May 26, 2021
f228390
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Jun 10, 2021
523cb0b
wip
nisha-bhatia Jun 15, 2021
7e050a7
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Jun 15, 2021
d977438
wip
nisha-bhatia Jun 15, 2021
f47937d
wip
nisha-bhatia Jun 16, 2021
b0f057c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Jun 16, 2021
2d38b31
wip
nisha-bhatia Jun 18, 2021
eccf749
merge
nisha-bhatia Jun 18, 2021
2c1da14
fix formatting
nisha-bhatia Jun 18, 2021
3cef95d
merge
nisha-bhatia Jun 18, 2021
127b0bf
wip
nisha-bhatia Jun 23, 2021
31377e4
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Jun 23, 2021
3b36cc2
Update ProviderContainer.cs
nisha-bhatia Jun 23, 2021
e8d14fe
Update ProviderContainer.cs
nisha-bhatia Jun 23, 2021
ce6f7d9
wip
nisha-bhatia Jun 23, 2021
3d31c95
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Jun 23, 2021
11c7b95
wip
nisha-bhatia Jun 24, 2021
cd7caac
Update ProviderContainerTests.cs
nisha-bhatia Jun 24, 2021
d6c8247
wip
nisha-bhatia Jun 25, 2021
8beab8c
Merge branch 'feature/mgmt-track2' of https://github.com/Azure/azure-…
nisha-bhatia Jun 25, 2021
c785fe3
wip
nisha-bhatia Jun 25, 2021
2cabad7
update to interceptor to handle targetinvocation on a failed task
m-nash Jun 25, 2021
8c3e7ac
remove expand parameter from LoadApiVersion methods
nisha-bhatia Jun 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;

namespace Azure.ResourceManager.Core
{
Expand All @@ -20,7 +18,7 @@ namespace Azure.ResourceManager.Core
/// </summary>
public class ApiVersions
{
private ProvidersOperations ProviderOperations;
private ProviderRestOperations ProviderRestOperations;
nisha-bhatia marked this conversation as resolved.
Show resolved Hide resolved
private ArmClientOptions _clientOptions;

/// <summary>
Expand All @@ -30,19 +28,19 @@ internal ApiVersions(ArmClientOptions clientOptions)
{
BuildApiTable(clientOptions);
_clientOptions = clientOptions;
ProviderOperations = null;
ProviderRestOperations = null;
}

/// <summary>
/// Make a provider resource client class.
/// </summary>
internal void SetProviderClient(TokenCredential credential, Uri baseUri, string subscription)
{
ProviderOperations = new ResourcesManagementClient(
baseUri,
subscription,
credential,
_clientOptions.Convert<ResourcesManagementClientOptions>()).Providers;
ProviderRestOperations = new ProviderRestOperations(
new Azure.Core.Pipeline.ClientDiagnostics(_clientOptions),
ManagementPipelineBuilder.Build(credential, baseUri, _clientOptions),
subscription,
baseUri);
}

private ConcurrentDictionary<string, PropertyWrapper> _loadedResourceToApiVersions = new ConcurrentDictionary<string, PropertyWrapper>();
Expand Down Expand Up @@ -86,10 +84,10 @@ where method.GetParameters()[0].ParameterType == typeof(ArmClientOptions)

private string LoadApiVersion(ResourceType resourceType, CancellationToken cancellationToken)
{
Response<Provider> results;
Response<ProviderData> results;
try
{
results = ProviderOperations.Get(resourceType.Namespace, null, cancellationToken);
results = ProviderRestOperations.Get(resourceType.Namespace, null, cancellationToken);
}
catch (RequestFailedException ex) when (ex.Status == 404)
{
Expand All @@ -108,10 +106,10 @@ private string LoadApiVersion(ResourceType resourceType, CancellationToken cance

private async Task<string> LoadApiVersionAsync(ResourceType resourceType, CancellationToken cancellationToken)
{
Response<Provider> results;
Response<ProviderData> results;
try
{
results = await ProviderOperations.GetAsync(resourceType.Namespace, null, cancellationToken).ConfigureAwait(false);
results = await ProviderRestOperations.GetAsync(resourceType.Namespace, null, cancellationToken).ConfigureAwait(false);
}
catch (RequestFailedException ex) when (ex.Status == 404)
{
Expand All @@ -138,7 +136,7 @@ public string TryGetApiVersion(ResourceType resourceType, CancellationToken canc
{
return val;
}
return ProviderOperations == null ? null : LoadApiVersion(resourceType.ToString(), cancellationToken);
return ProviderRestOperations == null ? null : LoadApiVersion(resourceType.ToString(), cancellationToken);
}

/// <summary>
Expand All @@ -151,7 +149,7 @@ public async Task<string> TryGetApiVersionAsync(ResourceType resourceType, Cance
{
return val;
}
return ProviderOperations == null ? null : await LoadApiVersionAsync(resourceType.ToString(), cancellationToken).ConfigureAwait(false);
return ProviderRestOperations == null ? null : await LoadApiVersionAsync(resourceType.ToString(), cancellationToken).ConfigureAwait(false);
}

private bool TryGetApiVersion(string resourceType, out string val)
Expand Down Expand Up @@ -190,7 +188,7 @@ public void SetApiVersion(ResourceType resourceType, string apiVersion)
internal ApiVersions Clone()
{
ApiVersions copy = new ApiVersions(_clientOptions);
copy.ProviderOperations = ProviderOperations;
copy.ProviderRestOperations = ProviderRestOperations;
copy._loadedResourceToApiVersions = new ConcurrentDictionary<string, PropertyWrapper>(_loadedResourceToApiVersions);
copy._nonLoadedResourceToApiVersion = new ConcurrentDictionary<string, string>(_nonLoadedResourceToApiVersion);
return copy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public virtual SubscriptionContainer GetSubscriptions()
/// </summary>
/// <param name="id"> The id of the resourcegroup </param>
/// <returns> Resource operations of the resource. </returns>
public ResourceGroupOperations GetResourceGroupOperations(ResourceGroupResourceIdentifier id)
public ResourceGroupOperations GetResourceGroupOperations(ResourceGroupResourceIdentifier
nisha-bhatia marked this conversation as resolved.
Show resolved Hide resolved
id)
{
return new ResourceGroupOperations(new SubscriptionOperations(new ClientContext(ClientOptions, Credential, BaseUri, Pipeline), id.SubscriptionId), id.ResourceGroupName);
}
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.

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.

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

Loading