public async virtual Task <Response <ServerDatabaseVulnerabilityAssessmentRuleBaseline> > GetAsync(string ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, CancellationToken cancellationToken = default) { if (ruleId == null) { throw new ArgumentNullException(nameof(ruleId)); } using var scope = _clientDiagnostics.CreateScope("ServerDatabaseVulnerabilityAssessmentRuleBaselineCollection.Get"); scope.Start(); try { var response = await _databaseVulnerabilityAssessmentRuleBaselinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ruleId, baselineName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ServerDatabaseVulnerabilityAssessmentRuleBaseline(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <ServerDatabaseVulnerabilityAssessmentRuleBaselineResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _serverDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesClientDiagnostics.CreateScope("ServerDatabaseVulnerabilityAssessmentRuleBaselineResource.Get"); scope.Start(); try { var response = await _serverDatabaseVulnerabilityAssessmentRuleBaselineDatabaseVulnerabilityAssessmentRuleBaselinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Parent.Name, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name.ToVulnerabilityAssessmentPolicyBaselineName(), cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ServerDatabaseVulnerabilityAssessmentRuleBaselineResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }