public virtual Response <AfdOrigin> Get(string originName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(originName, nameof(originName)); using var scope = _afdOriginClientDiagnostics.CreateScope("AfdOriginCollection.Get"); scope.Start(); try { var response = _afdOriginRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, cancellationToken); if (response.Value == null) { throw _afdOriginClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new AfdOrigin(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <AfdOrigin> Get(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("AfdOrigin.Get"); scope.Start(); try { var response = _afdOriginsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new AfdOrigin(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }