Class: Knife::Clc::IpAssignment::Mapper

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Mapper

Returns a new instance of Mapper.



7
8
9
# File 'lib/knife-clc/ip_assignment/mapper.rb', line 7

def initialize(params)
  @config = params.fetch(:config)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/knife-clc/ip_assignment/mapper.rb', line 5

def config
  @config
end

Instance Method Details

#prepare_ip_paramsObject



11
12
13
14
15
16
# File 'lib/knife-clc/ip_assignment/mapper.rb', line 11

def prepare_ip_params
  {
    'ports' => config[:clc_allowed_protocols],
    'sourceRestrictions' => config[:clc_sources]
  }.delete_if { |_, value| value.nil? || value.empty? }
end