Class: Knife::Clc::IpAssignment::IpAssigner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ IpAssigner

Returns a new instance of IpAssigner.



10
11
12
13
14
# File 'lib/knife-clc/ip_assignment/ip_assigner.rb', line 10

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

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/knife-clc/ip_assignment/ip_assigner.rb', line 8

def config
  @config
end

#connectionObject (readonly)

Returns the value of attribute connection.



8
9
10
# File 'lib/knife-clc/ip_assignment/ip_assigner.rb', line 8

def connection
  @connection
end

#errorsObject (readonly)

Returns the value of attribute errors.



8
9
10
# File 'lib/knife-clc/ip_assignment/ip_assigner.rb', line 8

def errors
  @errors
end

Instance Method Details

#execute(server_id) ⇒ Object

TODO: Params ordering dependency



17
18
19
# File 'lib/knife-clc/ip_assignment/ip_assigner.rb', line 17

def execute(server_id)
  connection.create_ip_address(server_id, ip_params)
end

#prepareObject



21
22
23
# File 'lib/knife-clc/ip_assignment/ip_assigner.rb', line 21

def prepare
  validator.validate
end