Class: Host

Inherits:
Object
  • Object
show all
Defined in:
lib/vipruby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Host

Returns a new instance of Host.



402
403
404
# File 'lib/vipruby.rb', line 402

def initialize params = {}
  params.each { |key, value| send "#{key}=", value }
end

Instance Attribute Details

#discoverableObject

Returns the value of attribute discoverable.



400
401
402
# File 'lib/vipruby.rb', line 400

def discoverable
  @discoverable
end

#fqdnObject

Returns the value of attribute fqdn.



400
401
402
# File 'lib/vipruby.rb', line 400

def fqdn
  @fqdn
end

#initiator_nodeObject

Returns the value of attribute initiator_node.



400
401
402
# File 'lib/vipruby.rb', line 400

def initiator_node
  @initiator_node
end

#initiators_portObject

Returns the value of attribute initiators_port.



400
401
402
# File 'lib/vipruby.rb', line 400

def initiators_port
  @initiators_port
end

#ip_addressObject

Returns the value of attribute ip_address.



400
401
402
# File 'lib/vipruby.rb', line 400

def ip_address
  @ip_address
end

#nameObject

Returns the value of attribute name.



400
401
402
# File 'lib/vipruby.rb', line 400

def name
  @name
end

#protocolObject

Returns the value of attribute protocol.



400
401
402
# File 'lib/vipruby.rb', line 400

def protocol
  @protocol
end

#typeObject

Returns the value of attribute type.



400
401
402
# File 'lib/vipruby.rb', line 400

def type
  @type
end

Instance Method Details

#generate_initiators_jsonObject



415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/vipruby.rb', line 415

def generate_initiators_json
  initiator_json = []
  @initiators_port.each do |initiator|
    initiator_json <<
    {
      protocol: @protocol.upcase,
      initiator_port: initiator,
      initiator_node: @initiator_node
    }.to_json
  end
  initiator_json
end

#generate_jsonObject



406
407
408
409
410
411
412
413
# File 'lib/vipruby.rb', line 406

def generate_json
  {
    type: @type.capitalize,
    name: @name,
    host_name: @fqdn,
    discoverable: @discoverable.downcase
  }.to_json
end