public async virtual Task <Response <SiteDiagnosticAnalysis> > GetAsync(string analysisName, CancellationToken cancellationToken = default)
        {
            if (analysisName == null)
            {
                throw new ArgumentNullException(nameof(analysisName));
            }

            using var scope = _clientDiagnostics.CreateScope("SiteDiagnosticAnalysisCollection.Get");
            scope.Start();
            try
            {
                var response = await _diagnosticsRestClient.GetSiteAnalysisAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, analysisName, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new SiteDiagnosticAnalysis(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Пример #2
0
        public virtual async Task <Response <SiteDiagnosticAnalysisResource> > GetAsync(CancellationToken cancellationToken = default)
        {
            using var scope = _siteDiagnosticAnalysisDiagnosticsClientDiagnostics.CreateScope("SiteDiagnosticAnalysisResource.Get");
            scope.Start();
            try
            {
                var response = await _siteDiagnosticAnalysisDiagnosticsRestClient.GetSiteAnalysisAsync(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 SiteDiagnosticAnalysisResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }