public async virtual Task <Response <FlowLog> > GetAsync(string flowLogName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("FlowLogContainer.Get"); scope.Start(); try { if (flowLogName == null) { throw new ArgumentNullException(nameof(flowLogName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, flowLogName, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new FlowLog(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <FlowLogResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _flowLogClientDiagnostics.CreateScope("FlowLogResource.Get"); scope.Start(); try { var response = await _flowLogRestClient.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 FlowLogResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <FlowLog> > GetAsync(string flowLogName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(flowLogName, nameof(flowLogName)); using var scope = _flowLogClientDiagnostics.CreateScope("FlowLogCollection.Get"); scope.Start(); try { var response = await _flowLogRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, flowLogName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _flowLogClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new FlowLog(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }