Sha256: 2b03248d5a415e3559f4b00e4d962bffffb35e40686cc284698e7c028351826d

Contents?: true

Size: 1.72 KB

Versions: 18

Compression:

Stored size: 1.72 KB

Contents

# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/agent/reporting/reporting_events/application_reporting_event'
require 'contrast/agent/reporting/reporting_events/application_startup_instrumentation'
require 'contrast/config'

module Contrast
  module Agent
    module Reporting
      # This is the new ApplicationStartup class which will include all the needed information for the new reporting
      # system to report an Application has started; creating a new one or marking an existing one as online in the
      # Contrast UI
      class ApplicationStartup < Contrast::Agent::Reporting::ApplicationReportingEvent
        def initialize
          @event_method = :PUT
          @event_endpoint = Contrast::Agent::Reporting::Endpoints::NG_ENDPOINTS[:application_create]
          super()
        end

        def file_name
          'applications-create'
        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]
        def to_controlled_hash
          app_config = ::Contrast::CONFIG.application
          {
              code: app_config.code,
              group: app_config.group,
              instrumentation: Contrast::Agent::Reporting::ApplicationStartupInstrumentation.new.to_controlled_hash,
              metadata: app_config.metadata,
              session_id: ::Contrast::CONFIG.session_id,
              session_metadata: ::Contrast::CONFIG.session_metadata,
              tags: app_config.tags
          }.compact
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
contrast-agent-7.6.1 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.6.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.5.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.4.1 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.4.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.3.2 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.3.1 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.3.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.2.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.1.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-7.0.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.15.3 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.15.2 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.15.1 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.15.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.14.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.13.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.12.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb