public virtual async Task <Response <VMwareCluster> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _vMwareClusterClustersClientDiagnostics.CreateScope("VMwareCluster.Get"); scope.Start(); try { var response = await _vMwareClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VMwareCluster(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <VMwareCluster> > GetAsync(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); using var scope = _vMwareClusterClustersClientDiagnostics.CreateScope("VMwareClusterCollection.Get"); scope.Start(); try { var response = await _vMwareClusterClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _vMwareClusterClustersClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new VMwareCluster(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }