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

Mnash 5705 rename container #19932

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
20 changes: 10 additions & 10 deletions common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public abstract class ManagementRecordedTestBase<TEnvironment> : RecordedTestBas

protected ResourceGroupCleanupPolicy OneTimeCleanupPolicy = new ResourceGroupCleanupPolicy();

protected AzureResourceManagerClient GlobalClient { get; private set; }
protected ArmClient GlobalClient { get; private set; }

public TestEnvironment SessionEnvironment { get; private set; }

public TestRecording SessionRecording { get; private set; }

private AzureResourceManagerClient _cleanupClient;
private ArmClient _cleanupClient;

protected ManagementRecordedTestBase(bool isAsync) : base(isAsync)
{
Expand All @@ -39,24 +39,24 @@ protected ManagementRecordedTestBase(bool isAsync, RecordedTestMode mode) : base
SessionEnvironment.Mode = Mode;
}

private AzureResourceManagerClient GetCleanupClient()
private ArmClient GetCleanupClient()
{
if (Mode != RecordedTestMode.Playback)
{
return new AzureResourceManagerClient(
return new ArmClient(
TestEnvironment.SubscriptionId,
TestEnvironment.Credential,
new AzureResourceManagerClientOptions());
new ArmClientOptions());
}
return null;
}

protected AzureResourceManagerClient GetArmClient(AzureResourceManagerClientOptions clientOptions = default)
protected ArmClient GetArmClient(ArmClientOptions clientOptions = default)
{
var options = InstrumentClientOptions(clientOptions ?? new AzureResourceManagerClientOptions());
var options = InstrumentClientOptions(clientOptions ?? new ArmClientOptions());
options.AddPolicy(CleanupPolicy, HttpPipelinePosition.PerCall);

return CreateClient<AzureResourceManagerClient>(
return CreateClient<ArmClient>(
TestEnvironment.SubscriptionId,
TestEnvironment.Credential,
options);
Expand Down Expand Up @@ -120,10 +120,10 @@ public void OneTimeSetUp()

StartSessionRecording();

var options = InstrumentClientOptions(new AzureResourceManagerClientOptions(), SessionRecording);
var options = InstrumentClientOptions(new ArmClientOptions(), SessionRecording);
options.AddPolicy(OneTimeCleanupPolicy, HttpPipelinePosition.PerCall);

GlobalClient = CreateClient<AzureResourceManagerClient>(
GlobalClient = CreateClient<ArmClient>(
SessionEnvironment.SubscriptionId,
SessionEnvironment.Credential,
options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ namespace Azure.ResourceManager.Core
public class ApiVersions
{
private ProvidersOperations ProviderOperations;
private AzureResourceManagerClientOptions _clientOptions;
private ArmClientOptions _clientOptions;

/// <summary>
/// Initializes a new instance of the <see cref="ApiVersions"/> class.
/// </summary>
internal ApiVersions(AzureResourceManagerClientOptions clientOptions)
internal ApiVersions(ArmClientOptions clientOptions)
{
BuildApiTable(clientOptions);
_clientOptions = clientOptions;
Expand All @@ -47,7 +47,7 @@ internal void SetProviderClient(TokenCredential credential, Uri baseUri, string
private Dictionary<string, PropertyWrapper> _loadedResourceToApiVersions = new Dictionary<string, PropertyWrapper>();
private Dictionary<string, string> _nonLoadedResourceToApiVersion = new Dictionary<string, string>();

private void BuildApiTable(AzureResourceManagerClientOptions clientOptions)
private void BuildApiTable(ArmClientOptions clientOptions)
{
var methods = GetExtensionMethods();
foreach (var method in methods)
Expand Down Expand Up @@ -78,7 +78,7 @@ from type in assembly.GetTypes()
where type.IsSealed && !type.IsGenericType && !type.IsNested && type.Name.Equals("AzureResourceManagerClientOptionsExtensions", StringComparison.Ordinal)
from method in type.GetMethods(BindingFlags.Static | BindingFlags.Public)
where method.IsDefined(typeof(ExtensionAttribute), false)
where method.GetParameters()[0].ParameterType == typeof(AzureResourceManagerClientOptions)
where method.GetParameters()[0].ParameterType == typeof(ArmClientOptions)
select method;
return results;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Core
/// <summary>
/// The entry point for all ARM clients.
/// </summary>
public class AzureResourceManagerClient
public class ArmClient
{
/// <summary>
/// The base URI of the service.
Expand All @@ -29,75 +29,76 @@ public class AzureResourceManagerClient
/// </summary>
public TenantOperations Tenant => _tenant ??= new TenantOperations(_clientOptions, _credentials, _baseUri);

private readonly AzureResourceManagerClientOptions _clientOptions;
private readonly ArmClientOptions _clientOptions;

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClient"/> class for mocking.
/// Initializes a new instance of the <see cref="ArmClient"/> class for mocking.
/// </summary>
protected AzureResourceManagerClient()
protected ArmClient()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClient"/> class.
/// Initializes a new instance of the <see cref="ArmClient"/> class.
/// </summary>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="options"> The client parameters to use in these operations. </param>
/// <exception cref="ArgumentNullException"> If <see cref="TokenCredential"/> is null. </exception>
public AzureResourceManagerClient(TokenCredential credential, AzureResourceManagerClientOptions options = default)
public ArmClient(TokenCredential credential, ArmClientOptions options = default)
: this(null, null, credential, options)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClient"/> class.
/// Initializes a new instance of the <see cref="ArmClient"/> class.
/// </summary>
/// <param name="defaultSubscriptionId"> The id of the default Azure subscription. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="options"> The client parameters to use in these operations. </param>
/// <exception cref="ArgumentNullException"> If <see cref="TokenCredential"/> is null. </exception>
public AzureResourceManagerClient(
public ArmClient(
string defaultSubscriptionId,
TokenCredential credential,
AzureResourceManagerClientOptions options = default)
ArmClientOptions options = default)
: this(defaultSubscriptionId, null, credential, options)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClient"/> class.
/// Initializes a new instance of the <see cref="ArmClient"/> class.
/// </summary>
/// <param name="baseUri"> The base URI of the Azure management endpoint. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="options"> The client parameters to use in these operations. </param>
/// <exception cref="ArgumentNullException"> If <see cref="TokenCredential"/> is null. </exception>
public AzureResourceManagerClient(
public ArmClient(
Uri baseUri,
TokenCredential credential,
AzureResourceManagerClientOptions options = default)
ArmClientOptions options = default)
: this(null, baseUri, credential, options)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClient"/> class.
/// Initializes a new instance of the <see cref="ArmClient"/> class.
/// </summary>
/// <param name="defaultSubscriptionId"> The id of the default Azure subscription. </param>
/// <param name="baseUri"> The base URI of the service. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="options"> The client parameters to use in these operations. </param>
private AzureResourceManagerClient(
private ArmClient(
string defaultSubscriptionId,
Uri baseUri,
TokenCredential credential,
AzureResourceManagerClientOptions options)
ArmClientOptions options)
{
if (credential is null)
throw new ArgumentNullException(nameof(credential));

_credentials = credential;
_baseUri = baseUri;
_clientOptions = options ?? new AzureResourceManagerClientOptions();
_clientOptions = options ?? new ArmClientOptions();

DefaultSubscription = string.IsNullOrWhiteSpace(defaultSubscriptionId)
? GetDefaultSubscription()
: GetSubscriptionOperations(defaultSubscriptionId).Get().Value;
Expand All @@ -124,7 +125,7 @@ private AzureResourceManagerClient(
/// Gets the Azure subscriptions.
/// </summary>
/// <returns> Subscription container. </returns>
public virtual SubscriptionContainer GetSubscriptionContainer()
public virtual SubscriptionContainer GetSubscriptions()
{
return new SubscriptionContainer(_clientOptions, _credentials, _baseUri);
}
Expand Down Expand Up @@ -172,7 +173,7 @@ public virtual T GetResourceOperations<T>(string subscription, string resourceGr

private Subscription GetDefaultSubscription()
{
var sub = GetSubscriptionContainer().List().FirstOrDefault();
var sub = GetSubscriptions().List().FirstOrDefault();
if (sub is null)
throw new Exception("No subscriptions found for the given credentials");
return sub;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Core
/// <summary>
/// A class representing Azure resource manager client options.
/// </summary>
public sealed class AzureResourceManagerClientOptions : ClientOptions
public sealed class ArmClientOptions : ClientOptions
{
private readonly ConcurrentDictionary<Type, object> _overrides = new ConcurrentDictionary<Type, object>();

Expand All @@ -26,29 +26,29 @@ public sealed class AzureResourceManagerClientOptions : ClientOptions
public ApiVersions ApiVersions { get; }

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClientOptions"/> class.
/// Initializes a new instance of the <see cref="ArmClientOptions"/> class.
/// </summary>
public AzureResourceManagerClientOptions()
public ArmClientOptions()
: this(LocationData.Default, null)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClientOptions"/> class.
/// Initializes a new instance of the <see cref="ArmClientOptions"/> class.
/// </summary>
/// <param name="defaultLocation"> The default location to use if can't be inherited from parent. </param>
public AzureResourceManagerClientOptions(LocationData defaultLocation)
public ArmClientOptions(LocationData defaultLocation)
: this(defaultLocation, null)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AzureResourceManagerClientOptions"/> class.
/// Initializes a new instance of the <see cref="ArmClientOptions"/> class.
/// </summary>
/// <param name="defaultLocation"> The default location to use if can't be inherited from parent. </param>
/// <param name="other"> The client parameters to use in these operations. </param>
/// <exception cref="ArgumentNullException"> If <see cref="LocationData"/> is null. </exception>
internal AzureResourceManagerClientOptions(LocationData defaultLocation, AzureResourceManagerClientOptions other = null)
internal ArmClientOptions(LocationData defaultLocation, ArmClientOptions other = null)
{
if (defaultLocation is null)
throw new ArgumentNullException(nameof(defaultLocation));
Expand Down Expand Up @@ -150,7 +150,7 @@ public object GetOverrideObject<T>(Func<object> objectConstructor)
}

// Will be removed like AddPolicy when we move to azure core
private void Copy(AzureResourceManagerClientOptions other)
private void Copy(ArmClientOptions other)
{
Transport = other.Transport;
foreach (var pol in other.PerCallPolicies)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected ContainerBase()
/// <param name="id"> The identifier of the resource that is the target of operations. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="baseUri"> The base URI of the service. </param>
protected ContainerBase(AzureResourceManagerClientOptions options, TIdentifier id, TokenCredential credential, Uri baseUri)
protected ContainerBase(ArmClientOptions options, TIdentifier id, TokenCredential credential, Uri baseUri)
: base(options, id, credential, baseUri)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class GenericResource : GenericResourceOperations
/// </summary>
/// <param name="operations"> The operations object to copy the client parameters from. </param>
/// <param name="resource"> The data model representing the generic azure resource. </param>
/// <exception cref="ArgumentNullException"> If <see cref="AzureResourceManagerClientOptions"/> or <see cref="TokenCredential"/> is null. </exception>
/// <exception cref="ArgumentNullException"> If <see cref="ArmClientOptions"/> or <see cref="TokenCredential"/> is null. </exception>
internal GenericResource(ResourceOperationsBase operations, GenericResourceData resource)
: base(operations, resource.Id)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected OperationsBase()
/// <param name="id"> The identifier of the resource that is the target of operations. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="baseUri"> The base URI of the service. </param>
protected OperationsBase(AzureResourceManagerClientOptions options, ResourceIdentifier id, TokenCredential credential, Uri baseUri)
protected OperationsBase(ArmClientOptions options, ResourceIdentifier id, TokenCredential credential, Uri baseUri)
{
ClientOptions = options;
Id = id;
Expand All @@ -47,7 +47,7 @@ protected OperationsBase(AzureResourceManagerClientOptions options, ResourceIden
/// <summary>
/// Gets the Azure Resource Manager client options.
/// </summary>
public virtual AzureResourceManagerClientOptions ClientOptions { get; }
public virtual ArmClientOptions ClientOptions { get; }

/// <summary>
/// Gets the Azure credential.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected ResourceOperationsBase(ResourceOperationsBase options, ResourceIdentif
/// <param name="resourceId"> The identifier of the resource that is the target of operations. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="baseUri"> The base URI of the service. </param>
protected ResourceOperationsBase(AzureResourceManagerClientOptions options, ResourceIdentifier resourceId, TokenCredential credential, Uri baseUri)
protected ResourceOperationsBase(ArmClientOptions options, ResourceIdentifier resourceId, TokenCredential credential, Uri baseUri)
: base(options, resourceId, credential, baseUri)
{
}
Expand Down Expand Up @@ -106,7 +106,7 @@ protected ResourceOperationsBase(ResourceOperationsBase parentOperations, Resour
/// <param name="resourceId"> The identifier of the resource that is the target of operations. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="baseUri"> The base URI of the service. </param>
protected ResourceOperationsBase(AzureResourceManagerClientOptions options, ResourceIdentifier resourceId, TokenCredential credential, Uri baseUri)
protected ResourceOperationsBase(ArmClientOptions options, ResourceIdentifier resourceId, TokenCredential credential, Uri baseUri)
: base(options, resourceId, credential, baseUri)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal LocationContainer(SubscriptionOperations subscriptionOperations)
/// Gets the Azure subscriptions.
/// </summary>
/// <returns> Subscription container. </returns>
public SubscriptionContainer GetSubscriptionContainer()
public SubscriptionContainer GetSubscriptions()
{
return new SubscriptionContainer(ClientOptions, Credential, BaseUri);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class SubscriptionContainer : ContainerBase<SubscriptionResourceIdentifie
/// <param name="options"> The client parameters to use in these operations. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="baseUri"> The base URI of the service. </param>
internal SubscriptionContainer(AzureResourceManagerClientOptions options, TokenCredential credential, Uri baseUri)
internal SubscriptionContainer(ArmClientOptions options, TokenCredential credential, Uri baseUri)
: base(options, null, credential, baseUri)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected SubscriptionOperations()
/// <param name="subscriptionId"> The Id of the subscription. </param>
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
/// <param name="baseUri"> The base URI of the service. </param>
internal SubscriptionOperations(AzureResourceManagerClientOptions options, string subscriptionId, TokenCredential credential, Uri baseUri)
internal SubscriptionOperations(ArmClientOptions options, string subscriptionId, TokenCredential credential, Uri baseUri)
: base(options, new SubscriptionResourceIdentifier(subscriptionId), credential, baseUri)
{
}
Expand Down Expand Up @@ -72,19 +72,19 @@ public virtual ResourceGroupOperations GetResourceGroupOperations(string resourc
}

/// <summary>
/// Gets the resource group container under this subscription
/// Gets the resource group container under this subscription.
/// </summary>
/// <returns> The resource group container. </returns>
public virtual ResourceGroupContainer GetResourceGroupContainer()
public virtual ResourceGroupContainer GetResourceGroups()
{
return new ResourceGroupContainer(this);
}

/// <summary>
/// Gets the location group container under this subscription
/// Gets the location group container under this subscription.
/// </summary>
/// <returns> The resource group container. </returns>
public virtual LocationContainer GetLocationContainer()
public virtual LocationContainer GetLocations()
{
return new LocationContainer(this);
}
Expand Down
Loading