public virtual Response <InstancePool> Get(CancellationToken cancellationToken = default) { using var scope = _instancePoolClientDiagnostics.CreateScope("InstancePool.Get"); scope.Start(); try { var response = _instancePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new InstancePool(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <InstancePool> Get(string instancePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(instancePoolName, nameof(instancePoolName)); using var scope = _instancePoolClientDiagnostics.CreateScope("InstancePoolCollection.Get"); scope.Start(); try { var response = _instancePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, instancePoolName, cancellationToken); if (response.Value == null) { throw _instancePoolClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new InstancePool(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }