From 10f6ad0c6416ee7b84427b30a3068fec2005e6aa Mon Sep 17 00:00:00 2001 From: YalinLi0312 Date: Wed, 24 Mar 2021 16:18:02 -0700 Subject: [PATCH 1/6] Change the accessbility to virtual for Resource.Id --- .../Azure.ResourceManager.Core/src/Resources/Resource.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/Resource.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/Resource.cs index 86a35ac05cf77..a8638d1c689be 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/Resource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/Resource.cs @@ -14,7 +14,7 @@ public abstract class Resource : IEquatable, IEquatable, IComp /// /// Gets or sets the resource identifier. /// - public abstract ResourceIdentifier Id { get; protected set; } + public virtual ResourceIdentifier Id { get; protected set; } /// /// Gets the name. From 451217411ae9b7a9378fb4de7bf30894ffb9c390 Mon Sep 17 00:00:00 2001 From: nisha-bhatia Date: Thu, 8 Apr 2021 18:03:16 -0700 Subject: [PATCH 2/6] add transport --- common/ManagementCoreShared/ClientContext.cs | 10 +- .../src/ApiVersions.cs | 19 +++ .../src/ArmClient.cs | 2 +- .../src/ArmClientOptions.cs | 35 +++- .../src/GenericResourceOperations.cs | 3 +- .../src/OperationsBase.cs | 4 + .../tests/Scenario/ClientContextTests.cs | 43 +++-- .../TestTransportInClone().json | 98 ++++++++++++ .../TestTransportInClone()Async.json | 98 ++++++++++++ .../ValidateClone().json | 53 +++++++ .../ValidateClone()Async.json | 53 +++++++ .../TestClientContextPolicy().json | 150 +++++++++--------- .../TestClientContextPolicy()Async.json | 126 +++++++-------- .../tests/Unit/ApiVersionsBaseTests.cs | 15 ++ .../tests/Unit/ArmClientOptionsTests.cs | 56 ++++++- 15 files changed, 597 insertions(+), 168 deletions(-) create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestTransportInClone().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestTransportInClone()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/ValidateClone().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/ValidateClone()Async.json diff --git a/common/ManagementCoreShared/ClientContext.cs b/common/ManagementCoreShared/ClientContext.cs index 3d155cc977543..4539de6a31c61 100644 --- a/common/ManagementCoreShared/ClientContext.cs +++ b/common/ManagementCoreShared/ClientContext.cs @@ -3,6 +3,7 @@ using System; using Azure.Core; +using Azure.Core.Pipeline; namespace Azure.ResourceManager.Core { @@ -26,17 +27,24 @@ internal class ClientContext /// public Uri BaseUri { get; set; } + /// + /// pipeline transport + /// + public HttpPipelineTransport Transport { get; set; } + /// /// Initializes a new instance of the class. /// /// /// /// - internal ClientContext(ArmClientOptions clientOptions, TokenCredential credential, Uri uri) + /// + internal ClientContext(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipelineTransport transport = default) { ClientOptions = clientOptions; Credential = credential; BaseUri = uri; + Transport = transport; } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs index e4709fb347e9e..cab1678202a32 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersions.cs @@ -185,5 +185,24 @@ public void SetApiVersion(ResourceType resourceType, string apiVersion) _nonLoadedResourceToApiVersion[resourceType.ToString()] = apiVersion; } } + + internal ApiVersions Clone() + { + ApiVersions copy = new ApiVersions(_clientOptions); + copy.ProviderOperations = ProviderOperations; + + copy._loadedResourceToApiVersions = new Dictionary(); + foreach (var property in _loadedResourceToApiVersions) + { + copy._loadedResourceToApiVersions.Add(property.Key, property.Value); + } + + copy._nonLoadedResourceToApiVersion = new Dictionary(); + foreach (var property in _nonLoadedResourceToApiVersion) + { + copy._nonLoadedResourceToApiVersion.Add(property.Key, property.Value); + } + return copy; + } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs index 4f4deed8da134..923dc6addbead 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs @@ -91,7 +91,7 @@ private ArmClient( if (credential is null) throw new ArgumentNullException(nameof(credential)); - ClientOptions = options ?? new ArmClientOptions(); + ClientOptions = options?.Clone() ?? new ArmClientOptions(); DefaultSubscription = string.IsNullOrWhiteSpace(defaultSubscriptionId) ? GetDefaultSubscription() : GetSubscriptionOperations(defaultSubscriptionId).Get().Value; diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs index ab1ff49ced015..e6f6cb0c6593a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs @@ -23,7 +23,7 @@ public sealed class ArmClientOptions : ClientOptions /// /// Gets the ApiVersions object /// - public ApiVersions ApiVersions { get; } + public ApiVersions ApiVersions { get; private set; } /// /// Initializes a new instance of the class. @@ -53,18 +53,31 @@ internal ArmClientOptions(LocationData defaultLocation, ArmClientOptions other = if (defaultLocation is null) throw new ArgumentNullException(nameof(defaultLocation)); - // Will go away when moved into core since we will have directy acces the policies and transport, so just need to set those + // Will go away when moved into core since we will have directly access the policies and transport, so just need to set those if (!ReferenceEquals(other, null)) Copy(other); DefaultLocation = defaultLocation; - ApiVersionOverrides = new Dictionary(); ApiVersions = new ApiVersions(this); } - /// - /// Gets the Api version overrides. - /// - public Dictionary ApiVersionOverrides { get; private set; } + internal ArmClientOptions(LocationData location, IList perCallPolicies, IList perRetryPolicies) + { + if (location is null) + throw new ArgumentNullException(nameof(location)); + + DefaultLocation = location; + PerCallPolicies = new List(); + foreach (var call in perCallPolicies) + { + PerCallPolicies.Add(call); + } + PerRetryPolicies = new List(); + foreach (var retry in perRetryPolicies) + { + PerCallPolicies.Add(retry); + } + ApiVersions = new ApiVersions(this); + } /// /// Gets the default location to use if can't be inherited from parent. @@ -163,5 +176,13 @@ private void Copy(ArmClientOptions other) AddPolicy(pol, HttpPipelinePosition.PerRetry); } } + + internal ArmClientOptions Clone() + { + ArmClientOptions copy = new ArmClientOptions(DefaultLocation, PerCallPolicies, PerRetryPolicies); + copy.ApiVersions = ApiVersions.Clone(); + copy.Transport = Transport; + return copy; + } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs index 185201af7588e..8ac6cce79fdc0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs @@ -153,8 +153,9 @@ public override ArmResponse Get(CancellationToken cancellationT /// public override async Task> GetAsync(CancellationToken cancellationToken = default) { + var apiVersion = await GetApiVersionAsync(cancellationToken).ConfigureAwait(false); return new PhArmResponse( - await Operations.GetByIdAsync(Id, await GetApiVersionAsync(cancellationToken).ConfigureAwait(false), cancellationToken).ConfigureAwait(false), + await Operations.GetByIdAsync(Id, apiVersion, cancellationToken).ConfigureAwait(false), v => new GenericResource(this, new GenericResourceData(v))); } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs index 77534e2ef82e9..7b6c69f7b6458 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs @@ -32,11 +32,15 @@ internal OperationsBase(ClientContext clientContext, ResourceIdentifier id) Credential = clientContext.Credential; BaseUri = clientContext.BaseUri; Diagnostics = new ClientDiagnostics(ClientOptions); + Transport = (HttpClientTransport)clientContext.Transport; + Validate(id); } internal ClientDiagnostics Diagnostics { get; } + internal HttpClientTransport Transport { get; } + /// /// Gets the resource identifier. /// diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ClientContextTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ClientContextTests.cs index c9ba3617138c1..e381e492a360a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ClientContextTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ClientContextTests.cs @@ -27,20 +27,18 @@ public async Task TestClientContextPolicy() var client1 = GetArmClient(options1); Console.WriteLine("-----Client 1-----"); - await foreach (var sub in client1.GetSubscriptions().ListAsync()) - { - Console.WriteLine($"Check 1: Found {sub.Data.DisplayName}"); - } - Assert.AreEqual(2, dummyPolicy1.numMsgGot); + var assetName = Recording.GenerateAssetName("testrg"); + ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); + _ = client1.GetResourceGroupOperations(client1.DefaultSubscription.Id, assetName); + + Assert.AreEqual(1, dummyPolicy1.numMsgGot); options1.AddPolicy(dummyPolicy2, HttpPipelinePosition.PerCall); - await foreach (var sub in client1.GetSubscriptions().ListAsync()) - { - Console.WriteLine($"Check 2: Found {sub.Data.DisplayName}"); - } - Assert.AreEqual(3, dummyPolicy1.numMsgGot); - //Assert.AreEqual(0, dummyPolicy2.numMsgGot); uncomment for ADO #5572 + _ = await client1.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("test2Rg-")); + + Assert.AreEqual(2, dummyPolicy1.numMsgGot); + Assert.AreEqual(0, dummyPolicy2.numMsgGot); } private class dummyPolicy : HttpPipelineSynchronousPolicy @@ -62,5 +60,28 @@ public override void OnReceivedResponse(HttpMessage message) Interlocked.Add(ref numMsgGot, 2); } } + + [TestCase] + [RecordedTest] + public void ValidateOptionsTestLocation() + { + var x = new ArmClientOptions(); + var y = x.Clone(); + Assert.IsTrue(ReferenceEquals(x.DefaultLocation, y.DefaultLocation)); + } + + [TestCase] + [RecordedTest] + public void ValidateOptionsTestApiVersions() + { + var x = new ArmClientOptions(); + var y = x.Clone(); + Assert.IsFalse(ReferenceEquals(x.ApiVersions, y.ApiVersions)); + Assert.AreEqual(x.ApiVersions.TryGetApiVersion("{Microsoft.Resources/subscriptions/resourceGroups}"), y.ApiVersions.TryGetApiVersion("{Microsoft.Resources/subscriptions/resourceGroups}")); + + x.ApiVersions.SetApiVersion("{Microsoft.Resources/subscriptions/resourceGroups}", "1500-10-10"); + Assert.IsFalse(ReferenceEquals(x.ApiVersions, y.ApiVersions)); + Assert.AreNotEqual(x.ApiVersions, y.ApiVersions); + } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestTransportInClone().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestTransportInClone().json new file mode 100644 index 0000000000000..6fdefed7b76f3 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestTransportInClone().json @@ -0,0 +1,98 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-1e7614cc78e07b4a9417c65a5acaf4bc-2bb601e42909d748-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "4026b55fb4905c94a85957ced50468ec", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 00:54:51 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "fa15b941-0158-44ca-9852-b23ad55103e8", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-request-id": "fa15b941-0158-44ca-9852-b23ad55103e8", + "x-ms-routing-request-id": "WESTUS:20210409T005452Z:fa15b941-0158-44ca-9852-b23ad55103e8" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-511fbd2a25051f4cbc7989aa8e374acc-463e1b489af6d347-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "37387da285dc777ac797e018b749f770", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 00:54:51 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "25acb2c3-1cac-4754-8c02-2f62ab80d5e3", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-request-id": "25acb2c3-1cac-4754-8c02-2f62ab80d5e3", + "x-ms-routing-request-id": "WESTUS:20210409T005452Z:25acb2c3-1cac-4754-8c02-2f62ab80d5e3" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "7388731", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestTransportInClone()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestTransportInClone()Async.json new file mode 100644 index 0000000000000..01b1987e24776 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestTransportInClone()Async.json @@ -0,0 +1,98 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-814c39b7f5224246b1c66e729981b3b4-3afa7b15dab72948-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "8bc19e9a2c058cbb18762394b11fae9e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 00:54:51 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "00159b3c-e0b7-4f7f-8e75-663207136115", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-request-id": "00159b3c-e0b7-4f7f-8e75-663207136115", + "x-ms-routing-request-id": "WESTUS:20210409T005452Z:00159b3c-e0b7-4f7f-8e75-663207136115" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-4df4ef1269447f4881b021ed81f94d25-6021216b448ff149-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "66ec1dd564b06296913ecf3ff11c279d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 00:54:51 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "05dd54f0-1eb5-46d2-beb4-ff623becba72", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-request-id": "05dd54f0-1eb5-46d2-beb4-ff623becba72", + "x-ms-routing-request-id": "WESTUS:20210409T005452Z:05dd54f0-1eb5-46d2-beb4-ff623becba72" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "2067438399", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/ValidateClone().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/ValidateClone().json new file mode 100644 index 0000000000000..afb4606aab949 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/ValidateClone().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-89a576a49f49fe41ae89a0bb5fb0d8a4-ed807c4bcbebca41-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "952287e44bafc850837cc5142965fc3c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 00:54:52 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "11ae1482-54f4-450c-be6d-3ef6e1092887", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-request-id": "11ae1482-54f4-450c-be6d-3ef6e1092887", + "x-ms-routing-request-id": "WESTUS:20210409T005452Z:11ae1482-54f4-450c-be6d-3ef6e1092887" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1175631747", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/ValidateClone()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/ValidateClone()Async.json new file mode 100644 index 0000000000000..5d1a07055ef92 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/ValidateClone()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-f64fe15d72e6b64a8bf61c29799cd2c0-6ae762eb510c4541-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "cb818bbb68a45acf5450c147f524b6b0", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 00:54:52 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "a82f6ac9-09dd-472e-82f0-80392c70d6bb", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-request-id": "a82f6ac9-09dd-472e-82f0-80392c70d6bb", + "x-ms-routing-request-id": "WESTUS:20210409T005452Z:a82f6ac9-09dd-472e-82f0-80392c70d6bb" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "981269060", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy().json index 592362382111f..7cabdae143a28 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy().json +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy().json @@ -6,7 +6,10 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], "x-ms-client-request-id": "c6d72a21af7af90b649094d4c0250a58", "x-ms-return-client-request-id": "true" }, @@ -16,15 +19,15 @@ "Cache-Control": "no-cache", "Content-Length": "397", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 30 Mar 2021 18:02:51 GMT", + "Date": "Fri, 09 Apr 2021 00:54:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "eb160f33-a114-4495-bb60-d519acebc360", - "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-request-id": "eb160f33-a114-4495-bb60-d519acebc360", - "x-ms-routing-request-id": "WESTUS:20210330T180252Z:eb160f33-a114-4495-bb60-d519acebc360" + "x-ms-correlation-request-id": "70793067-00f9-4fc9-8361-598be152d95b", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-request-id": "70793067-00f9-4fc9-8361-598be152d95b", + "x-ms-routing-request-id": "WESTUS:20210409T005451Z:70793067-00f9-4fc9-8361-598be152d95b" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -47,7 +50,10 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], "x-ms-client-request-id": "c304bd1fd819d829c1e23986542e2a45", "x-ms-return-client-request-id": "true" }, @@ -57,15 +63,15 @@ "Cache-Control": "no-cache", "Content-Length": "397", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 30 Mar 2021 18:02:51 GMT", + "Date": "Fri, 09 Apr 2021 00:54:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c149cf69-a92c-44e2-82ec-2eb3a10e7cc2", - "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-request-id": "c149cf69-a92c-44e2-82ec-2eb3a10e7cc2", - "x-ms-routing-request-id": "WESTUS:20210330T180252Z:c149cf69-a92c-44e2-82ec-2eb3a10e7cc2" + "x-ms-correlation-request-id": "b7d8be31-e83b-4d71-a613-63046360bc57", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-request-id": "b7d8be31-e83b-4d71-a613-63046360bc57", + "x-ms-routing-request-id": "WESTUS:20210409T005451Z:b7d8be31-e83b-4d71-a613-63046360bc57" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -83,102 +89,94 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions?api-version=2019-11-01", - "RequestMethod": "GET", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/testrg8856?api-version=2019-10-01", + "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-d3f160780595d04596a9769af92e38f1-655d0e3902851b44-00", - "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", - "x-ms-client-request-id": "6b45aa1bb79428db25fc8df27c72edbd", + "Content-Length": "34", + "Content-Type": "application/json", + "traceparent": "00-a70be7a958825a4ab5b0a9e7c985f8bb-f49272311b699d4c-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "b7946b4528dbfc258df27c72edbdadeb", "x-ms-return-client-request-id": "true" }, - "RequestBody": null, - "StatusCode": 200, + "RequestBody": { + "location": "West US 2", + "tags": {} + }, + "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "444", + "Content-Length": "228", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 30 Mar 2021 18:02:52 GMT", + "Date": "Fri, 09 Apr 2021 00:54:52 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "916a7cb8-b113-401c-812a-1672eac24110", - "x-ms-ratelimit-remaining-tenant-reads": "11999", - "x-ms-request-id": "916a7cb8-b113-401c-812a-1672eac24110", - "x-ms-routing-request-id": "WESTUS:20210330T180253Z:916a7cb8-b113-401c-812a-1672eac24110" + "x-ms-correlation-request-id": "d2d969f5-66ef-435c-9462-686d5a48fdec", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-request-id": "d2d969f5-66ef-435c-9462-686d5a48fdec", + "x-ms-routing-request-id": "WESTUS:20210409T005452Z:d2d969f5-66ef-435c-9462-686d5a48fdec" }, "ResponseBody": { - "value": [ - { - "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", - "authorizationSource": "RoleBased", - "managedByTenants": [], - "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "displayName": "Azure SDK sandbox", - "state": "Enabled", - "subscriptionPolicies": { - "locationPlacementId": "Internal_2014-09-01", - "quotaId": "Internal_2014-09-01", - "spendingLimit": "Off" - } - } - ], - "count": { - "type": "Total", - "value": 1 + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testrg8856", + "name": "testrg8856", + "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", + "tags": {}, + "properties": { + "provisioningState": "Succeeded" } } }, { - "RequestUri": "https://management.azure.com/subscriptions?api-version=2019-11-01", - "RequestMethod": "GET", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/test2Rg-4047?api-version=2019-10-01", + "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-7a08ae1f156a6a4db2e3e331e7e4bdb7-a65cc6343040d54c-00", - "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", - "x-ms-client-request-id": "18a4ebad66a1485f01fe05987684a436", + "Content-Length": "34", + "Content-Type": "application/json", + "traceparent": "00-449272e7186dc44fb8f567929cc957bd-a03cfd9e30bdbf4e-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "5f66a118014805fe987684a436664fb9", "x-ms-return-client-request-id": "true" }, - "RequestBody": null, - "StatusCode": 200, + "RequestBody": { + "location": "West US 2", + "tags": {} + }, + "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "444", + "Content-Length": "232", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 30 Mar 2021 18:02:52 GMT", + "Date": "Fri, 09 Apr 2021 00:54:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c9de31dc-c231-4a63-bf43-b8b3e624abef", - "x-ms-ratelimit-remaining-tenant-reads": "11998", - "x-ms-request-id": "c9de31dc-c231-4a63-bf43-b8b3e624abef", - "x-ms-routing-request-id": "WESTUS:20210330T180253Z:c9de31dc-c231-4a63-bf43-b8b3e624abef" + "x-ms-correlation-request-id": "e41bf05f-96d6-4ed6-a64a-b89e1e1d4205", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-request-id": "e41bf05f-96d6-4ed6-a64a-b89e1e1d4205", + "x-ms-routing-request-id": "WESTUS:20210409T005453Z:e41bf05f-96d6-4ed6-a64a-b89e1e1d4205" }, "ResponseBody": { - "value": [ - { - "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", - "authorizationSource": "RoleBased", - "managedByTenants": [], - "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "displayName": "Azure SDK sandbox", - "state": "Enabled", - "subscriptionPolicies": { - "locationPlacementId": "Internal_2014-09-01", - "quotaId": "Internal_2014-09-01", - "spendingLimit": "Off" - } - } - ], - "count": { - "type": "Total", - "value": 1 + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/test2Rg-4047", + "name": "test2Rg-4047", + "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", + "tags": {}, + "properties": { + "provisioningState": "Succeeded" } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy()Async.json index d5ad165206cdc..746ccccaea115 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy()Async.json @@ -19,15 +19,15 @@ "Cache-Control": "no-cache", "Content-Length": "397", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 30 Mar 2021 07:42:15 GMT", + "Date": "Fri, 09 Apr 2021 00:54:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7f33c549-551c-4cdb-a125-3cbe74735f13", + "x-ms-correlation-request-id": "7aa746ee-dc67-4467-8f9e-c2a6a7bc6c4c", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-request-id": "7f33c549-551c-4cdb-a125-3cbe74735f13", - "x-ms-routing-request-id": "WESTUS:20210330T074216Z:7f33c549-551c-4cdb-a125-3cbe74735f13" + "x-ms-request-id": "7aa746ee-dc67-4467-8f9e-c2a6a7bc6c4c", + "x-ms-routing-request-id": "WESTUS:20210409T005451Z:7aa746ee-dc67-4467-8f9e-c2a6a7bc6c4c" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -63,15 +63,15 @@ "Cache-Control": "no-cache", "Content-Length": "397", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 30 Mar 2021 07:42:15 GMT", + "Date": "Fri, 09 Apr 2021 00:54:51 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0ec684a8-a103-4929-b5cb-570d6600c2b2", + "x-ms-correlation-request-id": "18541c95-171b-45b9-93b1-c9159b2068b9", "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-request-id": "0ec684a8-a103-4929-b5cb-570d6600c2b2", - "x-ms-routing-request-id": "WESTUS:20210330T074216Z:0ec684a8-a103-4929-b5cb-570d6600c2b2" + "x-ms-request-id": "18541c95-171b-45b9-93b1-c9159b2068b9", + "x-ms-routing-request-id": "WESTUS:20210409T005451Z:18541c95-171b-45b9-93b1-c9159b2068b9" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -89,108 +89,94 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions?api-version=2019-11-01", - "RequestMethod": "GET", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/testrg4696?api-version=2019-10-01", + "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-b806b3ca910f704fad6c50fb87ca92d3-1f44187973c8d644-00", + "Content-Length": "34", + "Content-Type": "application/json", + "traceparent": "00-fc8eaa4df161164984556382ee6b01b7-cf0a491d9b7dc64f-00", "User-Agent": [ "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" ], - "x-ms-client-request-id": "db6e8ace8f093a15c6ceb8a339234783", + "x-ms-client-request-id": "8f09db6e3a15cec6b8a339234783e813", "x-ms-return-client-request-id": "true" }, - "RequestBody": null, - "StatusCode": 200, + "RequestBody": { + "location": "West US 2", + "tags": {} + }, + "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "444", + "Content-Length": "228", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 30 Mar 2021 07:42:15 GMT", + "Date": "Fri, 09 Apr 2021 00:54:52 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "77d2aed5-2d0d-4146-b495-76564648d7f9", - "x-ms-ratelimit-remaining-tenant-reads": "11999", - "x-ms-request-id": "77d2aed5-2d0d-4146-b495-76564648d7f9", - "x-ms-routing-request-id": "WESTUS:20210330T074216Z:77d2aed5-2d0d-4146-b495-76564648d7f9" + "x-ms-correlation-request-id": "1e754897-9897-425b-91c3-d340813aeb4b", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-request-id": "1e754897-9897-425b-91c3-d340813aeb4b", + "x-ms-routing-request-id": "WESTUS:20210409T005452Z:1e754897-9897-425b-91c3-d340813aeb4b" }, "ResponseBody": { - "value": [ - { - "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", - "authorizationSource": "RoleBased", - "managedByTenants": [], - "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "displayName": "Azure SDK sandbox", - "state": "Enabled", - "subscriptionPolicies": { - "locationPlacementId": "Internal_2014-09-01", - "quotaId": "Internal_2014-09-01", - "spendingLimit": "Off" - } - } - ], - "count": { - "type": "Total", - "value": 1 + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testrg4696", + "name": "testrg4696", + "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", + "tags": {}, + "properties": { + "provisioningState": "Succeeded" } } }, { - "RequestUri": "https://management.azure.com/subscriptions?api-version=2019-11-01", - "RequestMethod": "GET", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/test2Rg-660?api-version=2019-10-01", + "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-40a57a933fdfd842a948888046064689-32a0969d5a527844-00", + "Content-Length": "34", + "Content-Type": "application/json", + "traceparent": "00-bf33f2379d43344ea906b585ae2c6878-0cf6f4838c40944b-00", "User-Agent": [ "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" ], - "x-ms-client-request-id": "c73313e84b9ec69dc81e156350869c82", + "x-ms-client-request-id": "9d4b9ec7c8c6151e6350869c8297ad32", "x-ms-return-client-request-id": "true" }, - "RequestBody": null, - "StatusCode": 200, + "RequestBody": { + "location": "West US 2", + "tags": {} + }, + "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "444", + "Content-Length": "230", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 30 Mar 2021 07:42:16 GMT", + "Date": "Fri, 09 Apr 2021 00:54:53 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b772d3bf-7cdc-452e-b652-a56c168dde56", - "x-ms-ratelimit-remaining-tenant-reads": "11998", - "x-ms-request-id": "b772d3bf-7cdc-452e-b652-a56c168dde56", - "x-ms-routing-request-id": "WESTUS:20210330T074216Z:b772d3bf-7cdc-452e-b652-a56c168dde56" + "x-ms-correlation-request-id": "1d95a9d3-9fb1-4589-af3a-3d42e9085407", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-request-id": "1d95a9d3-9fb1-4589-af3a-3d42e9085407", + "x-ms-routing-request-id": "WESTUS:20210409T005453Z:1d95a9d3-9fb1-4589-af3a-3d42e9085407" }, "ResponseBody": { - "value": [ - { - "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", - "authorizationSource": "RoleBased", - "managedByTenants": [], - "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", - "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "displayName": "Azure SDK sandbox", - "state": "Enabled", - "subscriptionPolicies": { - "locationPlacementId": "Internal_2014-09-01", - "quotaId": "Internal_2014-09-01", - "spendingLimit": "Off" - } - } - ], - "count": { - "type": "Total", - "value": 1 + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/test2Rg-660", + "name": "test2Rg-660", + "type": "Microsoft.Resources/resourceGroups", + "location": "westus2", + "tags": {}, + "properties": { + "provisioningState": "Succeeded" } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ApiVersionsBaseTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ApiVersionsBaseTests.cs index 501b9216fae11..5c8e8b8f6ac55 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ApiVersionsBaseTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ApiVersionsBaseTests.cs @@ -253,5 +253,20 @@ public void TestLessThanFalse(string leftString, string rightString) FakeResourceApiVersions right = ConvertFromString(rightString); Assert.IsFalse(left < right); } + + [TestCase] + public void ValidateClone() + { + var options = new ArmClientOptions(); + var apiVersions1 = new ApiVersions(options); + var apiVersions2 = apiVersions1.Clone(); + + Assert.IsFalse(ReferenceEquals(apiVersions1, apiVersions2)); + Assert.AreEqual(apiVersions1.TryGetApiVersion("{Microsoft.Resources/subscriptions/resourceGroups}"), apiVersions2.TryGetApiVersion("{Microsoft.Resources/subscriptions/resourceGroups}")); + + apiVersions1.SetApiVersion("{Microsoft.Resources/subscriptions/resourceGroups}", "1500-10-10"); + Assert.IsFalse(ReferenceEquals(apiVersions1, apiVersions2)); + Assert.AreNotEqual(apiVersions1, apiVersions2); + } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs index f217d22e920c1..cc632bcb6f83d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs @@ -1,12 +1,66 @@ using System; +using System.Threading.Tasks; using Azure.Core; +using Azure.Core.Pipeline; using NUnit.Framework; namespace Azure.ResourceManager.Core.Tests { [Parallelizable] - public class AzureResourceManagerClientOptionsTests + public class ArmClientOptionsTests : ResourceManagerTestBase { + public ArmClientOptionsTests(bool isAsync) : base(isAsync) { } + + [TestCase] + public void ValidateClone() + { + var options1 = new ArmClientOptions(); + var options2 = options1.Clone(); + + Assert.IsFalse(ReferenceEquals(options1, options2)); + Assert.IsFalse(ReferenceEquals(options1.Diagnostics, options2.Diagnostics)); + Assert.IsFalse(ReferenceEquals(options1.Retry, options2.Retry)); + Assert.IsFalse(ReferenceEquals(options1.ApiVersions, options2.ApiVersions)); + Assert.IsFalse(ReferenceEquals(options1.PerCallPolicies, options2.PerCallPolicies)); + Assert.IsFalse(ReferenceEquals(options1.PerRetryPolicies, options2.PerRetryPolicies)); + } + + [TestCase] + public void TestTransportInClone() + { + var x = new ArmClientOptions(); + x.Transport = new MyTransport(); + var y = x.Clone(); + Assert.IsTrue(ReferenceEquals(x.Transport, y.Transport)); + + x.Transport = new MyTransport(); + Assert.IsFalse(ReferenceEquals(y.Transport, x.Transport)); + + var z = new ArmClientOptions(); + ArmClient client = GetArmClient(z); + var sub = client.DefaultSubscription; + z.Transport = new MyTransport(); + Assert.IsFalse(ReferenceEquals(y.Transport, sub.Transport)); + } + + private class MyTransport : HttpPipelineTransport + { + public override Request CreateRequest() + { + throw new NotImplementedException(); + } + + public override void Process(HttpMessage message) + { + throw new NotImplementedException(); + } + + public override ValueTask ProcessAsync(HttpMessage message) + { + throw new NotImplementedException(); + } + } + [TestCase] public void VersionIsDefault() { From 07ea842b7db3344580ec55353c7f96af6a391013 Mon Sep 17 00:00:00 2001 From: nisha-bhatia Date: Fri, 9 Apr 2021 12:09:35 -0700 Subject: [PATCH 3/6] update test --- .../tests/Scenario/ClientContextTests.cs | 9 +-- .../TestClientContextPolicy().json | 76 ++++++++---------- .../TestClientContextPolicy()Async.json | 80 ++++++++----------- 3 files changed, 69 insertions(+), 96 deletions(-) diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ClientContextTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ClientContextTests.cs index e381e492a360a..b1fd4433c21c3 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ClientContextTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ClientContextTests.cs @@ -27,17 +27,14 @@ public async Task TestClientContextPolicy() var client1 = GetArmClient(options1); Console.WriteLine("-----Client 1-----"); - var assetName = Recording.GenerateAssetName("testrg"); - ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); - _ = client1.GetResourceGroupOperations(client1.DefaultSubscription.Id, assetName); - - Assert.AreEqual(1, dummyPolicy1.numMsgGot); + _ = await client1.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); + Assert.AreEqual(2, dummyPolicy1.numMsgGot); options1.AddPolicy(dummyPolicy2, HttpPipelinePosition.PerCall); _ = await client1.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("test2Rg-")); - Assert.AreEqual(2, dummyPolicy1.numMsgGot); + Assert.AreEqual(3, dummyPolicy1.numMsgGot); Assert.AreEqual(0, dummyPolicy2.numMsgGot); } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy().json index 7cabdae143a28..1bbf660545d7d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy().json +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy().json @@ -6,10 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": [ - "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", - "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" - ], + "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", "x-ms-client-request-id": "c6d72a21af7af90b649094d4c0250a58", "x-ms-return-client-request-id": "true" }, @@ -19,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "397", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Apr 2021 00:54:51 GMT", + "Date": "Fri, 09 Apr 2021 19:06:12 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "70793067-00f9-4fc9-8361-598be152d95b", - "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-request-id": "70793067-00f9-4fc9-8361-598be152d95b", - "x-ms-routing-request-id": "WESTUS:20210409T005451Z:70793067-00f9-4fc9-8361-598be152d95b" + "x-ms-correlation-request-id": "52cfc5eb-407c-4e30-b240-124b6321cbf3", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-request-id": "52cfc5eb-407c-4e30-b240-124b6321cbf3", + "x-ms-routing-request-id": "WESTUS:20210409T190612Z:52cfc5eb-407c-4e30-b240-124b6321cbf3" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -50,10 +47,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": [ - "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", - "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" - ], + "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", "x-ms-client-request-id": "c304bd1fd819d829c1e23986542e2a45", "x-ms-return-client-request-id": "true" }, @@ -63,15 +57,15 @@ "Cache-Control": "no-cache", "Content-Length": "397", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Apr 2021 00:54:51 GMT", + "Date": "Fri, 09 Apr 2021 19:06:12 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b7d8be31-e83b-4d71-a613-63046360bc57", - "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-request-id": "b7d8be31-e83b-4d71-a613-63046360bc57", - "x-ms-routing-request-id": "WESTUS:20210409T005451Z:b7d8be31-e83b-4d71-a613-63046360bc57" + "x-ms-correlation-request-id": "8d03dff7-a3ec-4250-86f7-9f8d9e396c1e", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-request-id": "8d03dff7-a3ec-4250-86f7-9f8d9e396c1e", + "x-ms-routing-request-id": "WESTUS:20210409T190612Z:8d03dff7-a3ec-4250-86f7-9f8d9e396c1e" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -89,19 +83,16 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/testrg8856?api-version=2019-10-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/testrg5465?api-version=2019-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", "Content-Length": "34", "Content-Type": "application/json", - "traceparent": "00-a70be7a958825a4ab5b0a9e7c985f8bb-f49272311b699d4c-00", - "User-Agent": [ - "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", - "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" - ], - "x-ms-client-request-id": "b7946b4528dbfc258df27c72edbdadeb", + "traceparent": "00-d83002a4d807124986d486d29fbf731c-08bda8786d2a5c42-00", + "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", + "x-ms-client-request-id": "946b45aadbb72528fc8df27c72edbdad", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -113,19 +104,19 @@ "Cache-Control": "no-cache", "Content-Length": "228", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Apr 2021 00:54:52 GMT", + "Date": "Fri, 09 Apr 2021 19:06:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d2d969f5-66ef-435c-9462-686d5a48fdec", + "x-ms-correlation-request-id": "bf2413f7-2ae8-4f7f-833f-d46f4a65026c", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-request-id": "d2d969f5-66ef-435c-9462-686d5a48fdec", - "x-ms-routing-request-id": "WESTUS:20210409T005452Z:d2d969f5-66ef-435c-9462-686d5a48fdec" + "x-ms-request-id": "bf2413f7-2ae8-4f7f-833f-d46f4a65026c", + "x-ms-routing-request-id": "WESTUS:20210409T190613Z:bf2413f7-2ae8-4f7f-833f-d46f4a65026c" }, "ResponseBody": { - "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testrg8856", - "name": "testrg8856", + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testrg5465", + "name": "testrg5465", "type": "Microsoft.Resources/resourceGroups", "location": "westus2", "tags": {}, @@ -135,19 +126,16 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/test2Rg-4047?api-version=2019-10-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/test2Rg-7020?api-version=2019-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", "Content-Length": "34", "Content-Type": "application/json", - "traceparent": "00-449272e7186dc44fb8f567929cc957bd-a03cfd9e30bdbf4e-00", - "User-Agent": [ - "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", - "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" - ], - "x-ms-client-request-id": "5f66a118014805fe987684a436664fb9", + "traceparent": "00-1958354d86297f40bb353616fdc00588-a3db6b4df3eaf246-00", + "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", + "x-ms-client-request-id": "66a118a4485ffe0105987684a436664f", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -159,19 +147,19 @@ "Cache-Control": "no-cache", "Content-Length": "232", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Apr 2021 00:54:53 GMT", + "Date": "Fri, 09 Apr 2021 19:06:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e41bf05f-96d6-4ed6-a64a-b89e1e1d4205", + "x-ms-correlation-request-id": "4a4cb654-6503-40f9-b6b2-8d0eff9d5f7e", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-request-id": "e41bf05f-96d6-4ed6-a64a-b89e1e1d4205", - "x-ms-routing-request-id": "WESTUS:20210409T005453Z:e41bf05f-96d6-4ed6-a64a-b89e1e1d4205" + "x-ms-request-id": "4a4cb654-6503-40f9-b6b2-8d0eff9d5f7e", + "x-ms-routing-request-id": "WESTUS:20210409T190614Z:4a4cb654-6503-40f9-b6b2-8d0eff9d5f7e" }, "ResponseBody": { - "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/test2Rg-4047", - "name": "test2Rg-4047", + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/test2Rg-7020", + "name": "test2Rg-7020", "type": "Microsoft.Resources/resourceGroups", "location": "westus2", "tags": {}, diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy()Async.json index 746ccccaea115..64c04a143420a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/TestClientContextPolicy()Async.json @@ -6,10 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": [ - "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", - "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" - ], + "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", "x-ms-client-request-id": "e96d9ac8512614d931e92300f67b3120", "x-ms-return-client-request-id": "true" }, @@ -19,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "397", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Apr 2021 00:54:51 GMT", + "Date": "Fri, 09 Apr 2021 19:06:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7aa746ee-dc67-4467-8f9e-c2a6a7bc6c4c", - "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-request-id": "7aa746ee-dc67-4467-8f9e-c2a6a7bc6c4c", - "x-ms-routing-request-id": "WESTUS:20210409T005451Z:7aa746ee-dc67-4467-8f9e-c2a6a7bc6c4c" + "x-ms-correlation-request-id": "e711acee-2fc9-4bd4-91ad-87fe7df78c9b", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-request-id": "e711acee-2fc9-4bd4-91ad-87fe7df78c9b", + "x-ms-routing-request-id": "WESTUS:20210409T190612Z:e711acee-2fc9-4bd4-91ad-87fe7df78c9b" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -50,10 +47,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": [ - "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", - "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" - ], + "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", "x-ms-client-request-id": "e09d8a5201e54fd1d4c2015378af5276", "x-ms-return-client-request-id": "true" }, @@ -63,15 +57,15 @@ "Cache-Control": "no-cache", "Content-Length": "397", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Apr 2021 00:54:51 GMT", + "Date": "Fri, 09 Apr 2021 19:06:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "18541c95-171b-45b9-93b1-c9159b2068b9", - "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-request-id": "18541c95-171b-45b9-93b1-c9159b2068b9", - "x-ms-routing-request-id": "WESTUS:20210409T005451Z:18541c95-171b-45b9-93b1-c9159b2068b9" + "x-ms-correlation-request-id": "585e30f8-cae9-4a39-b199-216534f6d6da", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-request-id": "585e30f8-cae9-4a39-b199-216534f6d6da", + "x-ms-routing-request-id": "WESTUS:20210409T190612Z:585e30f8-cae9-4a39-b199-216534f6d6da" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -89,19 +83,16 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/testrg4696?api-version=2019-10-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/testrg2078?api-version=2019-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", "Content-Length": "34", "Content-Type": "application/json", - "traceparent": "00-fc8eaa4df161164984556382ee6b01b7-cf0a491d9b7dc64f-00", - "User-Agent": [ - "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", - "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" - ], - "x-ms-client-request-id": "8f09db6e3a15cec6b8a339234783e813", + "traceparent": "00-3924080252cb7a4ab03a9686bd737521-1f2abdca7652ae4d-00", + "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", + "x-ms-client-request-id": "09db6e8a158fc63aceb8a339234783e8", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -113,19 +104,19 @@ "Cache-Control": "no-cache", "Content-Length": "228", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Apr 2021 00:54:52 GMT", + "Date": "Fri, 09 Apr 2021 19:06:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1e754897-9897-425b-91c3-d340813aeb4b", + "x-ms-correlation-request-id": "6b319d97-0681-4d36-be50-372265d551ab", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-request-id": "1e754897-9897-425b-91c3-d340813aeb4b", - "x-ms-routing-request-id": "WESTUS:20210409T005452Z:1e754897-9897-425b-91c3-d340813aeb4b" + "x-ms-request-id": "6b319d97-0681-4d36-be50-372265d551ab", + "x-ms-routing-request-id": "WESTUS:20210409T190613Z:6b319d97-0681-4d36-be50-372265d551ab" }, "ResponseBody": { - "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testrg4696", - "name": "testrg4696", + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testrg2078", + "name": "testrg2078", "type": "Microsoft.Resources/resourceGroups", "location": "westus2", "tags": {}, @@ -135,19 +126,16 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/test2Rg-660?api-version=2019-10-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourcegroups/test2Rg-3351?api-version=2019-10-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", "Content-Length": "34", "Content-Type": "application/json", - "traceparent": "00-bf33f2379d43344ea906b585ae2c6878-0cf6f4838c40944b-00", - "User-Agent": [ - "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", - "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" - ], - "x-ms-client-request-id": "9d4b9ec7c8c6151e6350869c8297ad32", + "traceparent": "00-6dc40865157b9842893fdc9e9674aea0-33722b78a42edd4c-00", + "User-Agent": "azsdk-net-ResourceManager.Resources/1.0.0-preview.2 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19042 )", + "x-ms-client-request-id": "4b9ec733c69d1ec8156350869c8297ad", "x-ms-return-client-request-id": "true" }, "RequestBody": { @@ -157,21 +145,21 @@ "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", - "Content-Length": "230", + "Content-Length": "232", "Content-Type": "application/json; charset=utf-8", - "Date": "Fri, 09 Apr 2021 00:54:53 GMT", + "Date": "Fri, 09 Apr 2021 19:06:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1d95a9d3-9fb1-4589-af3a-3d42e9085407", - "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-request-id": "1d95a9d3-9fb1-4589-af3a-3d42e9085407", - "x-ms-routing-request-id": "WESTUS:20210409T005453Z:1d95a9d3-9fb1-4589-af3a-3d42e9085407" + "x-ms-correlation-request-id": "58441753-c4f0-4c61-a0d9-c28523f9e74a", + "x-ms-ratelimit-remaining-subscription-writes": "1198", + "x-ms-request-id": "58441753-c4f0-4c61-a0d9-c28523f9e74a", + "x-ms-routing-request-id": "WESTUS:20210409T190614Z:58441753-c4f0-4c61-a0d9-c28523f9e74a" }, "ResponseBody": { - "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/test2Rg-660", - "name": "test2Rg-660", + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/test2Rg-3351", + "name": "test2Rg-3351", "type": "Microsoft.Resources/resourceGroups", "location": "westus2", "tags": {}, From 63ff0b35d941ebfe5a94db45606535ce2bd2ed8d Mon Sep 17 00:00:00 2001 From: nisha-bhatia Date: Fri, 9 Apr 2021 13:17:11 -0700 Subject: [PATCH 4/6] add jsons --- .../MultiClientSeparateVersions().json | 52 ++++++++++++++++++ .../MultiClientSeparateVersions()Async.json | 52 ++++++++++++++++++ .../VersionLoadedChanges().json | 53 +++++++++++++++++++ .../VersionLoadedChanges()Async.json | 53 +++++++++++++++++++ .../VersionNonLoadedChanges().json | 52 ++++++++++++++++++ .../VersionNonLoadedChanges()Async.json | 53 +++++++++++++++++++ .../VersionsLoadedChangeSet().json | 53 +++++++++++++++++++ .../VersionsLoadedChangeSet()Async.json | 53 +++++++++++++++++++ .../ValidateOptionsTestApiVersions().json | 53 +++++++++++++++++++ ...ValidateOptionsTestApiVersions()Async.json | 53 +++++++++++++++++++ .../ValidateOptionsTestLocation().json | 53 +++++++++++++++++++ .../ValidateOptionsTestLocation()Async.json | 53 +++++++++++++++++++ 12 files changed, 633 insertions(+) create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/MultiClientSeparateVersions().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/MultiClientSeparateVersions()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionLoadedChanges().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionLoadedChanges()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionNonLoadedChanges().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionNonLoadedChanges()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionsLoadedChangeSet().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionsLoadedChangeSet()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestApiVersions().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestApiVersions()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestLocation().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestLocation()Async.json diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/MultiClientSeparateVersions().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/MultiClientSeparateVersions().json new file mode 100644 index 0000000000000..2c834817f5d5b --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/MultiClientSeparateVersions().json @@ -0,0 +1,52 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "099919ee9991164e5a30c175fb11f871", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:05 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "c1c40e96-f821-4aea-84a4-4639310c7dba", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-request-id": "c1c40e96-f821-4aea-84a4-4639310c7dba", + "x-ms-routing-request-id": "WESTUS:20210409T194205Z:c1c40e96-f821-4aea-84a4-4639310c7dba" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "919451465", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/MultiClientSeparateVersions()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/MultiClientSeparateVersions()Async.json new file mode 100644 index 0000000000000..289f769727ae1 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/MultiClientSeparateVersions()Async.json @@ -0,0 +1,52 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "70f6b0e8b5c9f7be442a46a63e608bdd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:05 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "8fa47380-4ee2-463d-9b30-b5cd573076bb", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-request-id": "8fa47380-4ee2-463d-9b30-b5cd573076bb", + "x-ms-routing-request-id": "WESTUS:20210409T194205Z:8fa47380-4ee2-463d-9b30-b5cd573076bb" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "2109135430", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionLoadedChanges().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionLoadedChanges().json new file mode 100644 index 0000000000000..19df779a389e0 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionLoadedChanges().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-2c807f5fc6a39f4aad6899e8bfe8d0b3-65437be3283bfd4c-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "099ae7e28b478ff6c79ef641f8ebbc7c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "4b09c501-ebff-4002-aed4-a3562373e183", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-request-id": "4b09c501-ebff-4002-aed4-a3562373e183", + "x-ms-routing-request-id": "WESTUS:20210409T194207Z:4b09c501-ebff-4002-aed4-a3562373e183" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1528450526", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionLoadedChanges()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionLoadedChanges()Async.json new file mode 100644 index 0000000000000..501f02369a483 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionLoadedChanges()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-96a46639c8794442996969f11bba032b-b867baa4a348e140-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "612f1c78849b4c1351ed13fffd2d9e89", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "35b107fd-27e6-4155-8bb3-53a3b1a25100", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-request-id": "35b107fd-27e6-4155-8bb3-53a3b1a25100", + "x-ms-routing-request-id": "WESTUS:20210409T194207Z:35b107fd-27e6-4155-8bb3-53a3b1a25100" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1573063055", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionNonLoadedChanges().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionNonLoadedChanges().json new file mode 100644 index 0000000000000..69c68612aa3d5 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionNonLoadedChanges().json @@ -0,0 +1,52 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "02a666e69cc9f4c2d72a75383c3dcd16", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "9de177f7-c5f5-4b85-835a-c37cbd0ea05e", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-request-id": "9de177f7-c5f5-4b85-835a-c37cbd0ea05e", + "x-ms-routing-request-id": "WESTUS:20210409T194208Z:9de177f7-c5f5-4b85-835a-c37cbd0ea05e" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1521527706", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionNonLoadedChanges()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionNonLoadedChanges()Async.json new file mode 100644 index 0000000000000..7a5fd4f9be815 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionNonLoadedChanges()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-990a54310a6e8a4ead0105675553fa84-812945a2c5b55c40-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "be3f7c7be58a2052ce54eed4141960a2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "54faadcd-310a-43fe-95e4-6d12f01e8725", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-request-id": "54faadcd-310a-43fe-95e4-6d12f01e8725", + "x-ms-routing-request-id": "WESTUS:20210409T194208Z:54faadcd-310a-43fe-95e4-6d12f01e8725" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1633924381", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionsLoadedChangeSet().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionsLoadedChangeSet().json new file mode 100644 index 0000000000000..ba1e526dcf463 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionsLoadedChangeSet().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-a327963a46b6114992d4a64949115d15-256f3f955d815944-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "4de132b9856e51504f25e305cdc1fc84", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "aeff3639-d461-4fb1-b8ac-b788932c6f9d", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-request-id": "aeff3639-d461-4fb1-b8ac-b788932c6f9d", + "x-ms-routing-request-id": "WESTUS:20210409T194208Z:aeff3639-d461-4fb1-b8ac-b788932c6f9d" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "399796000", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionsLoadedChangeSet()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionsLoadedChangeSet()Async.json new file mode 100644 index 0000000000000..12ed32d9bc869 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionsLoadedChangeSet()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Request-Id": "|3bfc2190-42bedbe4e2a21cf4.", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "d8227743099f3ebf1a5265023c39b6e8", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:07 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "06fbc614-785a-4667-8ecf-349fc7339fb9", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-request-id": "06fbc614-785a-4667-8ecf-349fc7339fb9", + "x-ms-routing-request-id": "WESTUS:20210409T194208Z:06fbc614-785a-4667-8ecf-349fc7339fb9" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "744076958", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestApiVersions().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestApiVersions().json new file mode 100644 index 0000000000000..07de6b975dbe1 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestApiVersions().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-9f9acd5dc9709e4fb2c52a8a9565a649-b7140c1f7f1f4d48-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "4f94e0961852ba0a094e8a7b9e8e37d9", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:08 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "6a88d13c-dddc-4a03-a0a8-4cdad1f7fecb", + "x-ms-ratelimit-remaining-subscription-reads": "11984", + "x-ms-request-id": "6a88d13c-dddc-4a03-a0a8-4cdad1f7fecb", + "x-ms-routing-request-id": "WESTUS:20210409T194208Z:6a88d13c-dddc-4a03-a0a8-4cdad1f7fecb" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "853902363", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestApiVersions()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestApiVersions()Async.json new file mode 100644 index 0000000000000..7dced82eedc81 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestApiVersions()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-696d324c9d2e494b815707d98305304f-202ff1d22865e04c-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "95b4bfe35fa9f1a8a30fa9d21a3b8569", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:08 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "80dde585-fbfb-4dc4-bbdd-60004341d977", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-request-id": "80dde585-fbfb-4dc4-bbdd-60004341d977", + "x-ms-routing-request-id": "WESTUS:20210409T194208Z:80dde585-fbfb-4dc4-bbdd-60004341d977" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "247474572", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestLocation().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestLocation().json new file mode 100644 index 0000000000000..43f102157c6ff --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestLocation().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-9cfd40bedae19f4f8d2fc55b00218075-8149bd5041f1614a-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "4bb393657d397335bd9b0f05293c29c0", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:09 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "b77e0172-1a21-4711-9621-9f2c81c556aa", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-request-id": "b77e0172-1a21-4711-9621-9f2c81c556aa", + "x-ms-routing-request-id": "WESTUS:20210409T194210Z:b77e0172-1a21-4711-9621-9f2c81c556aa" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "884501139", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestLocation()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestLocation()Async.json new file mode 100644 index 0000000000000..9a63c5c9815b0 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ClientContextTests/ValidateOptionsTestLocation()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-b7a52e143f5eed4c87304ab0a70ee8bb-f5e4adf9a9ee1344-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "3d456fe91ea2401371c61533de037790", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 19:42:09 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "a6477bcf-2da1-48bf-9cc0-474c125441d1", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-request-id": "a6477bcf-2da1-48bf-9cc0-474c125441d1", + "x-ms-routing-request-id": "WESTUS:20210409T194210Z:a6477bcf-2da1-48bf-9cc0-474c125441d1" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "270982415", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file From eef5deeec0e147f4861570f093ab746ce01980fa Mon Sep 17 00:00:00 2001 From: nisha-bhatia Date: Fri, 9 Apr 2021 13:36:16 -0700 Subject: [PATCH 5/6] add json --- .../TestClientOptionsParamCheck().json | 53 +++++++++++++++++++ .../TestClientOptionsParamCheck()Async.json | 53 +++++++++++++++++++ .../TestKeyDoesNotExist().json | 53 +++++++++++++++++++ .../TestKeyDoesNotExist()Async.json | 53 +++++++++++++++++++ .../ArmClientOptionsTests/VersionExist().json | 53 +++++++++++++++++++ .../VersionExist()Async.json | 53 +++++++++++++++++++ .../VersionIsDefault().json | 53 +++++++++++++++++++ .../VersionIsDefault()Async.json | 53 +++++++++++++++++++ 8 files changed, 424 insertions(+) create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestClientOptionsParamCheck().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestClientOptionsParamCheck()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestKeyDoesNotExist().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestKeyDoesNotExist()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionExist().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionExist()Async.json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionIsDefault().json create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionIsDefault()Async.json diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestClientOptionsParamCheck().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestClientOptionsParamCheck().json new file mode 100644 index 0000000000000..387b3d6719ebf --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestClientOptionsParamCheck().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Request-Id": "|852fdfd3-4c97a68acea18ff5.", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "a632fe16e604e1afe3a72e944145efec", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 20:34:25 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "be780178-1313-4692-a54e-a633d8592622", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-request-id": "be780178-1313-4692-a54e-a633d8592622", + "x-ms-routing-request-id": "WESTUS:20210409T203425Z:be780178-1313-4692-a54e-a633d8592622" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1093016711", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestClientOptionsParamCheck()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestClientOptionsParamCheck()Async.json new file mode 100644 index 0000000000000..b85a1112f6a9b --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestClientOptionsParamCheck()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Request-Id": "|852fdfd4-4c97a68acea18ff5.", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "a632fe16e604e1afe3a72e944145efec", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 20:34:24 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "9974c9c1-dd06-4f61-81fc-84e6feceff95", + "x-ms-ratelimit-remaining-subscription-reads": "11948", + "x-ms-request-id": "9974c9c1-dd06-4f61-81fc-84e6feceff95", + "x-ms-routing-request-id": "WESTUS:20210409T203425Z:9974c9c1-dd06-4f61-81fc-84e6feceff95" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1093016711", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestKeyDoesNotExist().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestKeyDoesNotExist().json new file mode 100644 index 0000000000000..c2b4fb4252939 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestKeyDoesNotExist().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-911d6bde15655140b0edb797d22931c7-9b94005be149af4a-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "f0bf4d18430e5cdc35e9c020df221ff9", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 20:34:24 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "9805099a-ef23-45e1-9af0-fb079959b0c0", + "x-ms-ratelimit-remaining-subscription-reads": "11947", + "x-ms-request-id": "9805099a-ef23-45e1-9af0-fb079959b0c0", + "x-ms-routing-request-id": "WESTUS:20210409T203425Z:9805099a-ef23-45e1-9af0-fb079959b0c0" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1055663228", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestKeyDoesNotExist()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestKeyDoesNotExist()Async.json new file mode 100644 index 0000000000000..5f2e83b56b0bb --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/TestKeyDoesNotExist()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-0a106ecef7be5e43be0f2105bd0a87d0-0e2b99ce9db0d544-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "66d84677842b609e7e92acc4637d64c5", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 20:34:24 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2eec3fc0-9133-47d4-8154-49df4a8353b0", + "x-ms-ratelimit-remaining-subscription-reads": "11973", + "x-ms-request-id": "2eec3fc0-9133-47d4-8154-49df4a8353b0", + "x-ms-routing-request-id": "WESTUS:20210409T203425Z:2eec3fc0-9133-47d4-8154-49df4a8353b0" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1242934982", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionExist().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionExist().json new file mode 100644 index 0000000000000..1377a25c6fba3 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionExist().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-7dad01eaf61ed84fbd3f11499c8800f5-75a619d3c342a44b-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "83c8740afca5d2696e512987d3f99b57", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 20:34:26 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "f4a3f070-9cd6-4e42-9936-a8865e46d94b", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-request-id": "f4a3f070-9cd6-4e42-9936-a8865e46d94b", + "x-ms-routing-request-id": "WESTUS:20210409T203426Z:f4a3f070-9cd6-4e42-9936-a8865e46d94b" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "390609155", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionExist()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionExist()Async.json new file mode 100644 index 0000000000000..f85af0d9063e0 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionExist()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-03de4f9d469292409efefe58947908fc-c26d6c657af4c746-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "c78f9c5d7631970a8bf21e8ce0f108fb", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 20:34:26 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "66626d54-8b76-4c61-9e8f-4c74c8ba6038", + "x-ms-ratelimit-remaining-subscription-reads": "11971", + "x-ms-request-id": "66626d54-8b76-4c61-9e8f-4c74c8ba6038", + "x-ms-routing-request-id": "WESTUS:20210409T203426Z:66626d54-8b76-4c61-9e8f-4c74c8ba6038" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "809765192", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionIsDefault().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionIsDefault().json new file mode 100644 index 0000000000000..c416490cea09a --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionIsDefault().json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-b133f33d6ae2db4fadfd6a15a518b856-7a6053b728dfdb4a-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "67586afa01c45d57ea6ea4831f5a3728", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 20:34:26 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "66e88d5a-07cf-4cad-8c3a-b49796c746f2", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-request-id": "66e88d5a-07cf-4cad-8c3a-b49796c746f2", + "x-ms-routing-request-id": "WESTUS:20210409T203427Z:66e88d5a-07cf-4cad-8c3a-b49796c746f2" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1842608066", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionIsDefault()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionIsDefault()Async.json new file mode 100644 index 0000000000000..7844752830e5c --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/ArmClientOptionsTests/VersionIsDefault()Async.json @@ -0,0 +1,53 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "traceparent": "00-8662555c7572c3479be2db2618d0fc6b-342fb20273b75345-00", + "User-Agent": [ + "azsdk-net-ResourceManager.Resources/1.0.0-preview.2", + "(.NET Core 4.6.29812.02; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "8b9c55722d0b5a88de7510f03d585e51", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "397", + "Content-Type": "application/json; charset=utf-8", + "Date": "Fri, 09 Apr 2021 20:34:26 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "bb44167c-f181-458a-9626-01a70b69d593", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-request-id": "bb44167c-f181-458a-9626-01a70b69d593", + "x-ms-routing-request-id": "WESTUS:20210409T203426Z:bb44167c-f181-458a-9626-01a70b69d593" + }, + "ResponseBody": { + "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "authorizationSource": "RoleBased", + "managedByTenants": [], + "subscriptionId": "db1ab6f0-4769-4b27-930e-01e2ef9c123c", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "displayName": "Azure SDK sandbox", + "state": "Enabled", + "subscriptionPolicies": { + "locationPlacementId": "Internal_2014-09-01", + "quotaId": "Internal_2014-09-01", + "spendingLimit": "Off" + } + } + } + ], + "Variables": { + "RandomSeed": "1528757771", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file From b3bd667a60c5d27d224ebdea5638bc3f26830d55 Mon Sep 17 00:00:00 2001 From: nisha-bhatia Date: Fri, 9 Apr 2021 16:59:18 -0700 Subject: [PATCH 6/6] remove transport --- common/ManagementCoreShared/ClientContext.cs | 9 +---- .../src/ArmClientOptions.cs | 2 +- .../src/GenericResourceOperations.cs | 39 ++++++++++++------- .../src/OperationsBase.cs | 3 -- .../tests/Unit/ArmClientOptionsTests.cs | 6 --- 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/common/ManagementCoreShared/ClientContext.cs b/common/ManagementCoreShared/ClientContext.cs index 4539de6a31c61..5ac7d226aa55b 100644 --- a/common/ManagementCoreShared/ClientContext.cs +++ b/common/ManagementCoreShared/ClientContext.cs @@ -27,24 +27,17 @@ internal class ClientContext /// public Uri BaseUri { get; set; } - /// - /// pipeline transport - /// - public HttpPipelineTransport Transport { get; set; } - /// /// Initializes a new instance of the class. /// /// /// /// - /// - internal ClientContext(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipelineTransport transport = default) + internal ClientContext(ArmClientOptions clientOptions, TokenCredential credential, Uri uri) { ClientOptions = clientOptions; Credential = credential; BaseUri = uri; - Transport = transport; } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs index e6f6cb0c6593a..76d72ad712a1d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClientOptions.cs @@ -60,7 +60,7 @@ internal ArmClientOptions(LocationData defaultLocation, ArmClientOptions other = ApiVersions = new ApiVersions(this); } - internal ArmClientOptions(LocationData location, IList perCallPolicies, IList perRetryPolicies) + private ArmClientOptions(LocationData location, IList perCallPolicies, IList perRetryPolicies) { if (location is null) throw new ArgumentNullException(nameof(location)); diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs index 8ac6cce79fdc0..cd23bc129417d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs @@ -105,8 +105,9 @@ public ArmResponse AddTag(string key, string value, Cancellatio GenericResource resource = GetResource(); // Potential optimization on tags set, remove NOOP to bypass the call. resource.Data.Tags[key] = value; + var apiVersion = GetApiVersion(cancellationToken); return new PhArmResponse( - Operations.StartUpdateById(Id, GetApiVersion(cancellationToken), resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), + Operations.StartUpdateById(Id, apiVersion, resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), v => new GenericResource(this, new GenericResourceData(v))); } @@ -115,7 +116,8 @@ public async Task> AddTagAsync(string key, string v { GenericResource resource = await GetResourceAsync(cancellationToken).ConfigureAwait(false); resource.Data.Tags[key] = value; - var op = await Operations.StartUpdateByIdAsync(Id, await GetApiVersionAsync(cancellationToken).ConfigureAwait(false), resource.Data, cancellationToken).ConfigureAwait(false); + var apiVersion = await GetApiVersionAsync(cancellationToken).ConfigureAwait(false); + var op = await Operations.StartUpdateByIdAsync(Id, apiVersion, resource.Data, cancellationToken).ConfigureAwait(false); return new PhArmResponse( await op.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false), v => new GenericResource(this, new GenericResourceData(v))); @@ -126,8 +128,9 @@ public ArmOperation StartAddTag(string key, string value, Cance { GenericResource resource = GetResource(); resource.Data.Tags[key] = value; + var apiVersion = GetApiVersion(cancellationToken); return new PhArmOperation( - Operations.StartUpdateById(Id, GetApiVersion(cancellationToken), resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), + Operations.StartUpdateById(Id, apiVersion, resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), v => new GenericResource(this, new GenericResourceData(v))); } @@ -136,7 +139,8 @@ public async Task> StartAddTagAsync(string key, st { GenericResource resource = await GetResourceAsync(cancellationToken).ConfigureAwait(false); resource.Data.Tags[key] = value; - var op = await Operations.StartUpdateByIdAsync(Id, await GetApiVersionAsync(cancellationToken).ConfigureAwait(false), resource.Data, cancellationToken).ConfigureAwait(false); + var apiVersion = await GetApiVersionAsync(cancellationToken).ConfigureAwait(false); + var op = await Operations.StartUpdateByIdAsync(Id, apiVersion, resource.Data, cancellationToken).ConfigureAwait(false); return new PhArmOperation( await op.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false), v => new GenericResource(this, new GenericResourceData(v))); @@ -145,8 +149,9 @@ await op.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false), /// public override ArmResponse Get(CancellationToken cancellationToken = default) { + var apiVersion = GetApiVersion(cancellationToken); return new PhArmResponse( - Operations.GetById(Id, GetApiVersion(cancellationToken), cancellationToken), + Operations.GetById(Id, apiVersion, cancellationToken), v => new GenericResource(this, new GenericResourceData(v))); } @@ -174,8 +179,9 @@ public ArmResponse SetTags(IDictionary tags, Ca { GenericResource resource = GetResource(); resource.Data.Tags.ReplaceWith(tags); + var apiVersion = GetApiVersion(cancellationToken); return new PhArmResponse( - Operations.StartUpdateById(Id, GetApiVersion(cancellationToken), resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), + Operations.StartUpdateById(Id, apiVersion, resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), v => new GenericResource(this, new GenericResourceData(v))); } @@ -184,7 +190,8 @@ public async Task> SetTagsAsync(IDictionary( await op.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false), v => new GenericResource(this, new GenericResourceData(v))); @@ -195,8 +202,9 @@ public ArmOperation StartSetTags(IDictionary ta { GenericResource resource = GetResource(); resource.Data.Tags.ReplaceWith(tags); + var apiVersion = GetApiVersion(cancellationToken); return new PhArmOperation( - Operations.StartUpdateById(Id, GetApiVersion(cancellationToken), resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), + Operations.StartUpdateById(Id, apiVersion, resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), v => new GenericResource(this, new GenericResourceData(v))); } @@ -205,7 +213,8 @@ public async Task> StartSetTagsAsync(IDictionary( await op.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false), v => new GenericResource(this, new GenericResourceData(v))); @@ -216,8 +225,9 @@ public ArmResponse RemoveTag(string key, CancellationToken canc { GenericResource resource = GetResource(); resource.Data.Tags.Remove(key); + var apiVersion = GetApiVersion(cancellationToken); return new PhArmResponse( - Operations.StartUpdateById(Id, GetApiVersion(cancellationToken), resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), + Operations.StartUpdateById(Id, apiVersion, resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), v => new GenericResource(this, new GenericResourceData(v))); } @@ -226,7 +236,8 @@ public async Task> RemoveTagAsync(string key, Cance { GenericResource resource = await GetResourceAsync(cancellationToken).ConfigureAwait(false); resource.Data.Tags.Remove(key); - var op = await Operations.StartUpdateByIdAsync(Id, await GetApiVersionAsync(cancellationToken).ConfigureAwait(false), resource.Data, cancellationToken).ConfigureAwait(false); + var apiVersion = await GetApiVersionAsync(cancellationToken).ConfigureAwait(false); + var op = await Operations.StartUpdateByIdAsync(Id, apiVersion, resource.Data, cancellationToken).ConfigureAwait(false); return new PhArmResponse( await op.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false), v => new GenericResource(this, new GenericResourceData(v))); @@ -237,8 +248,9 @@ public ArmOperation StartRemoveTag(string key, CancellationToke { GenericResource resource = GetResource(); resource.Data.Tags.Remove(key); + var apiVersion = GetApiVersion(cancellationToken); return new PhArmOperation( - Operations.StartUpdateById(Id, GetApiVersion(cancellationToken), resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), + Operations.StartUpdateById(Id, apiVersion, resource.Data, cancellationToken).WaitForCompletionAsync(cancellationToken).EnsureCompleted(), v => new GenericResource(this, new GenericResourceData(v))); } @@ -247,7 +259,8 @@ public async Task> StartRemoveTagAsync(string key, { GenericResource resource = await GetResourceAsync(cancellationToken).ConfigureAwait(false); resource.Data.Tags.Remove(key); - var op = await Operations.StartUpdateByIdAsync(Id, await GetApiVersionAsync(cancellationToken).ConfigureAwait(false), resource.Data, cancellationToken).ConfigureAwait(false); + var apiVersion = await GetApiVersionAsync(cancellationToken).ConfigureAwait(false); + var op = await Operations.StartUpdateByIdAsync(Id, apiVersion, resource.Data, cancellationToken).ConfigureAwait(false); return new PhArmOperation( await op.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false), v => new GenericResource(this, new GenericResourceData(v))); diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs index 7b6c69f7b6458..ce6e75437012c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs @@ -32,15 +32,12 @@ internal OperationsBase(ClientContext clientContext, ResourceIdentifier id) Credential = clientContext.Credential; BaseUri = clientContext.BaseUri; Diagnostics = new ClientDiagnostics(ClientOptions); - Transport = (HttpClientTransport)clientContext.Transport; Validate(id); } internal ClientDiagnostics Diagnostics { get; } - internal HttpClientTransport Transport { get; } - /// /// Gets the resource identifier. /// diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs index cc632bcb6f83d..edcc23fe9a6bd 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Unit/ArmClientOptionsTests.cs @@ -35,12 +35,6 @@ public void TestTransportInClone() x.Transport = new MyTransport(); Assert.IsFalse(ReferenceEquals(y.Transport, x.Transport)); - - var z = new ArmClientOptions(); - ArmClient client = GetArmClient(z); - var sub = client.DefaultSubscription; - z.Transport = new MyTransport(); - Assert.IsFalse(ReferenceEquals(y.Transport, sub.Transport)); } private class MyTransport : HttpPipelineTransport