Class: TopologicalInventory::Providers::Common::Operations::Source
- Inherits:
-
Object
- Object
- TopologicalInventory::Providers::Common::Operations::Source
- Includes:
- Logging
- Defined in:
- lib/topological_inventory/providers/common/operations/source.rb
Constant Summary collapse
- ERROR_MESSAGES =
{ :authentication_not_found => "Authentication not found in Sources API", :endpoint_or_application_not_found => "Endpoint or Application not found in Sources API", }.freeze
- LAST_CHECKED_AT_THRESHOLD =
5.minutes.freeze
- AUTH_NOT_NECESSARY =
"n/a".freeze
Instance Attribute Summary collapse
-
#account_number ⇒ Object
Returns the value of attribute account_number.
-
#params ⇒ Object
Returns the value of attribute params.
-
#request_context ⇒ Object
Returns the value of attribute request_context.
-
#source_id ⇒ Object
Returns the value of attribute source_id.
Instance Method Summary collapse
- #availability_check ⇒ Object
-
#initialize(params = {}, request_context = nil) ⇒ Source
constructor
A new instance of Source.
Methods included from Logging
Constructor Details
#initialize(params = {}, request_context = nil) ⇒ Source
Returns a new instance of Source.
24 25 26 27 28 29 |
# File 'lib/topological_inventory/providers/common/operations/source.rb', line 24 def initialize(params = {}, request_context = nil) self.params = params self.request_context = request_context self.source_id = params['source_id'] self.account_number = params['external_tenant'] end |
Instance Attribute Details
#account_number ⇒ Object
Returns the value of attribute account_number.
22 23 24 |
# File 'lib/topological_inventory/providers/common/operations/source.rb', line 22 def account_number @account_number end |
#params ⇒ Object
Returns the value of attribute params.
22 23 24 |
# File 'lib/topological_inventory/providers/common/operations/source.rb', line 22 def params @params end |
#request_context ⇒ Object
Returns the value of attribute request_context.
22 23 24 |
# File 'lib/topological_inventory/providers/common/operations/source.rb', line 22 def request_context @request_context end |
#source_id ⇒ Object
Returns the value of attribute source_id.
22 23 24 |
# File 'lib/topological_inventory/providers/common/operations/source.rb', line 22 def source_id @source_id end |
Instance Method Details
#availability_check ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/topological_inventory/providers/common/operations/source.rb', line 31 def availability_check return if params_missing? return if checked_recently? status, = connection_status update_source_and_subresources(status, ) logger.availability_check("Completed: Source #{source_id} is #{status}") end |