# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/agent/reporting/reporting_events/architecture_component' require 'contrast/agent/reporting/reporting_events/application_reporting_event' require 'contrast/agent/reporting/reporting_events/library_discovery' require 'contrast/agent/reporting/reporting_events/reporting_event' require 'contrast/agent/reporting/reporting_events/route_discovery' require 'contrast/components/logger' module Contrast module Agent module Reporting # This is the new Application Update class which will include all the needed information for the new reporting # system. Contains data used by TeamServer to render the Flow Map and SCA features. # # @attr_reader components [Array] # @attr_accessor libraries [Array] class ApplicationUpdate < Contrast::Agent::Reporting::ApplicationReportingEvent attr_reader :components attr_accessor :libraries def initialize @event_method = :PUT @event_endpoint = "#{ Contrast::API.api_url }/api/ng/update/application" @components = [] @libraries = [] super end def file_name 'update-application' 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] # @raise [ArgumentError] def to_controlled_hash validate { components: components.map(&:to_controlled_hash), libraries: libraries.map(&:to_controlled_hash), timestamp: since_last_update } end # Ensure the required fields are present. # # @raise [ArgumentError] def validate; end end end end end