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.



242
243
244
# File 'lib/webee.rb', line 242

def initialize(attributes)
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



240
241
242
# File 'lib/webee.rb', line 240

def attributes
  @attributes
end

Class Method Details

.create_for_host(address, use_ssl = false) ⇒ Object



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/webee.rb', line 276

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



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/webee.rb', line 254

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



250
251
252
# File 'lib/webee.rb', line 250

def rs_type
  @attributes[:rs_type]
end

#uriObject



246
247
248
# File 'lib/webee.rb', line 246

def uri
  @attributes[:uri]
end