public async virtual Task <Response <CosmosDBLocation> > GetAsync(string location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(location, nameof(location)); using var scope = _cosmosDBLocationLocationsClientDiagnostics.CreateScope("CosmosDBLocationCollection.Get"); scope.Start(); try { var response = await _cosmosDBLocationLocationsRestClient.GetAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _cosmosDBLocationLocationsClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new CosmosDBLocation(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <CosmosDBLocationResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _cosmosDBLocationLocationsClientDiagnostics.CreateScope("CosmosDBLocationResource.Get"); scope.Start(); try { var response = await _cosmosDBLocationLocationsRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new CosmosDBLocationResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }