public async virtual Task <Response <ServerDatabaseAdvisor> > GetAsync(string advisorName, CancellationToken cancellationToken = default) { if (advisorName == null) { throw new ArgumentNullException(nameof(advisorName)); } using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.Get"); scope.Start(); try { var response = await _databaseAdvisorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advisorName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ServerDatabaseAdvisor(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <ServerDatabaseAdvisorResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _serverDatabaseAdvisorDatabaseAdvisorsClientDiagnostics.CreateScope("ServerDatabaseAdvisorResource.Get"); scope.Start(); try { var response = await _serverDatabaseAdvisorDatabaseAdvisorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ServerDatabaseAdvisorResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }