diff --git a/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs b/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs index aa35719f44726..b1173d7bd2ca7 100644 --- a/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs +++ b/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs @@ -19,13 +19,13 @@ public abstract class ManagementRecordedTestBase : 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) { @@ -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( + return CreateClient( TestEnvironment.SubscriptionId, TestEnvironment.Credential, options); @@ -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( + GlobalClient = CreateClient( SessionEnvironment.SubscriptionId, SessionEnvironment.Credential, options); diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs index c4873eafb3db2..e4709fb347e9e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs @@ -20,12 +20,12 @@ namespace Azure.ResourceManager.Core public class ApiVersions { private ProvidersOperations ProviderOperations; - private AzureResourceManagerClientOptions _clientOptions; + private ArmClientOptions _clientOptions; /// /// Initializes a new instance of the class. /// - internal ApiVersions(AzureResourceManagerClientOptions clientOptions) + internal ApiVersions(ArmClientOptions clientOptions) { BuildApiTable(clientOptions); _clientOptions = clientOptions; @@ -47,7 +47,7 @@ internal void SetProviderClient(TokenCredential credential, Uri baseUri, string private Dictionary _loadedResourceToApiVersions = new Dictionary(); private Dictionary _nonLoadedResourceToApiVersion = new Dictionary(); - private void BuildApiTable(AzureResourceManagerClientOptions clientOptions) + private void BuildApiTable(ArmClientOptions clientOptions) { var methods = GetExtensionMethods(); foreach (var method in methods) @@ -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; } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClient.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs similarity index 83% rename from sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClient.cs rename to sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs index ac17d0a2cebcf..7d81de5b6dadd 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClient.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Core /// /// The entry point for all ARM clients. /// - public class AzureResourceManagerClient + public class ArmClient { /// /// The base URI of the service. @@ -29,75 +29,76 @@ public class AzureResourceManagerClient /// public TenantOperations Tenant => _tenant ??= new TenantOperations(_clientOptions, _credentials, _baseUri); - private readonly AzureResourceManagerClientOptions _clientOptions; + private readonly ArmClientOptions _clientOptions; /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// - protected AzureResourceManagerClient() + protected ArmClient() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// A credential used to authenticate to an Azure Service. /// The client parameters to use in these operations. /// If is null. - public AzureResourceManagerClient(TokenCredential credential, AzureResourceManagerClientOptions options = default) + public ArmClient(TokenCredential credential, ArmClientOptions options = default) : this(null, null, credential, options) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The id of the default Azure subscription. /// A credential used to authenticate to an Azure Service. /// The client parameters to use in these operations. /// If is null. - public AzureResourceManagerClient( + public ArmClient( string defaultSubscriptionId, TokenCredential credential, - AzureResourceManagerClientOptions options = default) + ArmClientOptions options = default) : this(defaultSubscriptionId, null, credential, options) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The base URI of the Azure management endpoint. /// A credential used to authenticate to an Azure Service. /// The client parameters to use in these operations. /// If is null. - public AzureResourceManagerClient( + public ArmClient( Uri baseUri, TokenCredential credential, - AzureResourceManagerClientOptions options = default) + ArmClientOptions options = default) : this(null, baseUri, credential, options) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The id of the default Azure subscription. /// The base URI of the service. /// A credential used to authenticate to an Azure Service. /// The client parameters to use in these operations. - 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; @@ -124,7 +125,7 @@ private AzureResourceManagerClient( /// Gets the Azure subscriptions. /// /// Subscription container. - public virtual SubscriptionContainer GetSubscriptionContainer() + public virtual SubscriptionContainer GetSubscriptions() { return new SubscriptionContainer(_clientOptions, _credentials, _baseUri); } @@ -172,7 +173,7 @@ public virtual T GetResourceOperations(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; diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClientOptions.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs similarity index 89% rename from sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClientOptions.cs rename to sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs index 437bf451457cb..ab1ff49ced015 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClientOptions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Core /// /// A class representing Azure resource manager client options. /// - public sealed class AzureResourceManagerClientOptions : ClientOptions + public sealed class ArmClientOptions : ClientOptions { private readonly ConcurrentDictionary _overrides = new ConcurrentDictionary(); @@ -26,29 +26,29 @@ public sealed class AzureResourceManagerClientOptions : ClientOptions public ApiVersions ApiVersions { get; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public AzureResourceManagerClientOptions() + public ArmClientOptions() : this(LocationData.Default, null) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The default location to use if can't be inherited from parent. - public AzureResourceManagerClientOptions(LocationData defaultLocation) + public ArmClientOptions(LocationData defaultLocation) : this(defaultLocation, null) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The default location to use if can't be inherited from parent. /// The client parameters to use in these operations. /// If is null. - internal AzureResourceManagerClientOptions(LocationData defaultLocation, AzureResourceManagerClientOptions other = null) + internal ArmClientOptions(LocationData defaultLocation, ArmClientOptions other = null) { if (defaultLocation is null) throw new ArgumentNullException(nameof(defaultLocation)); @@ -150,7 +150,7 @@ public object GetOverrideObject(Func 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) diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ContainerBase.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ContainerBase.cs index 229478888eb30..b434205c7609e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ContainerBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ContainerBase.cs @@ -31,7 +31,7 @@ protected ContainerBase() /// The identifier of the resource that is the target of operations. /// A credential used to authenticate to an Azure Service. /// The base URI of the service. - 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) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResource.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResource.cs index 7117ee929f580..677ca3c7bcb43 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResource.cs @@ -18,7 +18,7 @@ public class GenericResource : GenericResourceOperations /// /// The operations object to copy the client parameters from. /// The data model representing the generic azure resource. - /// If or is null. + /// If or is null. internal GenericResource(ResourceOperationsBase operations, GenericResourceData resource) : base(operations, resource.Id) { diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs index b8342b36b658c..8c3a793183ca8 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs @@ -27,7 +27,7 @@ protected OperationsBase() /// The identifier of the resource that is the target of operations. /// A credential used to authenticate to an Azure Service. /// The base URI of the service. - protected OperationsBase(AzureResourceManagerClientOptions options, ResourceIdentifier id, TokenCredential credential, Uri baseUri) + protected OperationsBase(ArmClientOptions options, ResourceIdentifier id, TokenCredential credential, Uri baseUri) { ClientOptions = options; Id = id; @@ -47,7 +47,7 @@ protected OperationsBase(AzureResourceManagerClientOptions options, ResourceIden /// /// Gets the Azure Resource Manager client options. /// - public virtual AzureResourceManagerClientOptions ClientOptions { get; } + public virtual ArmClientOptions ClientOptions { get; } /// /// Gets the Azure credential. diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceOperationsBase.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceOperationsBase.cs index 6f5cd988b5056..1fddc2bf402a6 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceOperationsBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceOperationsBase.cs @@ -58,7 +58,7 @@ protected ResourceOperationsBase(ResourceOperationsBase options, ResourceIdentif /// The identifier of the resource that is the target of operations. /// A credential used to authenticate to an Azure Service. /// The base URI of the service. - 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) { } @@ -106,7 +106,7 @@ protected ResourceOperationsBase(ResourceOperationsBase parentOperations, Resour /// The identifier of the resource that is the target of operations. /// A credential used to authenticate to an Azure Service. /// The base URI of the service. - 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) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/LocationContainer.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/LocationContainer.cs index 2b7133da62d5c..18d5dabe0d3d1 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/LocationContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/LocationContainer.cs @@ -40,7 +40,7 @@ internal LocationContainer(SubscriptionOperations subscriptionOperations) /// Gets the Azure subscriptions. /// /// Subscription container. - public SubscriptionContainer GetSubscriptionContainer() + public SubscriptionContainer GetSubscriptions() { return new SubscriptionContainer(ClientOptions, Credential, BaseUri); } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionContainer.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionContainer.cs index 161526d149197..90f564f256e81 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionContainer.cs @@ -20,7 +20,7 @@ public class SubscriptionContainer : ContainerBase The client parameters to use in these operations. /// A credential used to authenticate to an Azure Service. /// The base URI of the service. - internal SubscriptionContainer(AzureResourceManagerClientOptions options, TokenCredential credential, Uri baseUri) + internal SubscriptionContainer(ArmClientOptions options, TokenCredential credential, Uri baseUri) : base(options, null, credential, baseUri) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionOperations.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionOperations.cs index bfba8c4126289..a67ea74f2617b 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionOperations.cs @@ -33,7 +33,7 @@ protected SubscriptionOperations() /// The Id of the subscription. /// A credential used to authenticate to an Azure Service. /// The base URI of the service. - 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) { } @@ -72,19 +72,19 @@ public virtual ResourceGroupOperations GetResourceGroupOperations(string resourc } /// - /// Gets the resource group container under this subscription + /// Gets the resource group container under this subscription. /// /// The resource group container. - public virtual ResourceGroupContainer GetResourceGroupContainer() + public virtual ResourceGroupContainer GetResourceGroups() { return new ResourceGroupContainer(this); } /// - /// Gets the location group container under this subscription + /// Gets the location group container under this subscription. /// /// The resource group container. - public virtual LocationContainer GetLocationContainer() + public virtual LocationContainer GetLocations() { return new LocationContainer(this); } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/TenantOperations.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/TenantOperations.cs index fa108fa44a133..adfc14c1559bb 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/TenantOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/TenantOperations.cs @@ -26,7 +26,7 @@ public class TenantOperations : OperationsBase /// The client parameters to use in these operations. /// A credential used to authenticate to an Azure Service. /// The base URI of the service. - internal TenantOperations(AzureResourceManagerClientOptions options, TokenCredential credential, Uri baseUri) + internal TenantOperations(ArmClientOptions options, TokenCredential credential, Uri baseUri) : base(options, ResourceIdentifier.RootResourceIdentifier, credential, baseUri) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ArmBuilderTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ArmBuilderTests.cs index 105ab26060012..07ce4b44e1bd3 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ArmBuilderTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ArmBuilderTests.cs @@ -6,7 +6,7 @@ namespace Azure.ResourceManager.Core.Tests { public class ArmBuilderTests : ResourceManagerTestBase { - private AzureResourceManagerClient _client; + private ArmClient _client; public ArmBuilderTests(bool isAsync) : base(isAsync)//, RecordedTestMode.Record) @@ -24,7 +24,7 @@ public void SetUp() [RecordedTest] public void TestCreateOrUpdate(string value) { - Assert.ThrowsAsync(async delegate { await _client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(value); }); + Assert.ThrowsAsync(async delegate { await _client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(value); }); } [TestCase(null)] @@ -32,7 +32,7 @@ public void TestCreateOrUpdate(string value) [RecordedTest] public void TestStartCreateOrUpdate(string value) { - Assert.ThrowsAsync(async delegate { await _client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).StartCreateOrUpdateAsync(value); }); + Assert.ThrowsAsync(async delegate { await _client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).StartCreateOrUpdateAsync(value); }); } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ContainerTryGetTest.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ContainerTryGetTest.cs index 2a4d95d6c8f64..7426d702106cd 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ContainerTryGetTest.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ContainerTryGetTest.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Core.Tests { public class ContainerTryGetTest : ResourceManagerTestBase { - private AzureResourceManagerClient _client; + private ArmClient _client; private ResourceGroupContainer _container; private ResourceGroup _resourceGroup; private string _rgName; @@ -25,7 +25,7 @@ public void SetUp() { _rgName = Recording.GenerateAssetName("CoreRg"); _client = GetArmClient(); - _container = _client.DefaultSubscription.GetResourceGroupContainer(); + _container = _client.DefaultSubscription.GetResourceGroups(); _resourceGroup = _container.Construct(LocationData.WestUS2).CreateOrUpdate(_rgName); } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/GenericResourceTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/GenericResourceTests.cs index 73bfcbdfb4e5f..56e811bd3c56d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/GenericResourceTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/GenericResourceTests.cs @@ -26,7 +26,7 @@ public void LocalOneTimeSetup() { _rgName = SessionRecording.GenerateAssetName("testRg-"); var subscriptionOperations = GlobalClient.GetSubscriptionOperations(SessionEnvironment.SubscriptionId); - _ = subscriptionOperations.GetResourceGroupContainer().Construct(_location).StartCreateOrUpdateAsync(_rgName).ConfigureAwait(false).GetAwaiter().GetResult().Value; + _ = subscriptionOperations.GetResourceGroups().Construct(_location).StartCreateOrUpdateAsync(_rgName).ConfigureAwait(false).GetAwaiter().GetResult().Value; StopSessionRecording(); } @@ -35,7 +35,7 @@ public void LocalOneTimeSetup() public async Task GetGenericsConfirmException() { var asetid = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/{_rgName}/providers/Microsoft.Compute/availabilitySets/testavset"; - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); _ = GetArmClient(options); // setup providers client var subOp = Client.GetSubscriptionOperations(TestEnvironment.SubscriptionId); var genericResourceOperations = new GenericResourceOperations(subOp, asetid); @@ -56,7 +56,7 @@ public async Task GetGenericsConfirmException() public async Task GetGenericsBadNameSpace() { var asetid = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/{_rgName}/providers/Microsoft.NotAValidNameSpace123/availabilitySets/testavset"; - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); _ = GetArmClient(options); // setup providers client var subOp = Client.GetSubscriptionOperations(TestEnvironment.SubscriptionId); var genericResourceOperations = new GenericResourceOperations(subOp, asetid); @@ -76,7 +76,7 @@ public async Task GetGenericsBadNameSpace() public async Task GetGenericsBadApiVersion() { ResourceGroupResourceIdentifier rgid = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/{_rgName}"; - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); options.ApiVersions.SetApiVersion(rgid.ResourceType, "1500-10-10"); var client = GetArmClient(options); var subOp = client.GetSubscriptionOperations(TestEnvironment.SubscriptionId); @@ -97,7 +97,7 @@ public async Task GetGenericsBadApiVersion() public async Task GetGenericsGoodApiVersion() { ResourceGroupResourceIdentifier rgid = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/{_rgName}"; - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); var client = GetArmClient(options); var subOp = client.GetSubscriptionOperations(TestEnvironment.SubscriptionId); var genericResourceOperations = new GenericResourceOperations(subOp, rgid); diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceGroupContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceGroupContainerTests.cs index d71f3b7ac21fb..53b1e65a230d9 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceGroupContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceGroupContainerTests.cs @@ -19,10 +19,10 @@ public ResourceGroupContainerTests(bool isAsync) [RecordedTest] public async Task List() { - _ = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testRg-")); - _ = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testRg-")); + _ = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testRg-")); + _ = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testRg-")); int count = 0; - await foreach(var rg in Client.DefaultSubscription.GetResourceGroupContainer().ListAsync()) + await foreach(var rg in Client.DefaultSubscription.GetResourceGroups().ListAsync()) { count++; } @@ -34,7 +34,7 @@ public async Task List() public async Task Create() { string rgName = Recording.GenerateAssetName("testRg-"); - ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(rgName); + ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(rgName); Assert.AreEqual(rgName, rg.Data.Name); } @@ -43,7 +43,7 @@ public async Task Create() public async Task StartCreate() { string rgName = Recording.GenerateAssetName("testRg-"); - var rgOp = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).StartCreateOrUpdateAsync(rgName); + var rgOp = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).StartCreateOrUpdateAsync(rgName); ResourceGroup rg = await rgOp.WaitForCompletionAsync(); Assert.AreEqual(rgName, rg.Data.Name); } @@ -53,8 +53,8 @@ public async Task StartCreate() public async Task Get() { string rgName = Recording.GenerateAssetName("testRg-"); - ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(rgName); - ResourceGroup rg2 = await Client.DefaultSubscription.GetResourceGroupContainer().GetAsync(rgName); + ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(rgName); + ResourceGroup rg2 = await Client.DefaultSubscription.GetResourceGroups().GetAsync(rgName); Assert.AreEqual(rg.Data.Name, rg2.Data.Name); } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceGroupOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceGroupOperationsTests.cs index db593a5394542..e65f82b4b4375 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceGroupOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceGroupOperationsTests.cs @@ -18,7 +18,7 @@ public ResourceGroupOperationsTests(bool isAsync) [RecordedTest] public async Task DeleteRg() { - ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); + ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); await rg.DeleteAsync(); } @@ -26,7 +26,7 @@ public async Task DeleteRg() [RecordedTest] public async Task StartDeleteRg() { - var rgOp = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).StartCreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); + var rgOp = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).StartCreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); ResourceGroup rg = await rgOp.WaitForCompletionAsync(); var deleteOp = await rg.StartDeleteAsync(); await deleteOp.WaitForCompletionAsync(); @@ -36,7 +36,7 @@ public async Task StartDeleteRg() [RecordedTest] public async Task Get() { - ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); + ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); await rg.GetAsync(); } @@ -44,7 +44,7 @@ public async Task Get() [RecordedTest] public async Task ListAvailableLocations() { - ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); + ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); var locations = await rg.ListAvailableLocationsAsync(); int count = 0; foreach(var location in locations) diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceManagerTestBase.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceManagerTestBase.cs index a07189ec30a71..6940bebc663c7 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceManagerTestBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceManagerTestBase.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Core.Tests [Parallelizable] public class ResourceManagerTestBase : ManagementRecordedTestBase { - protected AzureResourceManagerClient Client { get; private set; } + protected ArmClient Client { get; private set; } protected ResourceManagerTestBase(bool isAsync, RecordedTestMode mode) : base(isAsync, mode) diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/TaggableResourceTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/TaggableResourceTests.cs index d23e081e5ef7a..14d90c26d5c7c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/TaggableResourceTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/TaggableResourceTests.cs @@ -25,7 +25,7 @@ public TaggableResourceTests(bool isAsync) [SetUp] public async Task SetUpAsync() { - _rg = await Client.DefaultSubscription.GetResourceGroupContainer().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName(_rgPrefix)); + _rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName(_rgPrefix)); _rg = await _rg.AddTagAsync("key1", "value1"); _rg = await _rg.AddTagAsync("key2", "value2"); } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ApiVersionsBaseTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ApiVersionsBaseTests.cs index a2d4f59dba4fa..501b9216fae11 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ApiVersionsBaseTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ApiVersionsBaseTests.cs @@ -9,15 +9,15 @@ public class ApiVersionsBaseTests [TestCase] public void VersionToString() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); Assert.AreEqual("2020-06-01", options.FakeRestApiVersions().FakeResourceVersion); } [TestCase] public void EqualsOperator() { - AzureResourceManagerClientOptions options1 = new AzureResourceManagerClientOptions(); - AzureResourceManagerClientOptions options2 = new AzureResourceManagerClientOptions(); + ArmClientOptions options1 = new ArmClientOptions(); + ArmClientOptions options2 = new ArmClientOptions(); Assert.IsTrue(options1.FakeRestApiVersions().FakeResourceVersion == options2.FakeRestApiVersions().FakeResourceVersion); } @@ -25,7 +25,7 @@ public void EqualsOperator() [TestCase] public void EqualsOperatorString() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); Assert.IsTrue(FakeResourceApiVersions.Default == options.FakeRestApiVersions().FakeResourceVersion); } @@ -33,7 +33,7 @@ public void EqualsOperatorString() [TestCase] public void EqualsOperatorStringFirstNull() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); Assert.IsFalse(null == options.FakeRestApiVersions().FakeResourceVersion); } @@ -41,7 +41,7 @@ public void EqualsOperatorStringFirstNull() [TestCase] public void EqualsOperatorStringSecondNull() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); Assert.IsFalse(options.FakeRestApiVersions().FakeResourceVersion == null); } @@ -57,8 +57,8 @@ public void EqualsOperatorStringBothNull() [TestCase] public void NotEqualsOperator() { - AzureResourceManagerClientOptions options1 = new AzureResourceManagerClientOptions(); - AzureResourceManagerClientOptions options2 = new AzureResourceManagerClientOptions(); + ArmClientOptions options1 = new ArmClientOptions(); + ArmClientOptions options2 = new ArmClientOptions(); Assert.IsFalse(options1.FakeRestApiVersions().FakeResourceVersion != options2.FakeRestApiVersions().FakeResourceVersion); } @@ -66,7 +66,7 @@ public void NotEqualsOperator() [TestCase] public void NotEqualsOperatorStringFirstNull() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); Assert.IsTrue(null != options.FakeRestApiVersions().FakeResourceVersion); } @@ -74,7 +74,7 @@ public void NotEqualsOperatorStringFirstNull() [TestCase] public void NotEqualsOperatorStringSecondNull() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); Assert.IsTrue(options.FakeRestApiVersions().FakeResourceVersion != null); } @@ -90,8 +90,8 @@ public void NotEqualsOperatorStringBothNull() [TestCase] public void EqualsMethod() { - AzureResourceManagerClientOptions options1 = new AzureResourceManagerClientOptions(); - AzureResourceManagerClientOptions options2 = new AzureResourceManagerClientOptions(); + ArmClientOptions options1 = new ArmClientOptions(); + ArmClientOptions options2 = new ArmClientOptions(); Assert.IsTrue(options1.FakeRestApiVersions().FakeResourceVersion.Equals(options2.FakeRestApiVersions().FakeResourceVersion)); } @@ -99,7 +99,7 @@ public void EqualsMethod() [TestCase] public void EqualsMethodVersionNull() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); FakeResourceApiVersions version = null; Assert.IsFalse(options.FakeRestApiVersions().FakeResourceVersion.Equals(version)); } @@ -107,7 +107,7 @@ public void EqualsMethodVersionNull() [TestCase] public void EqualsMethodStringNull() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); string version = null; Assert.IsFalse(options.FakeRestApiVersions().FakeResourceVersion.Equals(version)); } @@ -115,8 +115,8 @@ public void EqualsMethodStringNull() [TestCase] public void EqualsMethodAsObject() { - AzureResourceManagerClientOptions options1 = new AzureResourceManagerClientOptions(); - AzureResourceManagerClientOptions options2 = new AzureResourceManagerClientOptions(); + ArmClientOptions options1 = new ArmClientOptions(); + ArmClientOptions options2 = new ArmClientOptions(); object obj = options2.FakeRestApiVersions().FakeResourceVersion; Assert.IsTrue(options1.FakeRestApiVersions().FakeResourceVersion.Equals(obj)); @@ -125,8 +125,8 @@ public void EqualsMethodAsObject() [TestCase] public void EqualsMethodAsObjectThatIsString() { - AzureResourceManagerClientOptions options1 = new AzureResourceManagerClientOptions(); - AzureResourceManagerClientOptions options2 = new AzureResourceManagerClientOptions(); + ArmClientOptions options1 = new ArmClientOptions(); + ArmClientOptions options2 = new ArmClientOptions(); object obj = options2.FakeRestApiVersions().FakeResourceVersion.ToString(); Assert.IsTrue(options1.FakeRestApiVersions().FakeResourceVersion.Equals(obj)); @@ -135,7 +135,7 @@ public void EqualsMethodAsObjectThatIsString() [TestCase] public void EqualsMethodAsObjectThatIsInt() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); object obj = 1; Assert.IsFalse(options.FakeRestApiVersions().FakeResourceVersion.Equals(obj)); @@ -144,7 +144,7 @@ public void EqualsMethodAsObjectThatIsInt() [TestCase] public void ImplicitToString() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); options.FakeRestApiVersions().FakeResourceVersion = FakeResourceApiVersions.V2019_12_01; string version = options.FakeRestApiVersions().FakeResourceVersion; Assert.IsTrue(version == "2019-12-01"); diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs index 235b23ef7c51f..f217d22e920c1 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs @@ -10,15 +10,15 @@ public class AzureResourceManagerClientOptionsTests [TestCase] public void VersionIsDefault() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); Assert.AreEqual(FakeResourceApiVersions.Default, options.FakeRestApiVersions().FakeResourceVersion); } [TestCase] public void MultiClientSeparateVersions() { - AzureResourceManagerClientOptions options1 = new AzureResourceManagerClientOptions(); - AzureResourceManagerClientOptions options2 = new AzureResourceManagerClientOptions(); + ArmClientOptions options1 = new ArmClientOptions(); + ArmClientOptions options2 = new ArmClientOptions(); options2.FakeRestApiVersions().FakeResourceVersion = FakeResourceApiVersions.V2019_12_01; Assert.AreEqual(FakeResourceApiVersions.Default, options1.FakeRestApiVersions().FakeResourceVersion); @@ -28,17 +28,17 @@ public void MultiClientSeparateVersions() [TestCase] public void TestClientOptionsParamCheck() { - Assert.Throws(() => { new AzureResourceManagerClientOptions(null); }); - Assert.Throws(() => { new AzureResourceManagerClientOptions(null, null); }); + Assert.Throws(() => { new ArmClientOptions(null); }); + Assert.Throws(() => { new ArmClientOptions(null, null); }); - var options = new AzureResourceManagerClientOptions(); + var options = new ArmClientOptions(); Assert.Throws(() => { options.AddPolicy(null, HttpPipelinePosition.PerCall); }); } [TestCase] public void VersionExist() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); options.FakeRestApiVersions().FakeResourceVersion = FakeResourceApiVersions.V2019_12_01; string result = options.ApiVersions.TryGetApiVersion(options.FakeRestApiVersions().FakeResourceVersion.ResourceType); Assert.NotNull(result); @@ -47,7 +47,7 @@ public void VersionExist() [TestCase] public void VersionLoadedChanges() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); options.FakeRestApiVersions().FakeResourceVersion = FakeResourceApiVersions.V2019_12_01; string result = options.ApiVersions.TryGetApiVersion(options.FakeRestApiVersions().FakeResourceVersion.ResourceType); Assert.True(result.Equals(FakeResourceApiVersions.V2019_12_01)); @@ -60,7 +60,7 @@ public void VersionLoadedChanges() [TestCase] public void VersionsLoadedChangeSet() { - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); options.ApiVersions.SetApiVersion(options.FakeRestApiVersions().FakeResourceVersion.ResourceType.ToString(), "2021-01-01-beta"); string result = options.ApiVersions.TryGetApiVersion(options.FakeRestApiVersions().FakeResourceVersion.ResourceType.ToString()); Assert.True(result.Equals("2021-01-01-beta")); @@ -75,7 +75,7 @@ public void VersionNonLoadedChanges() { var apiVersions = "2019-10-01"; var providerName = "providers/Microsoft.Logic/LogicApps"; - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); options.ApiVersions.SetApiVersion(providerName, apiVersions); string result = options.ApiVersions.TryGetApiVersion(providerName); Assert.True(result.Equals(apiVersions)); @@ -90,7 +90,7 @@ public void VersionNonLoadedChanges() public void TestKeyDoesNotExist() { var providerName = "providers/Microsoft.Logic/LogicApps"; - AzureResourceManagerClientOptions options = new AzureResourceManagerClientOptions(); + ArmClientOptions options = new ArmClientOptions(); string result = options.ApiVersions.TryGetApiVersion(providerName); Assert.Null(result); } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientTests.cs index b42c3afbf2a6d..949baf2be3242 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientTests.cs @@ -17,9 +17,9 @@ public void CreateResourceFromId() [TestCase] public void TestArmClientParamCheck() { - Assert.Throws(() => { new AzureResourceManagerClient(null, null); }); - Assert.Throws(() => { new AzureResourceManagerClient(baseUri:null, null, null); }); - Assert.Throws(() => { new AzureResourceManagerClient(defaultSubscriptionId: null, null, null); }); + Assert.Throws(() => { new ArmClient(null, null); }); + Assert.Throws(() => { new ArmClient(baseUri:null, null, null); }); + Assert.Throws(() => { new ArmClient(defaultSubscriptionId: null, null, null); }); } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ResourceListOperationsTest.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ResourceListOperationsTest.cs index a3ea91900e7c8..aa10d32142b21 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ResourceListOperationsTest.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ResourceListOperationsTest.cs @@ -97,7 +97,7 @@ private static ResourceGroupOperations GetResourceGroupOperations() { var rgOp = new ResourceGroupOperations( new SubscriptionOperations( - new AzureResourceManagerClientOptions(), + new ArmClientOptions(), Guid.Empty.ToString(), new DefaultAzureCredential(), //should make a fake credential creation new Uri("http://foo.com")), diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/RpImplementations/ArmClientOptionsExtensions.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/RpImplementations/ArmClientOptionsExtensions.cs index 451a119678240..8c71d2bddd1ce 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/RpImplementations/ArmClientOptionsExtensions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/RpImplementations/ArmClientOptionsExtensions.cs @@ -2,7 +2,7 @@ { public static class AzureResourceManagerClientOptionsExtensions { - public static FakeRpApiVersions FakeRestApiVersions(this AzureResourceManagerClientOptions AzureResourceManagerClientOptions) + public static FakeRpApiVersions FakeRestApiVersions(this ArmClientOptions AzureResourceManagerClientOptions) { return AzureResourceManagerClientOptions.GetOverrideObject(() => new FakeRpApiVersions()) as FakeRpApiVersions; } diff --git a/sdk/resourcemanager/Proto.Client/billing/BillingAccountOperations.cs b/sdk/resourcemanager/Proto.Client/billing/BillingAccountOperations.cs index 4290c1278e7f3..5b9c2534038e8 100644 --- a/sdk/resourcemanager/Proto.Client/billing/BillingAccountOperations.cs +++ b/sdk/resourcemanager/Proto.Client/billing/BillingAccountOperations.cs @@ -25,7 +25,7 @@ internal BillingAccountOperations(GenericResourceOperations genericOperations) } //TODO : dicuss ways to not pass in Subscription subscription for tenant only resources - internal BillingAccountOperations(AzureResourceManagerClientOptions options, string billingAccountId, TokenCredential credential, Uri baseUri) + internal BillingAccountOperations(ArmClientOptions options, string billingAccountId, TokenCredential credential, Uri baseUri) : base(options, $"/providers/{ResourceType}/{billingAccountId}", credential, baseUri) { } diff --git a/sdk/resourcemanager/Proto.Client/compute/Extensions/ArmClientExtensions.cs b/sdk/resourcemanager/Proto.Client/compute/Extensions/ArmClientExtensions.cs index e283e86aba454..15c8117ceb0b4 100644 --- a/sdk/resourcemanager/Proto.Client/compute/Extensions/ArmClientExtensions.cs +++ b/sdk/resourcemanager/Proto.Client/compute/Extensions/ArmClientExtensions.cs @@ -12,12 +12,12 @@ public static class ArmClientExtensions /// /// Gets the AvailabilitySetOperations. /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The ResourceIdentifier of the resource that is the target of operations. /// Returns an object representing the operations that can be performed over a specific . /// ResourceIdentifier provided is not for an AvailabilitySet. /// ResourceIdentifier cannot be null. - public static AvailabilitySetOperations GetAvailabilitySetOperations(this AzureResourceManagerClient client, ResourceGroupResourceIdentifier resourceId) + public static AvailabilitySetOperations GetAvailabilitySetOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) { if (resourceId is null) throw new ArgumentNullException(nameof(resourceId)); @@ -30,12 +30,12 @@ public static AvailabilitySetOperations GetAvailabilitySetOperations(this AzureR /// /// Gets the VirtualMachineOperations. /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The ResourceIdentifier of the resource that is the target of operations. /// Returns an object representing the operations that can be performed over a specific . /// ResourceIdentifier provided is not for a VirtualMachine. /// ResourceIdentifier cannot be null. - public static VirtualMachineOperations GetVirtualMachineOperations(this AzureResourceManagerClient client, ResourceGroupResourceIdentifier resourceId) + public static VirtualMachineOperations GetVirtualMachineOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) { if (resourceId is null) throw new ArgumentNullException(nameof(resourceId)); diff --git a/sdk/resourcemanager/Proto.Client/compute/Extensions/AzureResourceManagerClientOptionsExtensions.cs b/sdk/resourcemanager/Proto.Client/compute/Extensions/AzureResourceManagerClientOptionsExtensions.cs index de3bb64817512..6f067253b3448 100644 --- a/sdk/resourcemanager/Proto.Client/compute/Extensions/AzureResourceManagerClientOptionsExtensions.cs +++ b/sdk/resourcemanager/Proto.Client/compute/Extensions/AzureResourceManagerClientOptionsExtensions.cs @@ -3,18 +3,18 @@ namespace Proto.Compute.Extensions { /// - /// A class to add extension methods to AzureResourceManagerClientOptions. + /// A class to add extension methods to ArmClientOptions. /// - public static class AzureResourceManagerClientOptionsExtensions + public static class ArmClientOptionsExtensions { /// - /// Adds a method to AzureResourceManagerClientOptions which returns all the versions to all resources inside the compute resource provider. + /// Adds a method to ArmClientOptions which returns all the versions to all resources inside the compute resource provider. /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// Returns a response with the operation for this resource. - public static ComputeRestApiVersions GetComputeRestApiVersions(this AzureResourceManagerClientOptions azureResourceManagerClientOptions) + public static ComputeRestApiVersions GetComputeRestApiVersions(this ArmClientOptions ArmClientOptions) { - return azureResourceManagerClientOptions.GetOverrideObject(() => new ComputeRestApiVersions()) as ComputeRestApiVersions; + return ArmClientOptions.GetOverrideObject(() => new ComputeRestApiVersions()) as ComputeRestApiVersions; } } } diff --git a/sdk/resourcemanager/Proto.Client/compute/Extensions/ResourceGroupExtensions.cs b/sdk/resourcemanager/Proto.Client/compute/Extensions/ResourceGroupExtensions.cs index 1031a20918536..fd74364ebadd2 100644 --- a/sdk/resourcemanager/Proto.Client/compute/Extensions/ResourceGroupExtensions.cs +++ b/sdk/resourcemanager/Proto.Client/compute/Extensions/ResourceGroupExtensions.cs @@ -28,7 +28,7 @@ public static VirtualMachineOperations GetVirtualMachineOperations(this Resource /// /// The instance the method will execute against. /// Returns a object. - public static VirtualMachineContainer GetVirtualMachineContainer(this ResourceGroupOperations resourceGroup) + public static VirtualMachineContainer GetVirtualMachines(this ResourceGroupOperations resourceGroup) { return new VirtualMachineContainer(resourceGroup); } @@ -54,7 +54,7 @@ public static AvailabilitySetOperations GetAvailabilitySetOperations(this Resour /// /// The instance the method will execute against. /// Returns an object. - public static AvailabilitySetContainer GetAvailabilitySetContainer(this ResourceGroupOperations resourceGroup) + public static AvailabilitySetContainer GetAvailabilitySets(this ResourceGroupOperations resourceGroup) { return new AvailabilitySetContainer(resourceGroup); } diff --git a/sdk/resourcemanager/Proto.Client/network/Extensions/ArmClientExtensions.cs b/sdk/resourcemanager/Proto.Client/network/Extensions/ArmClientExtensions.cs index c1474cc3b6286..fcff6c2ee0987 100644 --- a/sdk/resourcemanager/Proto.Client/network/Extensions/ArmClientExtensions.cs +++ b/sdk/resourcemanager/Proto.Client/network/Extensions/ArmClientExtensions.cs @@ -12,12 +12,12 @@ public static class ArmClientExtensions /// /// Gets the NetworkInterfaceOperations. /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The ResourceIdentifier of the resource that is the target of operations. /// Returns an object representing the operations that can be performed over a specific . /// ResourceIdentifier provided is not for a NetworkInterfaceOperations. /// ResourceIdentifier cannot be null. - public static NetworkInterfaceOperations GetNetworkInterfaceOperations(this AzureResourceManagerClient client, ResourceGroupResourceIdentifier resourceId) + public static NetworkInterfaceOperations GetNetworkInterfaceOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) { if (resourceId is null) throw new ArgumentNullException(nameof(resourceId)); @@ -32,12 +32,12 @@ public static NetworkInterfaceOperations GetNetworkInterfaceOperations(this Azur /// /// Gets the NetworkSecurityGroupOperations. /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The ResourceIdentifier of the resource that is the target of operations. /// Returns an object representing the operations that can be performed over a specific . /// ResourceIdentifier provided is not for a NetworkSecurityGroup. /// ResourceIdentifier cannot be null. - public static NetworkSecurityGroupOperations GetNetworkSecurityGroupOperations(this AzureResourceManagerClient client, ResourceGroupResourceIdentifier resourceId) + public static NetworkSecurityGroupOperations GetNetworkSecurityGroupOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) { if (resourceId is null) throw new ArgumentNullException(nameof(resourceId)); @@ -52,12 +52,12 @@ public static NetworkSecurityGroupOperations GetNetworkSecurityGroupOperations(t /// /// Gets the PublicIpAddressOperations. /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The ResourceIdentifier of the resource that is the target of operations. /// Returns an object representing the operations that can be performed over a specific . /// ResourceIdentifier provided is not for a PublicIpAddress. /// ResourceIdentifier cannot be null. - public static PublicIpAddressOperations GetPublicIpAddressOperations(this AzureResourceManagerClient client, ResourceGroupResourceIdentifier resourceId) + public static PublicIpAddressOperations GetPublicIpAddressOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) { if (resourceId is null) throw new ArgumentNullException(nameof(resourceId)); @@ -72,12 +72,12 @@ public static PublicIpAddressOperations GetPublicIpAddressOperations(this AzureR /// /// Gets the SubnetOperations. /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The ResourceIdentifier of the resource that is the target of operations. /// Returns an object representing the operations that can be performed over a specific . /// ResourceIdentifier provided is not for a Subnet. /// ResourceIdentifier cannot be null. - public static SubnetOperations GetSubnetOperations(this AzureResourceManagerClient client, ResourceGroupResourceIdentifier resourceId) + public static SubnetOperations GetSubnetOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) { if (resourceId is null) throw new ArgumentNullException(nameof(resourceId)); @@ -92,12 +92,12 @@ public static SubnetOperations GetSubnetOperations(this AzureResourceManagerClie /// /// Gets the VirtualNetworkOperations. /// - /// The instance the method will execute against. + /// The instance the method will execute against. /// The ResourceIdentifier of the resource that is the target of operations. /// Returns an object representing the operations that can be performed over a specific . /// ResourceIdentifier provided is not for a VirtualNetwork. /// ResourceIdentifier cannot be null. - public static VirtualNetworkOperations GetVirtualNetworkOperations(this AzureResourceManagerClient client, ResourceGroupResourceIdentifier resourceId) + public static VirtualNetworkOperations GetVirtualNetworkOperations(this ArmClient client, ResourceGroupResourceIdentifier resourceId) { if (resourceId is null) throw new ArgumentNullException(nameof(resourceId)); diff --git a/sdk/resourcemanager/Proto.Client/network/Extensions/ResourceGroupExtensions.cs b/sdk/resourcemanager/Proto.Client/network/Extensions/ResourceGroupExtensions.cs index d112c63016045..77d0b9483a09f 100644 --- a/sdk/resourcemanager/Proto.Client/network/Extensions/ResourceGroupExtensions.cs +++ b/sdk/resourcemanager/Proto.Client/network/Extensions/ResourceGroupExtensions.cs @@ -31,7 +31,7 @@ public static VirtualNetworkOperations GetVirtualNetworkOperations(this Resource /// /// The instance the method will execute against. /// An instance of . - public static VirtualNetworkContainer GetVirtualNetworkContainer(this ResourceGroupOperations resourceGroup) + public static VirtualNetworkContainer GetVirtualNetworks(this ResourceGroupOperations resourceGroup) { return new VirtualNetworkContainer(resourceGroup); } @@ -57,7 +57,7 @@ public static PublicIpAddressOperations GetPublicIpAddressOperations(this Resour /// /// The instance the method will execute against. /// An instance of . - public static PublicIpAddressContainer GetPublicIpAddressContainer(this ResourceGroupOperations resourceGroup) + public static PublicIpAddressContainer GetPublicIpAddresss(this ResourceGroupOperations resourceGroup) { return new PublicIpAddressContainer(resourceGroup); } @@ -83,11 +83,13 @@ public static NetworkInterfaceOperations GetNetworkInterfaceOperations(this Reso /// /// The operations over a specific resource group. /// A representing the collection of - public static NetworkInterfaceContainer GetNetworkInterfaceContainer(this ResourceGroupOperations resourceGroup) + public static NetworkInterfaceContainer GetNetworkInterfaces(this ResourceGroupOperations resourceGroup) { return new NetworkInterfaceContainer(resourceGroup); } + #endregion + #region NetworkSecurityGroups /// /// Gets the operations over the collection of contained in the resource group. /// @@ -107,7 +109,7 @@ public static NetworkSecurityGroupOperations GetNetworkSecurityGroupOperations(t /// /// The instance the method will execute against. /// An instance of . - public static NetworkSecurityGroupContainer GetNetworkSecurityGroupContainer(this ResourceGroupOperations resourceGroup) + public static NetworkSecurityGroupContainer GetNetworkSecurityGroups(this ResourceGroupOperations resourceGroup) { return new NetworkSecurityGroupContainer(resourceGroup); } diff --git a/sdk/resourcemanager/Proto.Client/src/Program.cs b/sdk/resourcemanager/Proto.Client/src/Program.cs index 3f59b92f10dcb..a0a56c5a56e76 100644 --- a/sdk/resourcemanager/Proto.Client/src/Program.cs +++ b/sdk/resourcemanager/Proto.Client/src/Program.cs @@ -19,7 +19,7 @@ static void Main(string[] args) foreach (var rgId in Scenario.CleanUp) { var id = new ResourceGroupResourceIdentifier(rgId); - var rg = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(id.SubscriptionId).GetResourceGroupOperations(id.ResourceGroupName); + var rg = new ArmClient(new DefaultAzureCredential()).GetSubscriptionOperations(id.SubscriptionId).GetResourceGroupOperations(id.ResourceGroupName); Console.WriteLine($"--------Deleting {rg.Id.Name}--------"); try { diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/AddTagToGeneric.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/AddTagToGeneric.cs index 4e59f4c8f967e..610080f0c7d20 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/AddTagToGeneric.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/AddTagToGeneric.cs @@ -12,8 +12,8 @@ public override void Execute() var createVm = new CreateSingleVmExample(Context); createVm.Execute(); - var rgOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); - foreach (var genericOp in rgOp.GetVirtualMachineContainer().ListAsGenericResource(Context.VmName)) + var rgOp = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); + foreach (var genericOp in rgOp.GetVirtualMachines().ListAsGenericResource(Context.VmName)) { Console.WriteLine($"Adding tag to {genericOp.Id}"); genericOp.StartAddTag("tagKey", "tagVaue"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/All.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/All.cs index 16701c88b8735..575d6cc85d94f 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/All.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/All.cs @@ -29,7 +29,7 @@ public override void Execute() foreach (var rgId in CleanUp) { var id = new ResourceGroupResourceIdentifier(rgId); - var rg = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(id); + var rg = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(id); Console.WriteLine($"--------Deleting {rg.Id.Name}--------"); try { diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceExists.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceExists.cs index a665aa668a181..06d26dddf4fa9 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceExists.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceExists.cs @@ -9,9 +9,9 @@ class CheckResourceExists : Scenario { public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subOp = client.DefaultSubscription; - var rgContainer = subOp.GetResourceGroupContainer(); + var rgContainer = subOp.GetResourceGroups(); Console.WriteLine($"Making sure {Context.RgName} doesn't exist yet."); if (rgContainer.DoesExist(Context.RgName)) @@ -29,7 +29,7 @@ public override void Execute() if(rgOutput == null) throw new Exception($"The resource group {Context.RgName} should have existed."); - var asetContainer = rgOutput.GetAvailabilitySetContainer(); + var asetContainer = rgOutput.GetAvailabilitySets(); var asetName = Context.VmName + "_aSet"; Console.WriteLine($"Making sure {asetName} doesn't exist yet."); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupContainerAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupContainerAsync.cs index 45f6e21484657..358db9c0fba1e 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupContainerAsync.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupContainerAsync.cs @@ -19,15 +19,15 @@ public override void Execute() private async System.Threading.Tasks.Task ExecuteAsync() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; CleanUp.Add(resourceGroup.Id); var rgOps = subscription.GetResourceGroupOperations(Context.RgName); - var resourceGroupContainer = subscription.GetResourceGroupContainer(); + var resourceGroupContainer = subscription.GetResourceGroups(); var rg = new Azure.ResourceManager.Resources.Models.ResourceGroup("East US"); var resourceGroupData = new ResourceGroupData(rg); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupOpsAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupOpsAsync.cs index a2b8cdebcb850..09d1c1e5cb120 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupOpsAsync.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/CheckResourceGroupOpsAsync.cs @@ -19,12 +19,12 @@ public override void Execute() private async System.Threading.Tasks.Task ExecuteAsync() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; CleanUp.Add(resourceGroup.Id); var rgOps = subscription.GetResourceGroupOperations(Context.RgName); @@ -50,7 +50,7 @@ await ShouldThrowAsync( // Create AvailabilitySet Console.WriteLine("--------Create AvailabilitySet async--------"); - var aset = (await (await resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").StartCreateOrUpdateAsync(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; + var aset = (await (await resourceGroup.GetAvailabilitySets().Construct("Aligned").StartCreateOrUpdateAsync(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; var data = aset.Get().Value.Data; ShouldThrow( diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ClientOverrides.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ClientOverrides.cs index 5fbe7bb1f1102..d678892908760 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ClientOverrides.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/ClientOverrides.cs @@ -13,23 +13,23 @@ class ClientOptionsOverride : Scenario public override void Execute() { - AzureResourceManagerClientOptions options1 = new AzureResourceManagerClientOptions(); - AzureResourceManagerClientOptions options2 = new AzureResourceManagerClientOptions(); + ArmClientOptions options1 = new ArmClientOptions(); + ArmClientOptions options2 = new ArmClientOptions(); var dummyPolicy1 = new dummyPolicy(); var dummyPolicy2 = new dummyPolicy2(); options1.AddPolicy(dummyPolicy1, HttpPipelinePosition.PerCall); options2.AddPolicy(dummyPolicy2, HttpPipelinePosition.PerCall); - var client1 = new AzureResourceManagerClient(new DefaultAzureCredential(), options1); - var client2 = new AzureResourceManagerClient(new DefaultAzureCredential(), options2); + var client1 = new ArmClient(new DefaultAzureCredential(), options1); + var client2 = new ArmClient(new DefaultAzureCredential(), options2); Console.WriteLine("-----Client 1-----"); - foreach (var sub in client1.GetSubscriptionContainer().List()) + foreach (var sub in client1.GetSubscriptions().List()) { Console.WriteLine($"Found {sub.Data.DisplayName}"); } Console.WriteLine("-----Client 2-----"); - foreach (var sub in client2.GetSubscriptionContainer().List()) + foreach (var sub in client2.GetSubscriptions().List()) { Console.WriteLine($"Found {sub.Data.DisplayName}"); } diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateMultipleVms.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateMultipleVms.cs index 5093383ebfae1..f56d18d105025 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateMultipleVms.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateMultipleVms.cs @@ -15,22 +15,22 @@ public CreateMultipleVms(ScenarioContext context) : base(context) { } public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; CleanUp.Add(resourceGroup.Id); // Create AvailabilitySet Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; + var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; // Create VNet Console.WriteLine("--------Start create VNet--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; + var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; //create subnet Console.WriteLine("--------Start create Subnet--------"); @@ -38,7 +38,7 @@ public override void Execute() //create network security group Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - _ = resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).CreateOrUpdate(Context.NsgName).Value; + _ = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; CreateVms(resourceGroup, aset, subnet); @@ -51,13 +51,13 @@ private void CreateVms(ResourceGroup resourceGroup, AvailabilitySet aset, Subnet { // Create Network Interface Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_{i}_nic").Value; + var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_{i}_nic").Value; // Create VM string num = i % 2 == 0 ? "-e" : "-o"; string name = $"{Context.VmName}{i}{num}"; Console.WriteLine("--------Start create VM {0}--------", i); - var vmOp = resourceGroup.GetVirtualMachineContainer().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdate(name); + var vmOp = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdate(name); operations.Add(vmOp); } diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVMCheckLocation.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVMCheckLocation.cs index a8bc519c4e34f..89e00685acf9a 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVMCheckLocation.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVMCheckLocation.cs @@ -15,12 +15,12 @@ public CreateSingleVMCheckLocation(ScenarioContext context) : base(context) { } public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; CleanUp.Add(resourceGroup.Id); Console.WriteLine("\nResource Group List Available Locations: "); var loc = resourceGroup.ListAvailableLocations(); @@ -31,7 +31,7 @@ public override void Execute() // Create AvailabilitySet Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; + var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; Console.WriteLine("\nAvailability Set List Available Locations: "); loc = aset.ListAvailableLocations(); foreach (var l in loc) @@ -42,7 +42,7 @@ public override void Execute() // Create VNet Console.WriteLine("--------Start create VNet--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; + var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; Console.WriteLine("\nVirtual Network List Available Locations: "); loc = vnet.ListAvailableLocations(); foreach (var l in loc) @@ -56,7 +56,7 @@ public override void Execute() //create network security group Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - var nsg = resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).CreateOrUpdate(Context.NsgName).Value; + var nsg = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; Console.WriteLine("\nNetwork Security Group List Available Locations: "); loc = nsg.ListAvailableLocations(); foreach (var l in loc) @@ -66,7 +66,7 @@ public override void Execute() // Create Network Interface Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; + var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; Console.WriteLine("\nNetwork Interface Container List Available Locations: "); loc = nic.ListAvailableLocations(); foreach (var l in loc) @@ -76,7 +76,7 @@ public override void Execute() // Create VM Console.WriteLine("--------Start create VM--------"); - var vm = resourceGroup.GetVirtualMachineContainer().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; + var vm = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; Console.WriteLine("\nVirtual Machine List Available Locations: "); loc = vm.ListAvailableLocations(); foreach (var l in loc) diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExample.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExample.cs index 6dbf663b01959..9e5f82ec9686d 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExample.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExample.cs @@ -14,22 +14,22 @@ public CreateSingleVmExample(ScenarioContext context) : base(context) { } public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; CleanUp.Add(resourceGroup.Id); // Create AvailabilitySet Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; + var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; // Create VNet Console.WriteLine("--------Start create VNet--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; + var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; //create subnet Console.WriteLine("--------Start create Subnet async--------"); @@ -37,15 +37,15 @@ public override void Execute() //create network security group Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - _ = resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).CreateOrUpdate(Context.NsgName).Value; + _ = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; // Create Network Interface Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; + var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; // Create VM Console.WriteLine("--------Start create VM--------"); - var vm = resourceGroup.GetVirtualMachineContainer().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; + var vm = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; Console.WriteLine("VM ID: " + vm.Id); Console.WriteLine("--------Done create VM--------"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExampleAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExampleAsync.cs index 7b06687a3016a..7f32f38c45c8c 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExampleAsync.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/CreateSingleVmExampleAsync.cs @@ -19,22 +19,22 @@ public override void Execute() private async System.Threading.Tasks.Task ExcuteAsync() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group async {Context.RgName}--------"); - var resourceGroup = (await subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdateAsync(Context.RgName)).Value; + var resourceGroup = (await subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdateAsync(Context.RgName)).Value; CleanUp.Add(resourceGroup.Id); // Create AvailabilitySet Console.WriteLine("--------Start create AvailabilitySet async--------"); - var aset = (await resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").CreateOrUpdateAsync(Context.VmName + "_aSet")).Value; + var aset = (await resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdateAsync(Context.VmName + "_aSet")).Value; // Create VNet Console.WriteLine("--------Start create VNet async--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = (await resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").CreateOrUpdateAsync(vnetName)).Value; + var vnet = (await resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdateAsync(vnetName)).Value; //create subnet Console.WriteLine("--------Start create Subnet async--------"); @@ -42,15 +42,15 @@ private async System.Threading.Tasks.Task ExcuteAsync() //create network security group Console.WriteLine("--------Start create NetworkSecurityGroup async--------"); - _ = (await resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).CreateOrUpdateAsync(Context.NsgName)).Value; + _ = (await resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdateAsync(Context.NsgName)).Value; // Create Network Interface Console.WriteLine("--------Start create Network Interface async--------"); - var nic = (await resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).CreateOrUpdateAsync($"{Context.VmName}_nic")).Value; + var nic = (await resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdateAsync($"{Context.VmName}_nic")).Value; // Create VM Console.WriteLine("--------Start create VM async--------"); - var vm = (await resourceGroup.GetVirtualMachineContainer().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdateAsync(Context.VmName)).Value; + var vm = (await resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdateAsync(Context.VmName)).Value; Console.WriteLine("VM ID: " + vm.Id); Console.WriteLine("--------Done create VM--------"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/DefaultSubscription.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/DefaultSubscription.cs index 7085cc73505ac..4552153e39ed0 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/DefaultSubscription.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/DefaultSubscription.cs @@ -8,7 +8,7 @@ class DefaultSubscription : Scenario { public override void Execute() { - var client = new AzureResourceManagerClient(Context.SubscriptionId, new DefaultAzureCredential()); + var client = new ArmClient(Context.SubscriptionId, new DefaultAzureCredential()); var sub = client.DefaultSubscription; diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/DeleteGeneric.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/DeleteGeneric.cs index 38446bc0876a0..d6d9bd0379b2f 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/DeleteGeneric.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/DeleteGeneric.cs @@ -13,8 +13,8 @@ public override void Execute() var createVm = new CreateSingleVmExample(Context); createVm.Execute(); - var rgOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); - foreach(var genericOp in rgOp.GetVirtualMachineContainer().ListAsGenericResource(Context.VmName)) + var rgOp = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); + foreach(var genericOp in rgOp.GetVirtualMachines().ListAsGenericResource(Context.VmName)) { Console.WriteLine($"Deleting {genericOp.Id}"); genericOp.Delete(); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericEntityLoop.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericEntityLoop.cs index 0e88b480d23fe..8c5099d81c0f6 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericEntityLoop.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericEntityLoop.cs @@ -12,8 +12,8 @@ public override void Execute() var createVm = new CreateSingleVmExample(Context); createVm.Execute(); - var rgOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); - foreach(var entity in rgOp.GetVirtualMachineContainer().List()) + var rgOp = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); + foreach(var entity in rgOp.GetVirtualMachines().List()) { Console.WriteLine($"{entity.Id.Name}"); entity.StartAddTag("name", "Value"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericResourcesOperationsExample.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericResourcesOperationsExample.cs index a026133c44311..fa8b834c94959 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericResourcesOperationsExample.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/GenericResourcesOperationsExample.cs @@ -11,19 +11,19 @@ class GenericResourceOperationsExample : Scenario { public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); - var rgOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); + var client = new ArmClient(new DefaultAzureCredential()); + var rgOp = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; - var aset = resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; - foreach (var genericOp in rgOp.GetAvailabilitySetContainer().ListAsGenericResource(Context.VmName)) + var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; + foreach (var genericOp in rgOp.GetAvailabilitySets().ListAsGenericResource(Context.VmName)) { genericOp.Get(); } - foreach (var genericOp in rgOp.GetVirtualNetworkContainer().ListAsGenericResource(Context.VmName)) + foreach (var genericOp in rgOp.GetVirtualNetworks().ListAsGenericResource(Context.VmName)) { genericOp.Get(); } diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainerAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainerAsync.cs index 170e54833b8e6..ef4ef7fe2688e 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainerAsync.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainerAsync.cs @@ -19,15 +19,15 @@ private async Task ExecuteAsync() var createMultipleVms = new CreateMultipleVms(Context); createMultipleVms.Execute(); - var sub = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId); + var sub = new ArmClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId); var rg = sub.GetResourceGroupOperations(Context.RgName); - var virtualMachineContainer = rg.GetVirtualMachineContainer(); + var virtualMachineContainer = rg.GetVirtualMachines(); await foreach (var response in virtualMachineContainer.ListAsync()) { var virtualMachine = await virtualMachineContainer.GetAsync(response.Data.Id.Name); Debug.Assert(virtualMachine.Value.Data.Name.Equals(response.Data.Id.Name)); } - var virtualNetworkContainer = rg.GetVirtualNetworkContainer(); + var virtualNetworkContainer = rg.GetVirtualNetworks(); await foreach (var response in virtualNetworkContainer.ListAsync()) { var virtualNetwork = await virtualNetworkContainer.GetAsync(response.Data.Id.Name); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainers.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainers.cs index 728e0078606ea..e83f7562f3d8a 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainers.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetByContainers.cs @@ -14,15 +14,15 @@ public override void Execute() var createMultipleVms = new CreateMultipleVms(Context); createMultipleVms.Execute(); - var sub = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId); + var sub = new ArmClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId); var rg = sub.GetResourceGroupOperations(Context.RgName); - var virtualMachineContainer = rg.GetVirtualMachineContainer(); + var virtualMachineContainer = rg.GetVirtualMachines(); foreach (var response in virtualMachineContainer.List()) { var virtualMachine = virtualMachineContainer.Get(response.Data.Id.Name); Debug.Assert(virtualMachine.Value.Data.Name.Equals(response.Data.Id.Name)); } - var virtualNetworkContainer = rg.GetVirtualNetworkContainer(); + var virtualNetworkContainer = rg.GetVirtualNetworks(); foreach (var response in virtualNetworkContainer.List()) { var virtualNetwork = virtualNetworkContainer.Get(response.Data.Id.Name); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetFromOperations.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetFromOperations.cs index 784bffb586165..55d17483ba0dc 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetFromOperations.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetFromOperations.cs @@ -12,7 +12,7 @@ public override void Execute() var createVm = new CreateSingleVmExample(Context); createVm.Execute(); - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); var resourceGroup = subscription.GetResourceGroupOperations(Context.RgName).Get().Value; diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetSubscription.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetSubscription.cs index ed7224a890488..2932766c64370 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetSubscription.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetSubscription.cs @@ -11,7 +11,7 @@ public override void Execute() { var sandboxId = "db1ab6f0-4769-4b27-930e-01e2ef9c123c"; var expectDisplayName = "Azure SDK sandbox"; - var subOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(sandboxId); + var subOp = new ArmClient(new DefaultAzureCredential()).GetSubscriptionOperations(sandboxId); var result = subOp.Get(); Debug.Assert(expectDisplayName == result.Value.Data.DisplayName); Console.WriteLine("Passed, got " + result.Value.Data.DisplayName); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetVMTaskExamples.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetVMTaskExamples.cs index e57d966c58645..3a1f8281adb71 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/GetVMTaskExamples.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/GetVMTaskExamples.cs @@ -19,7 +19,7 @@ public override void Execute() var createVm = new CreateSingleVmExample(Context); createVm.Execute(); - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); var resourceGroup = subscription.GetResourceGroupOperations(Context.RgName); var vmId = resourceGroup.GetVirtualMachineOperations(Context.VmName).Id; diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ListByNameExpanded.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ListByNameExpanded.cs index 3461a268504ec..aaecdb116a495 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ListByNameExpanded.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/ListByNameExpanded.cs @@ -14,58 +14,58 @@ public override void Execute() var createMultipleVms = new CreateMultipleVms(Context); createMultipleVms.Execute(); - var rg = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName).Get().Value; - foreach (var availabilitySet in rg.GetAvailabilitySetContainer().ListAsGenericResource(Environment.UserName)) + var rg = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName).Get().Value; + foreach (var availabilitySet in rg.GetAvailabilitySets().ListAsGenericResource(Environment.UserName)) { Console.WriteLine($"--------AvailabilitySet operation id--------: {availabilitySet.Id}"); } - foreach (var availabilitySet in rg.GetAvailabilitySetContainer().List(Environment.UserName)) + foreach (var availabilitySet in rg.GetAvailabilitySets().List(Environment.UserName)) { Console.WriteLine($"--------AvailabilitySet id--------: {availabilitySet.Data.Id}"); } - foreach (var vm in rg.GetVirtualMachineContainer().ListAsGenericResource(Environment.UserName)) + foreach (var vm in rg.GetVirtualMachines().ListAsGenericResource(Environment.UserName)) { Console.WriteLine($"--------VM operation id--------: {vm.Id}"); } - foreach (var vm in rg.GetVirtualMachineContainer().List(Environment.UserName)) + foreach (var vm in rg.GetVirtualMachines().List(Environment.UserName)) { Console.WriteLine($"--------VM id--------: {vm.Data.Id}"); } - foreach (var networkInterface in rg.GetNetworkInterfaceContainer().ListAsGenericResource(Environment.UserName)) + foreach (var networkInterface in rg.GetNetworkInterfaces().ListAsGenericResource(Environment.UserName)) { Console.WriteLine($"--------NetworkInterface operation id--------: {networkInterface.Id}"); } - foreach (var networkInterface in rg.GetNetworkInterfaceContainer().List(Environment.UserName)) + foreach (var networkInterface in rg.GetNetworkInterfaces().List(Environment.UserName)) { Console.WriteLine($"--------NetworkInterface id--------: {networkInterface.Data.Id}"); } - foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroupContainer().ListAsGenericResource(Environment.UserName)) + foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroups().ListAsGenericResource(Environment.UserName)) { Console.WriteLine($"--------NetworkSecurityGroup operation id--------: {networkSecurityGroup.Id}"); } - foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroupContainer().List(Environment.UserName)) + foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroups().List(Environment.UserName)) { Console.WriteLine($"--------NetworkSecurityGroup id--------: {networkSecurityGroup.Data.Id}"); } - foreach (var publicIpAddress in rg.GetNetworkSecurityGroupContainer().List(Environment.UserName)) + foreach (var publicIpAddress in rg.GetNetworkSecurityGroups().List(Environment.UserName)) { Console.WriteLine($"--------PublicIpAddress id--------: {publicIpAddress.Data.Id}"); } - foreach (var VNet in rg.GetVirtualNetworkContainer().ListAsGenericResource(Environment.UserName)) + foreach (var VNet in rg.GetVirtualNetworks().ListAsGenericResource(Environment.UserName)) { Console.WriteLine($"--------VNet operation id--------: {VNet.Id}"); } - foreach (var VNet in rg.GetVirtualNetworkContainer().List(Environment.UserName)) + foreach (var VNet in rg.GetVirtualNetworks().List(Environment.UserName)) { Console.WriteLine($"--------VNet id--------: {VNet.Data.Id}"); } @@ -75,57 +75,57 @@ public override void Execute() private async Task ExecuteAsync(ResourceGroup rg) { - await foreach (var availabilitySet in rg.GetAvailabilitySetContainer().ListAsGenericResourceAsync(Environment.UserName)) + await foreach (var availabilitySet in rg.GetAvailabilitySets().ListAsGenericResourceAsync(Environment.UserName)) { Console.WriteLine($"--------AvailabilitySet operation id--------: {availabilitySet.Id}"); } - await foreach (var availabilitySet in rg.GetAvailabilitySetContainer().ListAsync(Environment.UserName)) + await foreach (var availabilitySet in rg.GetAvailabilitySets().ListAsync(Environment.UserName)) { Console.WriteLine($"--------AvailabilitySet id--------: {availabilitySet.Data.Id}"); } - await foreach (var vm in rg.GetVirtualMachineContainer().ListAsGenericResourceAsync(Environment.UserName)) + await foreach (var vm in rg.GetVirtualMachines().ListAsGenericResourceAsync(Environment.UserName)) { Console.WriteLine($"--------VM operation id--------: {vm.Id}"); } - await foreach (var vm in rg.GetVirtualMachineContainer().ListAsync(Environment.UserName)) + await foreach (var vm in rg.GetVirtualMachines().ListAsync(Environment.UserName)) { Console.WriteLine($"--------VM id--------: {vm.Data.Id}"); } - await foreach (var networkInterface in rg.GetNetworkInterfaceContainer().ListAsGenericResourceAsync(Environment.UserName)) + await foreach (var networkInterface in rg.GetNetworkInterfaces().ListAsGenericResourceAsync(Environment.UserName)) { Console.WriteLine($"--------NetworkInterface operation id--------: {networkInterface.Id}"); } - await foreach (var networkInterface in rg.GetNetworkInterfaceContainer().ListAsync(Environment.UserName)) + await foreach (var networkInterface in rg.GetNetworkInterfaces().ListAsync(Environment.UserName)) { Console.WriteLine($"--------NetworkInterface id--------: {networkInterface.Data.Id}"); } - await foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroupContainer().ListAsGenericResourceAsync(Environment.UserName)) + await foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroups().ListAsGenericResourceAsync(Environment.UserName)) { Console.WriteLine($"--------NetworkSecurityGroup operation id--------: {networkSecurityGroup.Id}"); } - await foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroupContainer().ListAsync(Environment.UserName)) + await foreach (var networkSecurityGroup in rg.GetNetworkSecurityGroups().ListAsync(Environment.UserName)) { Console.WriteLine($"--------NetworkSecurityGroup id--------: {networkSecurityGroup.Data.Id}"); } - await foreach (var publicIpAddress in rg.GetNetworkSecurityGroupContainer().ListAsync(Environment.UserName)) + await foreach (var publicIpAddress in rg.GetNetworkSecurityGroups().ListAsync(Environment.UserName)) { Console.WriteLine($"--------PublicIpAddress id--------: {publicIpAddress.Data.Id}"); } - await foreach (var VNet in rg.GetVirtualNetworkContainer().ListAsGenericResourceAsync(Environment.UserName)) + await foreach (var VNet in rg.GetVirtualNetworks().ListAsGenericResourceAsync(Environment.UserName)) { Console.WriteLine($"--------VNet operation id--------: {VNet.Id}"); } - await foreach (var VNet in rg.GetVirtualNetworkContainer().ListAsync(Environment.UserName)) + await foreach (var VNet in rg.GetVirtualNetworks().ListAsync(Environment.UserName)) { Console.WriteLine($"--------VNet id--------: {VNet.Data.Id}"); } diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/RoleAssignment.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/RoleAssignment.cs index 7e595363e21b5..63f9ff2bf180e 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/RoleAssignment.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/RoleAssignment.cs @@ -11,12 +11,12 @@ class RoleAssignment : Scenario { public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; CleanUp.Add(resourceGroup.Id); Console.WriteLine("--------Start create Assignment--------"); @@ -28,12 +28,12 @@ public override void Execute() // Create AvailabilitySet Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; + var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; // Create VNet Console.WriteLine("--------Start create VNet--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; + var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; //create subnet Console.WriteLine("--------Start create Subnet--------"); @@ -41,15 +41,15 @@ public override void Execute() //create network security group Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - _ = resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).CreateOrUpdate(Context.NsgName).Value; + _ = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; // Create Network Interface Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; + var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; // Create VM Console.WriteLine("--------Start create VM--------"); - var vm = resourceGroup.GetVirtualMachineContainer().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; + var vm = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; Console.WriteLine("VM ID: " + vm.Id); Console.WriteLine("--------Done create VM--------"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/SetTagsOnVm.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/SetTagsOnVm.cs index b81f88140d375..0dac98bfa8c68 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/SetTagsOnVm.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/SetTagsOnVm.cs @@ -32,7 +32,7 @@ private void DumpDictionary(IDictionary dic) private async Task ExecuteAsync() { // Update Tag for a known resource - var rgOp = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); + var rgOp = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); var vmOp = rgOp.GetVirtualMachineOperations(Context.VmName); Console.WriteLine($"Adding tags to {vmOp.Id.Name}"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByLINQ.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByLINQ.cs index 44aa073a79bfb..6a588f1c331fa 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByLINQ.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByLINQ.cs @@ -13,8 +13,8 @@ public override void Execute() var createMultipleVms = new CreateMultipleVms(Context); createMultipleVms.Execute(); - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); - foreach (var sub in client.GetSubscriptionContainer().List()) + var client = new ArmClient(new DefaultAzureCredential()); + foreach (var sub in client.GetSubscriptions().List()) { var vmList = sub.ListVirtualMachines(); foreach (var vm in vmList.Where(armResource => armResource.Data.Name.Contains("-o"))) @@ -26,9 +26,9 @@ public override void Execute() } } - var resourceGroup = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); + var resourceGroup = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName); - resourceGroup.GetVirtualMachineContainer().List().Select(vm => + resourceGroup.GetVirtualMachines().List().Select(vm => { var parts = vm.Id.Name.Split('-'); var n = Convert.ToInt32(parts[0].Last()); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByName.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByName.cs index 162008c69c9ac..cb4565361cbcb 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByName.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByName.cs @@ -12,7 +12,7 @@ public override void Execute() var createMultipleVms = new CreateMultipleVms(Context); createMultipleVms.Execute(); - var sub = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId); + var sub = new ArmClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId); foreach(var armResource in sub.ListVirtualMachinesByName("-e")) { diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossResourceGroups.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossResourceGroups.cs index c8cbf11a9ed42..19cdd9b44be7f 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossResourceGroups.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossResourceGroups.cs @@ -20,7 +20,7 @@ public override void Execute() context = new ScenarioContext(); } - var subscription = new AzureResourceManagerClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId); + var subscription = new ArmClient(new DefaultAzureCredential()).GetSubscriptionOperations(Context.SubscriptionId); Regex reg = new Regex($"{Context.VmName}.*-e"); Parallel.ForEach(subscription.ListVirtualMachines(), vm => diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossSubscriptions.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossSubscriptions.cs index cb8a2eb22a120..b2f53d363c808 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossSubscriptions.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByNameAcrossSubscriptions.cs @@ -11,9 +11,9 @@ class ShutdownVmsByNameAcrossSubscriptions : Scenario { public async void ShutdownAsync() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); - await foreach (var subscription in client.GetSubscriptionContainer().ListAsync()) + await foreach (var subscription in client.GetSubscriptions().ListAsync()) { await foreach (var armResource in subscription.ListVirtualMachinesByNameAsync("-e")) { @@ -41,8 +41,8 @@ public async override void Execute() #endregion - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); - foreach (var sub in client.GetSubscriptionContainer().List()) + var client = new ArmClient(new DefaultAzureCredential()); + foreach (var sub in client.GetSubscriptions().List()) { await foreach (var armResource in sub.ListVirtualMachinesByNameAsync("-e")) { diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByTag.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByTag.cs index 1b4a9fa35562d..8513ecfc5a552 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByTag.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/ShutdownVmsByTag.cs @@ -13,11 +13,11 @@ public override void Execute() var createMultipleVms = new CreateMultipleVms(Context); createMultipleVms.Execute(); - var rg = new AzureResourceManagerClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName).Get().Value; + var rg = new ArmClient(new DefaultAzureCredential()).GetResourceGroupOperations(Context.SubscriptionId, Context.RgName).Get().Value; //set tags on random vms Random rand = new Random(Environment.TickCount); - foreach (var generic in rg.GetVirtualMachineContainer().ListAsGenericResource(Environment.UserName)) + foreach (var generic in rg.GetVirtualMachines().ListAsGenericResource(Environment.UserName)) { var vm = VirtualMachineOperations.FromGeneric(generic); if (rand.NextDouble() > 0.5) @@ -27,7 +27,7 @@ public override void Execute() } } - var filteredList = rg.GetVirtualMachineContainer().List().Where(vm => + var filteredList = rg.GetVirtualMachines().List().Where(vm => { string value; return (vm.Data.Tags.TryGetValue("tagkey", out value) && value == "tagvalue"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExample.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExample.cs index a8d40b9cf7b85..75ae2d86cae56 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExample.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExample.cs @@ -19,22 +19,22 @@ public override void Execute() private async System.Threading.Tasks.Task ExcuteAsync() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start StartCreate group {Context.RgName}--------"); - var resourceGroup = (await(subscription.GetResourceGroupContainer().Construct(Context.Loc).StartCreateOrUpdate(Context.RgName)).WaitForCompletionAsync()).Value; + var resourceGroup = (await(subscription.GetResourceGroups().Construct(Context.Loc).StartCreateOrUpdate(Context.RgName)).WaitForCompletionAsync()).Value; CleanUp.Add(resourceGroup.Id); // Create AvailabilitySet Console.WriteLine("--------Start StartCreate AvailabilitySet async--------"); - var aset = (await(resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").StartCreateOrUpdate(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; + var aset = (await(resourceGroup.GetAvailabilitySets().Construct("Aligned").StartCreateOrUpdate(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; // Create VNet Console.WriteLine("--------Start StartCreate VNet--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = (await(resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").StartCreateOrUpdate(vnetName)).WaitForCompletionAsync()).Value; + var vnet = (await(resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").StartCreateOrUpdate(vnetName)).WaitForCompletionAsync()).Value; //create subnet Console.WriteLine("--------Start StartCreate Subnet--------"); @@ -42,15 +42,15 @@ private async System.Threading.Tasks.Task ExcuteAsync() //create network security group Console.WriteLine("--------Start StartCreate NetworkSecurityGroup--------"); - _ = (await(resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).StartCreateOrUpdate(Context.NsgName)).WaitForCompletionAsync()).Value; + _ = (await(resourceGroup.GetNetworkSecurityGroups().Construct(80).StartCreateOrUpdate(Context.NsgName)).WaitForCompletionAsync()).Value; // Create Network Interface Console.WriteLine("--------Start StartCreate Network Interface--------"); - var nic = (await(resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).StartCreateOrUpdate($"{Context.VmName}_nic")).WaitForCompletionAsync()).Value; + var nic = (await(resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).StartCreateOrUpdate($"{Context.VmName}_nic")).WaitForCompletionAsync()).Value; // Create VM Console.WriteLine("--------Start StartCreate VM --------"); - var vm = (await(resourceGroup.GetVirtualMachineContainer().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdate(Context.VmName)).WaitForCompletionAsync()).Value; + var vm = (await(resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdate(Context.VmName)).WaitForCompletionAsync()).Value; Console.WriteLine("VM ID: " + vm.Id); Console.WriteLine("--------Done StartCreate VM--------"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExampleAsync.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExampleAsync.cs index dcd8947de2be8..1566fbc23cf88 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExampleAsync.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartCreateSingleVmExampleAsync.cs @@ -18,22 +18,22 @@ public override void Execute() } private async System.Threading.Tasks.Task ExecuteAsync() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start StartCreate group async {Context.RgName}--------"); - var resourceGroup = (await (await subscription.GetResourceGroupContainer().Construct(Context.Loc).StartCreateOrUpdateAsync(Context.RgName)).WaitForCompletionAsync()).Value; + var resourceGroup = (await (await subscription.GetResourceGroups().Construct(Context.Loc).StartCreateOrUpdateAsync(Context.RgName)).WaitForCompletionAsync()).Value; CleanUp.Add(resourceGroup.Id); // Create AvailabilitySet Console.WriteLine("--------Start StartCreate AvailabilitySet async--------"); - var aset = (await (await resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").StartCreateOrUpdateAsync(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; + var aset = (await (await resourceGroup.GetAvailabilitySets().Construct("Aligned").StartCreateOrUpdateAsync(Context.VmName + "_aSet")).WaitForCompletionAsync()).Value; // Create VNet Console.WriteLine("--------Start StartCreate VNet async--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = (await (await resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").StartCreateOrUpdateAsync(vnetName)).WaitForCompletionAsync()).Value; + var vnet = (await (await resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").StartCreateOrUpdateAsync(vnetName)).WaitForCompletionAsync()).Value; //create subnet Console.WriteLine("--------Start StartCreate Subnet async--------"); @@ -41,15 +41,15 @@ private async System.Threading.Tasks.Task ExecuteAsync() //create network security group Console.WriteLine("--------Start StartCreate NetworkSecurityGroup async--------"); - _ = (await (await resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).StartCreateOrUpdateAsync(Context.NsgName)).WaitForCompletionAsync()).Value; + _ = (await (await resourceGroup.GetNetworkSecurityGroups().Construct(80).StartCreateOrUpdateAsync(Context.NsgName)).WaitForCompletionAsync()).Value; // Create Network Interface Console.WriteLine("--------Start StartCreate Network Interface async--------"); - var nic = (await (await resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).StartCreateOrUpdateAsync($"{Context.VmName}_nic")).WaitForCompletionAsync()).Value; + var nic = (await (await resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).StartCreateOrUpdateAsync($"{Context.VmName}_nic")).WaitForCompletionAsync()).Value; // Create VM Console.WriteLine("--------Start StartCreate VM async--------"); - var vm = (await (await resourceGroup.GetVirtualMachineContainer().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdateAsync(Context.VmName)).WaitForCompletionAsync()).Value; + var vm = (await (await resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).StartCreateOrUpdateAsync(Context.VmName)).WaitForCompletionAsync()).Value; Console.WriteLine("VM ID: " + vm.Id); Console.WriteLine("--------Done StartCreate VM--------"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartFromVm.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartFromVm.cs index 9224e1feeaf35..8546c8bfeb0bc 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartFromVm.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartFromVm.cs @@ -11,7 +11,7 @@ public override void Execute() { var createVm = new CreateSingleVmExample(Context); createVm.Execute(); - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); //retrieve from lowest level, doesn't give ability to walk up and down the container structure var vmOp = client.GetResourceOperations(Context.SubscriptionId, Context.RgName, Context.VmName); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartStopVm.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartStopVm.cs index 17b8557cc1b2d..55e096b607319 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/StartStopVm.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/StartStopVm.cs @@ -12,7 +12,7 @@ public override void Execute() var createVm = new CreateSingleVmExample(Context); createVm.Execute(); - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); var resourceGroup = subscription.GetResourceGroupOperations(Context.RgName); var vm = resourceGroup.GetVirtualMachineOperations(Context.VmName); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/SubscriptionExists.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/SubscriptionExists.cs index fc6964efd3081..6eea5bdca9fd7 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/SubscriptionExists.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/SubscriptionExists.cs @@ -8,8 +8,8 @@ class SubscriptionExists : Scenario { public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); - if(client.GetSubscriptionContainer().DoesExist(Context.SubscriptionId)) + var client = new ArmClient(new DefaultAzureCredential()); + if(client.GetSubscriptions().DoesExist(Context.SubscriptionId)) { Console.WriteLine($"Found {Context.SubscriptionId}"); } diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/TenantResource.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/TenantResource.cs index 306b43e725185..f5f8c43237d6e 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/TenantResource.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/TenantResource.cs @@ -10,7 +10,7 @@ class TenantResource : Scenario { public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); TenantOperations tenant = client.Tenant; string testAccount = "9b84fb4c-c79a-4819-bd24-1e58f88885bd"; // old value: "3984c6f4-2d2a-4b04-93ce-43cf4824b698:e2f1492a-a492-468d-909f-bf7fe6662c01_2019-05-31"; diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/UseParentLocation.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/UseParentLocation.cs index 107ceaf0e115f..0a59f3c926b2c 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/UseParentLocation.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/UseParentLocation.cs @@ -10,24 +10,24 @@ class UseParentLocation : Scenario { public override void Execute() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; CleanUp.Add(resourceGroup.Id); // Create AvailabilitySet Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; + var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; if (aset.Data.Location != Context.Loc) throw new Exception($"aset was on the wrong location expected {Context.Loc} actual {aset.Data.Location}"); // Create VNet Console.WriteLine("--------Start create VNet--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; + var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; if (vnet.Data.Location != Context.Loc) throw new Exception($"vnet was on the wrong location expected {Context.Loc} actual {vnet.Data.Location}"); @@ -37,19 +37,19 @@ public override void Execute() //create network security group Console.WriteLine("--------Start create NetworkSecurityGroup--------"); - var nsg = resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).CreateOrUpdate(Context.NsgName).Value; + var nsg = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; if (nsg.Data.Location != Context.Loc) throw new Exception($"nsg was on the wrong location expected {Context.Loc} actual {nsg.Data.Location}"); // Create Network Interface Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; + var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; if (nic.Data.Location != Context.Loc) throw new Exception($"nic was on the wrong location expected {Context.Loc} actual {nic.Data.Location}"); // Create VM Console.WriteLine("--------Start create VM--------"); - var vm = resourceGroup.GetVirtualMachineContainer().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; + var vm = resourceGroup.GetVirtualMachines().Construct(Context.Hostname, "admin-user", "!@#$%asdfA", nic.Id, aset.Id).CreateOrUpdate(Context.VmName).Value; if (vm.Data.Location != Context.Loc) throw new Exception($"vm was on the wrong location expected {Context.Loc} actual {vm.Data.Location}"); diff --git a/sdk/resourcemanager/Proto.Client/src/Scenarios/VmModelBuilder.cs b/sdk/resourcemanager/Proto.Client/src/Scenarios/VmModelBuilder.cs index cda7d55e554d7..bf940ed271b33 100644 --- a/sdk/resourcemanager/Proto.Client/src/Scenarios/VmModelBuilder.cs +++ b/sdk/resourcemanager/Proto.Client/src/Scenarios/VmModelBuilder.cs @@ -20,34 +20,34 @@ public override void Execute() private Task CreateVmWithBuilderAsync() { - var client = new AzureResourceManagerClient(new DefaultAzureCredential()); + var client = new ArmClient(new DefaultAzureCredential()); var subscription = client.GetSubscriptionOperations(Context.SubscriptionId); // Create Resource Group Console.WriteLine($"--------Start create group {Context.RgName}--------"); - var resourceGroup = subscription.GetResourceGroupContainer().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; + var resourceGroup = subscription.GetResourceGroups().Construct(Context.Loc).CreateOrUpdate(Context.RgName).Value; // Create AvailabilitySet Console.WriteLine("--------Start create AvailabilitySet--------"); - var aset = resourceGroup.GetAvailabilitySetContainer().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; + var aset = resourceGroup.GetAvailabilitySets().Construct("Aligned").CreateOrUpdate(Context.VmName + "_aSet").Value; // Create VNet Console.WriteLine("--------Start create VNet--------"); string vnetName = Context.VmName + "_vnet"; - var vnet = resourceGroup.GetVirtualNetworkContainer().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; + var vnet = resourceGroup.GetVirtualNetworks().Construct("10.0.0.0/16").CreateOrUpdate(vnetName).Value; //create subnet Console.WriteLine("--------Start create Subnet--------"); - var nsg = resourceGroup.GetNetworkSecurityGroupContainer().Construct(80).CreateOrUpdate(Context.NsgName).Value; + var nsg = resourceGroup.GetNetworkSecurityGroups().Construct(80).CreateOrUpdate(Context.NsgName).Value; var subnet = vnet.GetSubnetContainer().Construct("10.0.0.0/24").CreateOrUpdate(Context.SubnetName).Value; // Create Network Interface Console.WriteLine("--------Start create Network Interface--------"); - var nic = resourceGroup.GetNetworkInterfaceContainer().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; + var nic = resourceGroup.GetNetworkInterfaces().Construct(subnet.Id).CreateOrUpdate($"{Context.VmName}_nic").Value; // Options: required parameters on in the constructor VirtualMachineModelBuilder vmBuilder = new VirtualMachineModelBuilder( - resourceGroup.GetVirtualMachineContainer(), + resourceGroup.GetVirtualMachines(), new VirtualMachineData(new Azure.ResourceManager.Compute.Models.VirtualMachine(Context.Loc))); ; var vm = vmBuilder.UseWindowsImage("admin-user", "!@#$%asdfA") .RequiredNetworkInterface(nic.Id)