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