Sha256: 56e0c84c662b0c9a71932f2b93c0c4809dde4f426e2fd8b3ff5a67651f4e3e33

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 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.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

5 entries across 5 versions & 1 rubygems

Version Path
contrast-agent-6.11.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.10.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.9.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.8.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb
contrast-agent-6.7.0 lib/contrast/agent/reporting/reporting_events/application_startup.rb