public async virtual Task <Response <CdnCustomDomain> > GetAsync(string customDomainName, CancellationToken cancellationToken = default) { if (customDomainName == null) { throw new ArgumentNullException(nameof(customDomainName)); } using var scope = _clientDiagnostics.CreateScope("CdnCustomDomainCollection.Get"); scope.Start(); try { var response = await _cdnCustomDomainsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new CdnCustomDomain(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <CdnCustomDomain> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _cdnCustomDomainClientDiagnostics.CreateScope("CdnCustomDomain.Get"); scope.Start(); try { var response = await _cdnCustomDomainRestClient.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 CdnCustomDomain(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }