diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs index 7aea736aa91b..43fc13de7516 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmClient.cs @@ -162,6 +162,15 @@ public GenericResourceOperations GetGenericResourcesOperations(TenantResourceIde return new GenericResourceOperations(new ClientContext(ClientOptions, Credential, BaseUri, Pipeline), id); } + /// + /// Gets the tenants. + /// + /// Tenant container. + public TenantContainer GetTenants() + { + return new TenantContainer(new ClientContext(ClientOptions, Credential, BaseUri, Pipeline)); + } + /// /// Creates a container using the lambda expression passed in. /// diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantCategory.Serialization.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantCategory.Serialization.cs new file mode 100644 index 000000000000..7cb304e03e8e --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantCategory.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Core +{ + internal static partial class TenantCategoryExtensions + { + public static string ToSerialString(this TenantCategory value) => value switch + { + TenantCategory.Home => "Home", + TenantCategory.ProjectedBy => "ProjectedBy", + TenantCategory.ManagedBy => "ManagedBy", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TenantCategory value.") + }; + + public static TenantCategory ToTenantCategory(this string value) + { + if (string.Equals(value, "Home", StringComparison.InvariantCultureIgnoreCase)) + return TenantCategory.Home; + if (string.Equals(value, "ProjectedBy", StringComparison.InvariantCultureIgnoreCase)) + return TenantCategory.ProjectedBy; + if (string.Equals(value, "ManagedBy", StringComparison.InvariantCultureIgnoreCase)) + return TenantCategory.ManagedBy; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TenantCategory value."); + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantCategory.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantCategory.cs new file mode 100644 index 000000000000..73f3e37a8618 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantCategory.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Core +{ + /// Category of the tenant. + public enum TenantCategory + { + /// Home. + Home, + /// ProjectedBy. + ProjectedBy, + /// ManagedBy. + ManagedBy + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantIdDescription.Serialization.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantIdDescription.Serialization.cs new file mode 100644 index 000000000000..c6aeabe16f94 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantIdDescription.Serialization.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Core +{ + public partial class TenantIdDescription + { + internal static TenantIdDescription DeserializeTenantIdDescription(JsonElement element) + { + Optional id = default; + Optional tenantId = default; + Optional tenantCategory = default; + Optional country = default; + Optional countryCode = default; + Optional displayName = default; + Optional> domains = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantCategory")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tenantCategory = property.Value.GetString().ToTenantCategory(); + continue; + } + if (property.NameEquals("country")) + { + country = property.Value.GetString(); + continue; + } + if (property.NameEquals("countryCode")) + { + countryCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName")) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("domains")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + domains = array; + continue; + } + } + return new TenantIdDescription(id.Value, tenantId.Value, Optional.ToNullable(tenantCategory), country.Value, countryCode.Value, displayName.Value, Optional.ToList(domains)); + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantIdDescription.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantIdDescription.cs new file mode 100644 index 000000000000..63e94f7b4e87 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantIdDescription.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Core +{ + /// Tenant Id information. + public partial class TenantIdDescription + { + /// Initializes a new instance of TenantIdDescription. + internal TenantIdDescription() + { + Domains = new ChangeTrackingList(); + } + + /// Initializes a new instance of TenantIdDescription. + /// The fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. + /// The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + /// Category of the tenant. + /// Country/region name of the address for the tenant. + /// Country/region abbreviation for the tenant. + /// The display name of the tenant. + /// The list of domains for the tenant. + internal TenantIdDescription(string id, string tenantId, TenantCategory? tenantCategory, string country, string countryCode, string displayName, IReadOnlyList domains) + { + Id = id; + TenantId = tenantId; + TenantCategory = tenantCategory; + Country = country; + CountryCode = countryCode; + DisplayName = displayName; + Domains = domains; + } + + /// The fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. + public string Id { get; } + /// The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + public string TenantId { get; } + /// Category of the tenant. + public TenantCategory? TenantCategory { get; } + /// Country/region name of the address for the tenant. + public string Country { get; } + /// Country/region abbreviation for the tenant. + public string CountryCode { get; } + /// The display name of the tenant. + public string DisplayName { get; } + /// The list of domains for the tenant. + public IReadOnlyList Domains { get; } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantListResult.Serialization.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantListResult.Serialization.cs new file mode 100644 index 000000000000..c2c1e0e2e6d5 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantListResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Core +{ + internal partial class TenantListResult + { + internal static TenantListResult DeserializeTenantListResult(JsonElement element) + { + Optional> value = default; + string nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TenantIdDescription.DeserializeTenantIdDescription(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new TenantListResult(Optional.ToList(value), nextLink); + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantListResult.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantListResult.cs new file mode 100644 index 000000000000..6fa57dee19e1 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Models/TenantListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Core +{ + /// Tenant Ids information. + internal partial class TenantListResult + { + /// Initializes a new instance of TenantListResult. + /// The URL to use for getting the next set of results. + /// is null. + internal TenantListResult(string nextLink) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + Value = new ChangeTrackingList(); + NextLink = nextLink; + } + + /// Initializes a new instance of TenantListResult. + /// An array of tenants. + /// The URL to use for getting the next set of results. + internal TenantListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of tenants. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Subscription.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Subscription.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager.Core/src/Subscription.cs rename to sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/Subscription.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionContainer.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/SubscriptionContainer.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionContainer.cs rename to sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/SubscriptionContainer.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionOperations.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/SubscriptionOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/SubscriptionOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantContainer.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantContainer.cs new file mode 100644 index 000000000000..7395d75cce5c --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantContainer.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Core +{ + /// + /// A class representing collection of Tenant and their operations over their parent. + /// + public class TenantContainer : ContainerBase + { + /// + /// Initializes a new instance of the class for mocking. + /// + protected TenantContainer() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal TenantContainer(ClientContext clientContext) + : base(clientContext) + { + } + + /// + protected override ResourceType ValidResourceType => ResourceIdentifier.RootResourceIdentifier.ResourceType; + + private TenantsRestOperations RestClient => new TenantsRestOperations(Diagnostics, Pipeline, BaseUri); + + /// Gets the tenants for your account. + /// The cancellation token to use. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = Diagnostics.CreateScope("TenantContainer.List"); + scope.Start(); + try + { + var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = Diagnostics.CreateScope("TenantContainer.List"); + scope.Start(); + try + { + var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Gets the tenants for your account. + /// The cancellation token to use. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = Diagnostics.CreateScope("TenantContainer.List"); + scope.Start(); + try + { + var response = RestClient.List(cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = Diagnostics.CreateScope("TenantContainer.List"); + scope.Start(); + try + { + var response = RestClient.ListNextPage(nextLink, cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/TenantOperations.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantOperations.cs similarity index 90% rename from sdk/resourcemanager/Azure.ResourceManager.Core/src/TenantOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantOperations.cs index 380e9b092de6..9e215003f1a0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/TenantOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantOperations.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.ComponentModel; using Azure.Core; using Azure.Core.Pipeline; @@ -40,9 +41,10 @@ internal TenantOperations(ArmClientOptions options, TokenCredential credential, /// /// /// - public virtual T ListResources(Func func) + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual T ListResources(Func func) { - return func(BaseUri, Credential, ClientOptions); + return func(BaseUri, Credential, ClientOptions, Pipeline); } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantsRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantsRestOperations.cs new file mode 100644 index 000000000000..f5315014e57d --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Generated/TenantsRestOperations.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Core +{ + internal partial class TenantsRestOperations + { + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of TenantsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + public TenantsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + endpoint ??= new Uri("https://management.azure.com"); + + this.endpoint = endpoint; + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/tenants", false); + uri.AppendQuery("api-version", "2019-11-01", true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the tenants for your account. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TenantListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TenantListResult.DeserializeTenantListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the tenants for your account. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TenantListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TenantListResult.DeserializeTenantListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Gets the tenants for your account. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TenantListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TenantListResult.DeserializeTenantListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Gets the tenants for your account. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TenantListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TenantListResult.DeserializeTenantListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/TenantContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/TenantContainerTests.cs new file mode 100644 index 000000000000..ae19a5767ed6 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/TenantContainerTests.cs @@ -0,0 +1,26 @@ +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.ResourceManager.Core.Tests +{ + public class TenantContainerTests : ResourceManagerTestBase + { + public TenantContainerTests(bool isAsync) + : base(isAsync)//, RecordedTestMode.Record) + { + } + + [TestCase] + [RecordedTest] + public async Task List() + { + int count = 0; + await foreach (var tenant in Client.GetTenants().ListAsync()) + { + count++; + } + Assert.GreaterOrEqual(count, 1); + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/TenantContainerTests/List().json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/TenantContainerTests/List().json new file mode 100644 index 000000000000..2a9b3684846f --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/TenantContainerTests/List().json @@ -0,0 +1,85 @@ +{ + "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.Core/1.0.0-alpha.20210527.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "e039c96fe3b97aa3a44d114281be64d1", + "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": "Thu, 27 May 2021 18:26:17 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "21c067c3-1539-4e3f-993a-2b688e2b1bdd", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-request-id": "21c067c3-1539-4e3f-993a-2b688e2b1bdd", + "x-ms-routing-request-id": "WESTUS2:20210527T182618Z:21c067c3-1539-4e3f-993a-2b688e2b1bdd" + }, + "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/tenants?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210527.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "1a30e3702f9a17609a57f5969367d815", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "140", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 27 May 2021 18:26:18 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "28dbdc64-4182-438e-b3d4-18eef5315341", + "x-ms-ratelimit-remaining-tenant-reads": "11999", + "x-ms-request-id": "28dbdc64-4182-438e-b3d4-18eef5315341", + "x-ms-routing-request-id": "WESTUS2:20210527T182618Z:28dbdc64-4182-438e-b3d4-18eef5315341" + }, + "ResponseBody": { + "value": [ + { + "id": "/tenants/72f988bf-86f1-41af-91ab-2d7cd011db47", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "tenantCategory": "Home" + } + ] + } + } + ], + "Variables": { + "RandomSeed": "1284681173", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/TenantContainerTests/List()Async.json b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/TenantContainerTests/List()Async.json new file mode 100644 index 000000000000..a9b29d0756d1 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/tests/SessionRecords/TenantContainerTests/List()Async.json @@ -0,0 +1,85 @@ +{ + "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.Core/1.0.0-alpha.20210527.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "e039c96fe3b97aa3a44d114281be64d1", + "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": "Thu, 27 May 2021 18:26:17 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "08a939b9-5112-40cb-a0cb-7147b4563521", + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-request-id": "08a939b9-5112-40cb-a0cb-7147b4563521", + "x-ms-routing-request-id": "WESTUS2:20210527T182618Z:08a939b9-5112-40cb-a0cb-7147b4563521" + }, + "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/tenants?api-version=2019-11-01", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210527.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "x-ms-client-request-id": "1a30e3702f9a17609a57f5969367d815", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "140", + "Content-Type": "application/json; charset=utf-8", + "Date": "Thu, 27 May 2021 18:26:17 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "5e364867-137f-46fd-a031-2c9c6c33b911", + "x-ms-ratelimit-remaining-tenant-reads": "11999", + "x-ms-request-id": "5e364867-137f-46fd-a031-2c9c6c33b911", + "x-ms-routing-request-id": "WESTUS2:20210527T182618Z:5e364867-137f-46fd-a031-2c9c6c33b911" + }, + "ResponseBody": { + "value": [ + { + "id": "/tenants/72f988bf-86f1-41af-91ab-2d7cd011db47", + "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "tenantCategory": "Home" + } + ] + } + } + ], + "Variables": { + "RandomSeed": "1284681173", + "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" + } +} \ No newline at end of file