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