public virtual Response <JobAgent> Get(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("JobAgent.Get"); scope.Start(); try { var response = _jobAgentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new JobAgent(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <JobAgentResource> Get(string jobAgentName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(jobAgentName, nameof(jobAgentName)); using var scope = _jobAgentClientDiagnostics.CreateScope("JobAgentCollection.Get"); scope.Start(); try { var response = _jobAgentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobAgentName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new JobAgentResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }