Class: TopologicalInventory::Providers::Common::Operations::Source

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from Logging

#logger

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.  = params['external_tenant']
end

Instance Attribute Details

#account_numberObject

Returns the value of attribute account_number.



22
23
24
# File 'lib/topological_inventory/providers/common/operations/source.rb', line 22

def 
  @account_number
end

#paramsObject

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_contextObject

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_idObject

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_checkObject



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, error_message = connection_status

  update_source_and_subresources(status, error_message)

  logger.availability_check("Completed: Source #{source_id} is #{status}")
end