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

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

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