public async virtual Task <Response <AfdOrigin> > GetAsync(string originName, CancellationToken cancellationToken = default) { if (originName == null) { throw new ArgumentNullException(nameof(originName)); } using var scope = _clientDiagnostics.CreateScope("AfdOriginCollection.Get"); scope.Start(); try { var response = await _afdOriginsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new AfdOrigin(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <AfdOriginResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _afdOriginClientDiagnostics.CreateScope("AfdOriginResource.Get"); scope.Start(); try { var response = await _afdOriginRestClient.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 AfdOriginResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }