# 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/sampling' module Contrast module Agent module Reporting # This module will hold all the settings from the TS responce module Settings # Application level settings for the Assess featureset. # Used for the FeatureSet TS response class AssessServerFeature # Indicate if the assess feature set is enabled for this server or not. # # @return enabled [Boolean] def enabled? @_enabled end # Set the enabled # # @param enabled [Boolean] # @return enabled [Boolean] def enabled= enabled @_enabled = enabled if !!enabled == enabled end # Used to control the sampling feature in the agent. # # @return [Contrast::Agent::Reporting::Settings::Sampling] def sampling @_sampling ||= Contrast::Agent::Reporting::Settings::Sampling.new({}) end # set sampling # # @param sampling [Hash] Hash of AssessSampling: { # baseline [Integer] The number of baseline requests to take before switching to sampling # for the window. # enabled [Boolean] If the sampling feature should be used or not. # frequency [Integer] The number of requests to skip before observing during the sampling # window after the baseline. # responseFrequency [Integer] # window [Integer] # } # @return [Contrast::Agent::Reporting::Settings::Sampling] def sampling= sampling @_sampling = Contrast::Agent::Reporting::Settings::Sampling.new(sampling) if sampling.is_a? Hash end # The sanitizers defined by the user for use by the agent on this server for this organization. # # @return sanitizers [Array] AssessCustomRules # Api [String], Rules [Array[RulesID]] # tags [Array[String]] # uuid [String] def sanitizers @_sanitizers ||= [] end # set sanitizer # # @param sanitizers [Array] of AssessCustomRule: { # Api [String], Rules [Array[RulesID]] # tags [Array[String]] # uuid [String] # } # @return sanitizers [Array] AssessCustomRules # Api [String], Rules [Array[RulesID]] # tags [Array[String]] # uuid [String] def sanitizers= sanitizers @_sanitizers = sanitizers if sanitizers.is_a? Array end # The validators defined by the user for use by the agent on this server for this organization. # # @return validators [Array] of AssessCustomRule: { # Api [String], Rules [Array[RulesID]] # tags [Array[String]] # uuid [String] # } def validators @_validators ||= [] end # The validators defined by the user for use by the agent on this server for this organization. # # @param validators [Array] of AssessCustomRule: { # Api [String], Rules [Array[RulesID]] # tags [Array[String]] # uuid [String] # } # @return validators [Array] of AssessCustomRule: { # Api [String], Rules [Array[RulesID]] # tags [Array[String]] # uuid [String] # } def validators= validators @_validators = validators if validators.is_a? Array end end end end end end