public async virtual Task <Response <KubeEnvironment> > GetAsync(string name, CancellationToken cancellationToken = default) { if (name == null) { throw new ArgumentNullException(nameof(name)); } using var scope = _clientDiagnostics.CreateScope("KubeEnvironmentCollection.Get"); scope.Start(); try { var response = await _kubeEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new KubeEnvironment(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <KubeEnvironmentResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _kubeEnvironmentClientDiagnostics.CreateScope("KubeEnvironmentResource.Get"); scope.Start(); try { var response = await _kubeEnvironmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new KubeEnvironmentResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }