public virtual Response <DedicatedHostGroup> Get(InstanceViewTypes?expand = null, CancellationToken cancellationToken = default) { using var scope = _dedicatedHostGroupClientDiagnostics.CreateScope("DedicatedHostGroup.Get"); scope.Start(); try { var response = _dedicatedHostGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); if (response.Value == null) { throw _dedicatedHostGroupClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DedicatedHostGroup(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DedicatedHostGroupResource> Get(string hostGroupName, InstanceViewTypes?expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(hostGroupName, nameof(hostGroupName)); using var scope = _dedicatedHostGroupClientDiagnostics.CreateScope("DedicatedHostGroupCollection.Get"); scope.Start(); try { var response = _dedicatedHostGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, hostGroupName, expand, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DedicatedHostGroupResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DedicatedHostGroup> Get(string hostGroupName, InstanceViewTypes?expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupContainer.Get"); scope.Start(); try { if (hostGroupName == null) { throw new ArgumentNullException(nameof(hostGroupName)); } var response = _restClient.Get(Id.ResourceGroupName, hostGroupName, expand, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new DedicatedHostGroup(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }