コード例 #1
0
        /// <summary>
        /// Deletes an existing firewall rule.
        /// </summary>
        /// <param name="client">The FirewallClient to use to delete the firewall
        /// rule.</param>
        /// <param name="firewallName">The name of the firewall the rule belongs
        /// to.</param>
        /// <param name="firewallGroupId">The ID of the firewall the rule belongs
        /// to.</param>
        /// <param name="rule">The rule to delete.</param>
        /// <param name="dryrun">Whether or not this is a dryrun. If set to true then
        /// provision commands will not be sent to the platform and instead messaging
        /// will be outputted describing what would be done.</param>
        public static void DeleteRule(
            this FirewallClient client,
            string firewallName,
            string firewallGroupId,
            FirewallRule rule,
            bool dryrun)
        {
            Console.WriteLine("Deleting existing firewall rule for {0}", firewallName);
            ConsoleX.WriteLine("port", rule.port);
            ConsoleX.WriteLine("port", rule.rulenumber);
            ConsoleX.WriteLine("port", rule.subnet);
            ConsoleX.WriteLine("port", rule.subnet_size);
            ConsoleX.WriteLine("protocol", rule.protocol);
            ConsoleX.WriteLine("source", rule.source);

            if (!dryrun)
            {
                client.DeleteFirewallRule(firewallGroupId, rule.rulenumber);
            }

            Console.WriteLine("--");
        }