public async virtual Task <Response <Table> > GetAsync(string tableName, CancellationToken cancellationToken = default) { if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } using var scope = _clientDiagnostics.CreateScope("TableCollection.Get"); scope.Start(); try { var response = await _tableRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, tableName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new Table(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <TableResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _tableClientDiagnostics.CreateScope("TableResource.Get"); scope.Start(); try { var response = await _tableRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new TableResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }