Sha256: 3d89665435adbab3a5731cb1c4f96fed4b822977c29969210837733f50256265

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 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/utils/object_share'
require 'contrast/agent/reporting/settings/virtual_patch_condition'

module Contrast
  module Agent
    module Reporting
      module Settings
        # The settings for each virtual patch in the agent.
        class VirtualPatch
          # @return [String]
          attr_reader :name
          # @return [String]
          attr_reader :key
          # @return [String]
          attr_reader :uuid

          def initialize hash
            @name = hash[:name]
            @key = hash[:key]
            @uuid = hash[:uuid]

            hash[:headers]&.each do |header_json|
              headers << Contrast::Agent::Reporting::Settings::VirtualPatchCondition.new(header_json)
            end

            hash[:parameters]&.each do |header_json|
              parameters << Contrast::Agent::Reporting::Settings::VirtualPatchCondition.new(header_json)
            end

            hash[:urls]&.each do |header_json|
              urls << Contrast::Agent::Reporting::Settings::VirtualPatchCondition.new(header_json)
            end
          end

          # @return [Array<Contrast::Agent::Reporting::Settings::VirtualPatchCondition>]
          def headers
            @_headers ||= []
          end

          # @return [Array<Contrast::Agent::Reporting::Settings::VirtualPatchCondition>]
          def parameters
            @_parameters ||= []
          end

          # @return [Array<Contrast::Agent::Reporting::Settings::VirtualPatchCondition>]
          def urls
            @_urls ||= []
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contrast-agent-6.11.0 lib/contrast/agent/reporting/settings/virtual_patch.rb
contrast-agent-6.10.0 lib/contrast/agent/reporting/settings/virtual_patch.rb