public static async Task <IList <CustomDomain> > ListAllByEndpointAsync(this ICustomDomainsOperations operations, string resourceGroupName, string profileName, string endpointName)
        {
            var endpoints = new List <CustomDomain>();

            var list = await operations.ListByEndpointAsync(resourceGroupName, profileName, endpointName);

            endpoints.AddRange(list);

            while (list.NextPageLink != null)
            {
                list = await operations.ListByEndpointNextAsync(list.NextPageLink);

                endpoints.AddRange(list);
            }

            return(endpoints);
        }
 /// <summary>
 /// Lists all of the existing custom domains within an endpoint.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Name of the Resource group within the Azure subscription.
 /// </param>
 /// <param name='profileName'>
 /// Name of the CDN profile which is unique within the resource group.
 /// </param>
 /// <param name='endpointName'>
 /// Name of the endpoint under the profile which is unique globally.
 /// </param>
 public static IPage <CustomDomain> ListByEndpoint(this ICustomDomainsOperations operations, string resourceGroupName, string profileName, string endpointName)
 {
     return(operations.ListByEndpointAsync(resourceGroupName, profileName, endpointName).GetAwaiter().GetResult());
 }