public virtual Response <JobTargetGroup> Get(string targetGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(targetGroupName, nameof(targetGroupName)); using var scope = _jobTargetGroupClientDiagnostics.CreateScope("JobTargetGroupCollection.Get"); scope.Start(); try { var response = _jobTargetGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, targetGroupName, cancellationToken); if (response.Value == null) { throw _jobTargetGroupClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new JobTargetGroup(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <JobTargetGroup> Get(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("JobTargetGroup.Get"); scope.Start(); try { var response = _jobTargetGroupsRestClient.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 JobTargetGroup(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }