public async virtual Task <Response <DisasterRecovery> > GetAsync(string @alias, CancellationToken cancellationToken = default) { if (@alias == null) { throw new ArgumentNullException(nameof(@alias)); } using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryCollection.Get"); scope.Start(); try { var response = await _disasterRecoveryConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alias, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new DisasterRecovery(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <DisasterRecoveryResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _disasterRecoveryDisasterRecoveryConfigsClientDiagnostics.CreateScope("DisasterRecoveryResource.Get"); scope.Start(); try { var response = await _disasterRecoveryDisasterRecoveryConfigsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DisasterRecoveryResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }