Class: WeBee::RemoteService

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ RemoteService

Returns a new instance of RemoteService.



297
298
299
# File 'lib/webee.rb', line 297

def initialize(attributes)
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



295
296
297
# File 'lib/webee.rb', line 295

def attributes
  @attributes
end

Class Method Details

.create_for_host(address, use_ssl = false) ⇒ Object



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/webee.rb', line 331

def self.create_for_host(address, use_ssl = false)
  items = []
  %w(
    STORAGE_SYSTEM_MONITOR
    VIRTUAL_FACTORY
    VIRTUAL_SYSTEM_MONITOR
    NODE_COLLECTOR
    APPLIANCE_MANAGER
    DHCP_SERVICE
    BPM_SERVICE
  ).each do |t|
    items << RemoteService.from_type(address, t, use_ssl)
  end
  items
end

.from_type(address, type, use_ssl = false) ⇒ Object



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/webee.rb', line 309

def self.from_type(address, type, use_ssl = false)
  rs_type_map = {
    'STORAGE_SYSTEM_MONITOR' => 'ssm',
    'VIRTUAL_FACTORY' => 'virtualfactory',
    'VIRTUAL_SYSTEM_MONITOR' => 'vsm',
    'NODE_COLLECTOR' => 'nodecollector',
    'APPLIANCE_MANAGER' => 'am',
  }
  case type
    when RemoteServiceType::BPM_SERVICE
      RemoteService.new :uri => "tcp://#{address}:61616", :rs_type => type
    when RemoteServiceType::DHCP_SERVICE
      RemoteService.new :uri => "omapi://#{address}:7911", :rs_type => type
    else
      if use_ssl
        RemoteService.new :uri => "https://#{address}:443", :rs_type => type
      else
        RemoteService.new :uri => "http://#{address}:80/#{rs_type_map[type]}", :rs_type => type
      end
  end
end

Instance Method Details

#rs_typeObject



305
306
307
# File 'lib/webee.rb', line 305

def rs_type
  @attributes[:rs_type]
end

#uriObject



301
302
303
# File 'lib/webee.rb', line 301

def uri
  @attributes[:uri]
end