Sha256: 3263ba39146ffe4c9d311104bd6dc057fcbb7c96ed8f653a53369c04151dd070
Contents?: true
Size: 1.83 KB
Versions: 4
Compression:
Stored size: 1.83 KB
Contents
module Brightbox command [:"firewall-rules"] do |cmd| cmd.desc "Update Firewall Rule" cmd.arg_name "[firewall-rule-id...]" cmd.command [:update] do |c| c.desc "Protocol - [tcp/udp/icmp/Protocol numbers]" c.flag [:p, :protocol] c.desc "Source - IPv4/IPv6 address or range (CIDR notation), 'any' for combined IPv4/IPv6 wildcard, server group identifer, server identifier." c.flag [:s, :source] c.desc "Source Port" c.flag [:t, :sport] c.desc "Destination. IPv4/IPv6 address or range (CIDR notation), 'any' for combined IPv4/IPv6 wildcard, server group identifer, server identifier." c.flag [:d, :destination] c.desc "Destination Port" c.flag [:e, :dport] c.desc "Icmp Type name" c.flag [:i, :icmptype] c.desc "Description" c.flag :description c.action do |global_options, options, args| fwr_id = args.shift raise "You must specify a valid firewall rule id as the first argument" unless fwr_id =~ /^fwr-/ firewall_rule = FirewallRule.find fwr_id raise "Could not find firewall rule with #{firewall_rule_id}" unless firewall_rule params = NilableHash.new params[:source_port] = options[:t] if options[:t] params[:source] = options[:s] if options[:s] params[:destination] = options[:d] if options[:d] params[:destination_port] = options[:e] if options[:e] params[:icmp_type_name] = options[:i] if options[:i] params[:protocol] = options[:p] if options[:p] params[:description] = options[:description] if options[:description] params.nilify_blanks info "Updating firewall rule #{firewall_rule}" firewall_rule.update(params) render_table([firewall_rule], global_options) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems