public virtual Response <CosmosDBLocation> Get(string location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(location, nameof(location)); using var scope = _cosmosDBLocationLocationsClientDiagnostics.CreateScope("CosmosDBLocationCollection.Get"); scope.Start(); try { var response = _cosmosDBLocationLocationsRestClient.Get(Id.SubscriptionId, location, cancellationToken); if (response.Value == null) { throw _cosmosDBLocationLocationsClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new CosmosDBLocation(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <CosmosDBLocationResource> Get(CancellationToken cancellationToken = default) { using var scope = _cosmosDBLocationLocationsClientDiagnostics.CreateScope("CosmosDBLocationResource.Get"); scope.Start(); try { var response = _cosmosDBLocationLocationsRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); 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; } }