public virtual Response <SessionHostResource> Get(string sessionHostName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); using var scope = _sessionHostClientDiagnostics.CreateScope("SessionHostCollection.Get"); scope.Start(); try { var response = _sessionHostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sessionHostName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new SessionHostResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <SessionHostResource> Get(CancellationToken cancellationToken = default) { using var scope = _sessionHostClientDiagnostics.CreateScope("SessionHostResource.Get"); scope.Start(); try { var response = _sessionHostRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new SessionHostResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }