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

            using var scope = _clientDiagnostics.CreateScope("CdnOriginCollection.Get");
            scope.Start();
            try
            {
                var response = await _cdnOriginsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new CdnOrigin(this, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #2
0
 public virtual async Task<Response<CdnOriginResource>> GetAsync(CancellationToken cancellationToken = default)
 {
     using var scope = _cdnOriginClientDiagnostics.CreateScope("CdnOriginResource.Get");
     scope.Start();
     try
     {
         var response = await _cdnOriginRestClient.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 CdnOriginResource(Client, response.Value), response.GetRawResponse());
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }