Sha256: 6fd0996de3bb0a3dea1748efe351f6381cdceb0889e4b107d4132137601f6285

Contents?: true

Size: 1.66 KB

Versions: 4

Compression:

Stored size: 1.66 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/server_reporting_event'

module Contrast
  module Agent
    module Reporting
      # This class will initialize empty ServerActivity body to be send to TS. The server activity endpoint records
      # actions taken on the server or process as a whole. It currently only reports the number of times a defensive
      # action was taken and is most likely not populated by most agents. The main purpose of sending this message is
      # for its response, which contains any updated server feature settings from TeamServer. The new Server Settings
      # endpoint should let us remove this.
      class ServerActivity < Contrast::Agent::Reporting::ServerReportingEvent
        class << self
          # @param _server_activity_dtm [Contrast::Api::Dtm::ServerActivity]
          # @return [Contrast::Agent::Reporting::ServerActivity]
          def convert _server_activity_dtm
            new
          end
        end

        def initialize
          @event_method = :PUT
          @event_endpoint = "#{ Contrast::API.api_url }/api/ng/activity/server"
          super
        end

        def file_name
          'server-activity'
        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
          { lastUpdate: since_last_update }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contrast-agent-6.2.0 lib/contrast/agent/reporting/reporting_events/server_activity.rb
contrast-agent-6.1.2 lib/contrast/agent/reporting/reporting_events/server_activity.rb
contrast-agent-6.1.1 lib/contrast/agent/reporting/reporting_events/server_activity.rb
contrast-agent-6.1.0 lib/contrast/agent/reporting/reporting_events/server_activity.rb