Class: Knife::Clc::IpAssignment::ConfigOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/knife-clc/ip_assignment/config_options.rb

Class Method Summary collapse

Class Method Details

.attach(command_class) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/knife-clc/ip_assignment/config_options.rb', line 5

def self.attach(command_class)
  command_class.class_eval do
    option :clc_allowed_protocols,
      :long => '--allow PROTOCOL:FROM[-TO]',
      :description => 'Assigns public IP with permissions for specified protocol',
      :on => :head,
      :proc => ->(param) do
        Chef::Config[:knife][:clc_allowed_protocols] ||= []
        Chef::Config[:knife][:clc_allowed_protocols] << param
      end

    option :clc_sources,
      :long => '--source CIDR',
      :description => 'The source IP address range allowed to access the new public IP address',
      :on => :head,
      :proc => ->(param) do
        Chef::Config[:knife][:clc_sources] ||= []
        Chef::Config[:knife][:clc_sources] << param
      end
  end
end