public async Task <Response <UsagesListResult> > ListAsync(string location, CancellationToken cancellationToken = default) { if (location == null) { throw new ArgumentNullException(nameof(location)); } using var message = CreateListRequest(location); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { UsagesListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); if (document.RootElement.ValueKind == JsonValueKind.Null) { value = null; } else { value = UsagesListResult.DeserializeUsagesListResult(document.RootElement); } return(Response.FromValue(value, message.Response)); }
public async Task<Response<UsagesListResult>> ListResourceUsageAsync(string subscriptionId, string resourceGroupName, string profileName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(profileName, nameof(profileName)); using var message = CreateListResourceUsageRequest(subscriptionId, resourceGroupName, profileName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { UsagesListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = UsagesListResult.DeserializeUsagesListResult(document.RootElement); return Response.FromValue(value, message.Response); }