Sha256: 01621671db9085ec74e8be2bee83a608a5c061de562f17bdf59a126b7a654d74

Contents?: true

Size: 1.72 KB

Versions: 13

Compression:

Stored size: 1.72 KB

Contents

# 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/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.root.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

13 entries across 13 versions & 1 rubygems

Version Path
contrast-agent-6.6.5 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.6.4 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.6.3 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.6.2 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.6.1 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.6.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.5.1 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.5.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.4.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.3.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.2.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.1.2 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.1.1 lib/contrast/agent/reporting/reporting_events/application_startup.rb