/// <summary>
 /// Gets all the Azure Firewall FQDN Tags in a subscription.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IPage <AzureFirewallFqdnTagInner> > ListAllAsync(this IAzureFirewallFqdnTagsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        internal static IEnumerable <PSAzureFirewallFqdnTag> GetAzureFirewallAllowedFqdnTags(IAzureFirewallFqdnTagsOperations azureFirewallFqdnTagClient)
        {
            IPage <AzureFirewallFqdnTag> azureFirewallFqdnTagPage = azureFirewallFqdnTagClient.ListAll();

            // Get all resources by polling on next page link
            var azureFirewallFqdnTagResponseLIst = ListNextLink <AzureFirewallFqdnTag> .GetAllResourcesByPollingNextLink(azureFirewallFqdnTagPage, azureFirewallFqdnTagClient.ListAllNext);

            var psAzureFirewallFqdnTags = azureFirewallFqdnTagResponseLIst.Select(fqdnTag =>
            {
                var psFqdnTag = ToPsAzureFirewallFqdnTag(fqdnTag);
                psFqdnTag.ResourceGroupName = NetworkBaseCmdlet.GetResourceGroup(fqdnTag.Id);
                return(psFqdnTag);
            }).ToList();

            return(psAzureFirewallFqdnTags);
        }
 /// <summary>
 /// Gets all the Azure Firewall FQDN Tags in a subscription.
 /// </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 <AzureFirewallFqdnTag> ListAllNext(this IAzureFirewallFqdnTagsOperations operations, string nextPageLink)
 {
     return(operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult());
 }
        public static List <string> MapUserInputToAllowedFqdnTags(IEnumerable <string> userFqdnTags, IAzureFirewallFqdnTagsOperations azureFirewallFqdnTagClient)
        {
            if (userFqdnTags == null)
            {
                throw new ArgumentNullException("FQDN Tags List to be validated is null.", nameof(userFqdnTags));
            }

            var allowedFqdnTags = GetAzureFirewallAllowedFqdnTags(azureFirewallFqdnTagClient);

            // Accept user input case insensistive
            var userAcceptedFqdnTags = allowedFqdnTags.Aggregate(
                new Dictionary <string, string>(),
                (userAcceptedVersions, allowedFqdnTag) =>
            {
                userAcceptedVersions.Add(allowedFqdnTag.FqdnTagName.ToUpper(), allowedFqdnTag.FqdnTagName);

                return(userAcceptedVersions);
            });

            return(userFqdnTags.Select(userFqdnTag =>
            {
                var userKey = userFqdnTag.ToUpper();

                if (!userAcceptedFqdnTags.ContainsKey(userKey))
                {
                    throw new ArgumentException($"FQDN Tag {userFqdnTag} is invalid. Valid values are [{string.Join(", ", allowedFqdnTags.Select(tag => tag.FqdnTagName))}]");
                }

                return userAcceptedFqdnTags[userKey];
            }).ToList());
        }
 /// <summary>
 /// Gets all the Azure Firewall FQDN Tags in a subscription.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static IPage <AzureFirewallFqdnTag> ListAll(this IAzureFirewallFqdnTagsOperations operations)
 {
     return(operations.ListAllAsync().GetAwaiter().GetResult());
 }