Sha256: 8119baac23b7e2b793a90b1f63bf5c5b922f3b4b8b8bfb4dc01b8edb15829376

Contents?: true

Size: 897 Bytes

Versions: 9

Compression:

Stored size: 897 Bytes

Contents

# encoding: UTF-8
#
require 'chef/knife/joyent_base'

class Chef
  class Knife
    class JoyentFwGet < Knife

      include Knife::JoyentBase

      banner "knife joyent fw get <fw_id>"

      def run
        unless name_args.size === 1
          show_usage
          exit 1
        end

        id = name_args.first
        # puts id
        res = self.connection.request(
          :method => "GET",
          :path => "/my/fwrules/#{id}"
        )

        rules = [
          ui.color('ID', :bold),
          ui.color('Enabled', :bold),
          ui.color('Rule', :bold),
        ]

        if (res.status == 422)
          output_error(res)
        else
          r = res.body
          rules << r["id"]
          rules << (r["enabled"] ? ui.color("✓", :cyan) : "✗")
          rules << r["rule"]
          ui.list(rules, :uneven_columns_across, 3)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
knife-joyent-0.4.14 lib/chef/knife/joyent_fw_get.rb
knife-joyent-0.4.12 lib/chef/knife/joyent_fw_get.rb
knife-joyent-0.4.11 lib/chef/knife/joyent_fw_get.rb
knife-joyent-0.4.10 lib/chef/knife/joyent_fw_get.rb
knife-joyent-0.4.9 lib/chef/knife/joyent_fw_get.rb
knife-joyent-0.4.8 lib/chef/knife/joyent_fw_get.rb
knife-joyent-0.4.5 lib/chef/knife/joyent_fw_get.rb
knife-joyent-0.4.4 lib/chef/knife/joyent_fw_get.rb
knife-joyent-0.4.3 lib/chef/knife/joyent_fw_get.rb