public ResponseWithHeaders <StorageServiceStats, ServiceGetStatisticsHeaders> GetStatistics(int?timeout = null, string requestId = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetStatistics"); scope.Start(); try { using var message = CreateGetStatisticsRequest(timeout, requestId); _pipeline.Send(message, cancellationToken); var headers = new ServiceGetStatisticsHeaders(message.Response); switch (message.Response.Status) { case 200: { StorageServiceStats value = default; var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace); if (document.Element("StorageServiceStats") is XElement storageServiceStatsElement) { value = StorageServiceStats.DeserializeStorageServiceStats(storageServiceStatsElement); } return(ResponseWithHeaders.FromValue(value, headers, message.Response)); } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } catch (Exception e) { scope.Failed(e); throw; } }
public ResponseWithHeaders <TableServiceStatistics, ServiceGetStatisticsHeaders> GetStatistics(int?timeout = null, CancellationToken cancellationToken = default) { using var message = CreateGetStatisticsRequest(timeout); _pipeline.Send(message, cancellationToken); var headers = new ServiceGetStatisticsHeaders(message.Response); switch (message.Response.Status) { case 200: { TableServiceStatistics value = default; var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace); if (document.Element("StorageServiceStats") is XElement storageServiceStatsElement) { value = TableServiceStatistics.DeserializeTableServiceStatistics(storageServiceStatsElement); } return(ResponseWithHeaders.FromValue(value, headers, message.Response)); } default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } }
public async Task <ResponseWithHeaders <TableServiceStats, ServiceGetStatisticsHeaders> > GetStatisticsAsync(int?timeout = null, string requestId = null, CancellationToken cancellationToken = default) { using var message = CreateGetStatisticsRequest(timeout, requestId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); var headers = new ServiceGetStatisticsHeaders(message.Response); switch (message.Response.Status) { case 200: { TableServiceStats value = default; var document = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace); if (document.Element("TableServiceStats") is XElement tableServiceStatsElement) { value = TableServiceStats.DeserializeTableServiceStats(tableServiceStatsElement); } return(ResponseWithHeaders.FromValue(value, headers, message.Response)); } default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } }