Class: Egi::Fedcloud::Cloudhound::AppdbSite
- Inherits:
-
Object
- Object
- Egi::Fedcloud::Cloudhound::AppdbSite
- Defined in:
- lib/egi/fedcloud/cloudhound/appdb_site.rb
Instance Attribute Summary collapse
-
#gocdb_link ⇒ Object
readonly
Returns the value of attribute gocdb_link.
-
#infrastructure ⇒ Object
readonly
Returns the value of attribute infrastructure.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#services ⇒ Object
readonly
Returns the value of attribute services.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #contacts ⇒ Object
-
#initialize(element) ⇒ AppdbSite
constructor
A new instance of AppdbSite.
Constructor Details
#initialize(element) ⇒ AppdbSite
Returns a new instance of AppdbSite.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 8 def initialize(element) Egi::Fedcloud::Cloudhound::Log.debug "[#{self.class}] Initializing with #{element.inspect}" @services = self.class.extract_services(element) @gocdb_link = self.class.extract_gocdb_link(element) @name = element.name @type = @services.empty? ? 'grid' : 'cloud' @status = element.status @infrastructure = element.infrastructure end |
Instance Attribute Details
#gocdb_link ⇒ Object (readonly)
Returns the value of attribute gocdb_link.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 4 def gocdb_link @gocdb_link end |
#infrastructure ⇒ Object (readonly)
Returns the value of attribute infrastructure.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 4 def infrastructure @infrastructure end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 4 def name @name end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
5 6 7 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 5 def services @services end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 4 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 4 def type @type end |
Class Method Details
.extract_gocdb_link(element) ⇒ Object
44 45 46 47 48 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 44 def extract_gocdb_link(element) urls = (element.locate('url') || []) portals = urls.select { |url| url.text && url.type('portal') } portals.first ? portals.first.text : nil end |
.extract_services(element) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 33 def extract_services(element) services = (element.locate('service') || []) services.map do |service| srv = {} srv['type'] = service.type srv['host'] = service.host srv end end |
Instance Method Details
#contacts ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/egi/fedcloud/cloudhound/appdb_site.rb', line 20 def contacts { name: name, type: type, status: status, csirt: nil, ngi: nil } end |