lib/contrast/agent/reporting/reporting_events/architecture_component.rb in contrast-agent-6.6.4 vs lib/contrast/agent/reporting/reporting_events/architecture_component.rb in contrast-agent-6.6.5

- old
+ new

@@ -18,39 +18,48 @@ # @attr_reader url [String] the url used to connect to the component. Required for reporting. # @attr_reader vendor [String] the publisher of the component, like MySQL. class ArchitectureComponent include Contrast::Components::Logger::InstanceMethods # required attributes - attr_reader :type, :url + attr_accessor :type, :url # optional attributes - attr_reader :remote_host, :remote_port, :vendor + attr_accessor :remote_host, :remote_port, :vendor # TeamServer only treats these specific values as valid for Architecture Components. It does not know how to # process a message with a different type. + AC_TYPE_DB = 'db' VALID_TYPES = %w[db ldap ws].cs__freeze + # class << self + # # Convert a DTM for SpeedRacer to an Event for TeamServer. + # # + # # @param component_dtm [Contrast::Api::Dtm::ArchitectureComponent] + # # @return [Contrast::Agent::Reporting::ArchitectureComponent] + # def convert component_dtm + # report = new + # report.attach_data(component_dtm) + # report + # end + # end + class << self - # Convert a DTM for SpeedRacer to an Event for TeamServer. - # - # @param component_dtm [Contrast::Api::Dtm::ArchitectureComponent] - # @return [Contrast::Agent::Reporting::ArchitectureComponent] - def convert component_dtm - report = new - report.attach_data(component_dtm) - report + def build_database + msg = new + msg.type = AC_TYPE_DB + msg end end - # Attach the data from the protobuf models to this reporter so that it can be sent to TeamServer directly. - # - # @param component_dtm [Contrast::Api::Dtm::ArchitectureComponent] - def attach_data component_dtm - @remote_host = component_dtm.remote_host - @remote_port = component_dtm.remote_port - @type = component_dtm.type - @url = component_dtm.url - @vendor = component_dtm.vendor - end + # # Attach the data from the protobuf models to this reporter so that it can be sent to TeamServer directly. + # # + # # @param component_dtm [Contrast::Api::Dtm::ArchitectureComponent] + # def attach_data component_dtm + # @remote_host = component_dtm.remote_host + # @remote_port = component_dtm.remote_port + # @type = component_dtm.type + # @url = component_dtm.url + # @vendor = component_dtm.vendor + # end # Convert the instance variables on the class, and other information, into the identifiers required for # TeamServer to process the JSON form of this message. # # @return [Hash]