public virtual Response <HostPool> Get(CancellationToken cancellationToken = default) { using var scope = _hostPoolClientDiagnostics.CreateScope("HostPool.Get"); scope.Start(); try { var response = _hostPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new HostPool(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <HostPoolResource> Get(string hostPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); using var scope = _hostPoolClientDiagnostics.CreateScope("HostPoolCollection.Get"); scope.Start(); try { var response = _hostPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, hostPoolName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new HostPoolResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }