Sha256: 165f3232b3b84aeb6481f991fe2b54edb2dbbfcd687ebacbcf9511461acc7453

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

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

module Contrast
  module Agent
    module Reporting
      module Settings
        # Reaction the agent should take based on a state in TS.
        class Reaction
          attr_accessor :level, :operation, :message

          # used to check the parameters and also before reactions settings update
          LEVELS = %w[ERROR WARN INFO DEBUG TRACE].cs__freeze
          OPERATIONS = %w[NOOP DISABLE].cs__freeze

          # Reaction the agent should take based on a state in TS.
          #
          # @param level [String] The level at which the agent should log this reaction[ERROR, WARN, INFO, DEBUG, TRACE]
          # @param message [String] A message to log when receiving this reaction.
          # @param operation [String] What to do in response to this reaction.[NOOP, DISABLE]
          def initialize level, operation, message
            @level = level if LEVELS.include? level
            @operation = operation if OPERATIONS.include? operation
            @message = message if message.is_a? String
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
contrast-agent-6.1.0 lib/contrast/agent/reporting/settings/reaction.rb
contrast-agent-6.0.0 lib/contrast/agent/reporting/settings/reaction.rb
contrast-agent-5.3.0 lib/contrast/agent/reporting/settings/reaction.rb
contrast-agent-5.2.0 lib/contrast/agent/reporting/settings/reaction.rb
contrast-agent-5.1.0 lib/contrast/agent/reporting/settings/reaction.rb
contrast-agent-5.0.0 lib/contrast/agent/reporting/settings/reaction.rb