module TopologicalInventory::Providers::Common::Mixins::SourcesApi

Constants

AUTH_NOT_NECESSARY

Public Instance Methods

application() click to toggle source
# File lib/topological_inventory/providers/common/mixins/sources_api.rb, line 34
def application
  @application ||= sources_api.fetch_application(source_id)
rescue => e
  metrics&.record_error(:sources_api)
  logger.error_ext(operation, "Failed to fetch Application for Source #{source_id}: #{e.message}")
  nil
end
authentication() click to toggle source
# File lib/topological_inventory/providers/common/mixins/sources_api.rb, line 22
def authentication
  @authentication ||= if endpoint.receptor_node.present?
                        AUTH_NOT_NECESSARY
                      else
                        sources_api.fetch_authentication(source_id, endpoint)
                      end
rescue => e
  metrics&.record_error(:sources_api)
  logger.error_ext(operation, "Failed to fetch Authentication for Source #{source_id}: #{e.message}")
  nil
end
endpoint() click to toggle source
# File lib/topological_inventory/providers/common/mixins/sources_api.rb, line 14
def endpoint
  @endpoint ||= sources_api.fetch_default_endpoint(source_id)
rescue => e
  metrics&.record_error(:sources_api)
  logger.error_ext(operation, "Failed to fetch Endpoint for Source #{source_id}: #{e.message}")
  nil
end
full_hostname(endpoint) click to toggle source
# File lib/topological_inventory/providers/common/mixins/sources_api.rb, line 50
def full_hostname(endpoint)
  if on_premise?
    "receptor://#{endpoint.receptor_node}"
  else
    endpoint.host.tap { |host| host << ":#{endpoint.port}" if endpoint.port }
  end
end
on_premise?() click to toggle source
# File lib/topological_inventory/providers/common/mixins/sources_api.rb, line 42
def on_premise?
  @on_premise ||= endpoint&.receptor_node.to_s.strip.present?
end
sources_api() click to toggle source
# File lib/topological_inventory/providers/common/mixins/sources_api.rb, line 10
def sources_api
  @sources_api ||= TopologicalInventory::Providers::Common::SourcesApiClient.new(identity)
end
verify_ssl_mode() click to toggle source
# File lib/topological_inventory/providers/common/mixins/sources_api.rb, line 46
def verify_ssl_mode
  endpoint&.verify_ssl ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
end