Sha256: f6546026574ba54aff73a53f754c94dce6c2de7389ba25ebb1b1d7962f5c3620

Contents?: true

Size: 752 Bytes

Versions: 4

Compression:

Stored size: 752 Bytes

Contents

module Brightbox
  command [:"firewall-rules"] do |cmd|

    cmd.default_command :list

    cmd.desc "List Firewall Rules"
    cmd.arg_name "[firewall-policy-id...]"
    cmd.command [:list] do |c|

      c.action do |global_options, options, args|
        if args.empty?
          raise "You must specify the firewall policy id as the first argument"
        end

        firewall_policy_id = args.shift
        raise "Invalid firewall policy id" unless firewall_policy_id =~ /^fwp-/

          firewall_policy = FirewallPolicy.find_or_call([firewall_policy_id]) do |id|
          raise "Couldn't find firewall policy #{id}"
        end
        render_table(FirewallRules.from_policy(firewall_policy.first), global_options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brightbox-cli-1.1.0 lib/brightbox-cli/commands/firewall-rules-list.rb
brightbox-cli-1.0.0 lib/brightbox-cli/commands/firewall-rules-list.rb
brightbox-cli-1.0.0.rc2 lib/brightbox-cli/commands/firewall-rules-list.rb
brightbox-cli-1.0.0.rc1 lib/brightbox-cli/commands/firewall-rules-list.rb