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='nextPageLink'>
 /// The NextLink from the previous successful call to List operation.
 /// </param>
 public static IPage <CustomDomain> ListByEndpointNext(this ICustomDomainsOperations operations, string nextPageLink)
 {
     return(operations.ListByEndpointNextAsync(nextPageLink).GetAwaiter().GetResult());
 }