Class: Nagios::Promoo::Appdb::Probes::BaseProbe
- Inherits:
-
Object
- Object
- Nagios::Promoo::Appdb::Probes::BaseProbe
- Defined in:
- lib/nagios/promoo/appdb/probes/base_probe.rb
Overview
Base probe class for all AppDB-related probes.
Direct Known Subclasses
Constant Summary collapse
- APPDB_IS_URL =
'http://is.marie.hellasgrid.gr/graphql'.freeze
- DEFAULT_HEADERS =
{ 'Content-Type' => 'application/json' }.freeze
- GQL_SIZES_BY_ENDPOINT =
%| { siteServiceTemplates( filter: { service: { endpointURL: { eq: "$$ENDPOINT$$" } } }, limit: 1000 ) { items { resourceID } } } |.freeze
- GQL_APPLIANCES_BY_ENDPOINT =
%| { siteServiceImages( filter: { imageVoVmiInstanceVO: { eq: "$$VO$$" }, service: { endpointURL: { eq: "$$ENDPOINT$$" } } }, limit: 1000 ) { items { applicationEnvironmentRepository applicationEnvironmentAppVersion } } } |.freeze
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#vo ⇒ Object
readonly
Returns the value of attribute vo.
Class Method Summary collapse
Instance Method Summary collapse
- #appliances_by_endpoint ⇒ Object
-
#initialize(options) ⇒ BaseProbe
constructor
A new instance of BaseProbe.
- #sizes_by_endpoint ⇒ Object
Constructor Details
#initialize(options) ⇒ BaseProbe
Returns a new instance of BaseProbe.
38 39 40 41 42 |
# File 'lib/nagios/promoo/appdb/probes/base_probe.rb', line 38 def initialize() @options = @endpoint = .fetch(:endpoint) @vo = .fetch(:vo, nil) end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
36 37 38 |
# File 'lib/nagios/promoo/appdb/probes/base_probe.rb', line 36 def endpoint @endpoint end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
36 37 38 |
# File 'lib/nagios/promoo/appdb/probes/base_probe.rb', line 36 def @options end |
#vo ⇒ Object (readonly)
Returns the value of attribute vo.
36 37 38 |
# File 'lib/nagios/promoo/appdb/probes/base_probe.rb', line 36 def vo @vo end |
Class Method Details
.runnable? ⇒ Boolean
10 11 12 |
# File 'lib/nagios/promoo/appdb/probes/base_probe.rb', line 10 def runnable? false end |
Instance Method Details
#appliances_by_endpoint ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/nagios/promoo/appdb/probes/base_probe.rb', line 55 def appliances_by_endpoint return @_appliances if @_appliances raise '`endpoint` and `vo` are mandatory arguments' if endpoint.blank? || vo.blank? query = GQL_APPLIANCES_BY_ENDPOINT.gsub('$$ENDPOINT$$', endpoint).gsub('$$VO$$', vo) @_appliances = make(query)['data']['siteServiceImages']['items'] raise "Could not locate appliances from endpoint #{endpoint.inspect} in AppDB" unless @_appliances @_appliances end |
#sizes_by_endpoint ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/nagios/promoo/appdb/probes/base_probe.rb', line 44 def sizes_by_endpoint return @_sizes if @_sizes raise '`endpoint` is a mandatory argument' if endpoint.blank? query = GQL_SIZES_BY_ENDPOINT.gsub('$$ENDPOINT$$', endpoint) @_sizes = make(query)['data']['siteServiceTemplates']['items'] raise "Could not locate sizes from endpoint #{endpoint.inspect} in AppDB" unless @_sizes @_sizes end |