# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true module Contrast module Config # The base of the Common Configuration settings. class RootConfiguration include Contrast::Config::BaseConfiguration # @return [Contrast::Config::ApiConfiguration] attr_writer :api # @return [Contrast::Config::AgentConfiguration] attr_writer :agent # @return [Contrast::Config::ApplicationConfiguration] attr_writer :application # @return [Contrast::Config::ServerConfiguration] attr_writer :server # @return [Contrast::Config::AssessConfiguration] attr_writer :assess # @return [Contrast::Config::InventoryConfiguration] attr_writer :inventory # @return [Contrast::Config::ProtectConfiguration] attr_writer :protect # @return [Contrast::Config::ServiceConfiguration] attr_writer :service # @return [Boolean, nil] attr_accessor :enable def initialize hsh = {} raise(ArgumentError, 'Expected a hash') unless hsh.is_a?(Hash) @api = Contrast::Config::ApiConfiguration.new(hsh[:api]) @enable = hsh[:enable] @agent = Contrast::Config::AgentConfiguration.new(hsh[:agent]) @application = Contrast::Config::ApplicationConfiguration.new(hsh[:application]) @server = Contrast::Config::ServerConfiguration.new(hsh[:server]) @assess = Contrast::Config::AssessConfiguration.new(hsh[:assess]) @inventory = Contrast::Config::InventoryConfiguration.new(hsh[:inventory]) @protect = Contrast::Config::ProtectConfiguration.new(hsh[:protect]) @service = Contrast::Config::ServiceConfiguration.new(hsh[:service]) end # @return [Contrast::Config::ApiConfiguration] def api @api ||= Contrast::Config::ApiConfiguration.new end # @return [Contrast::Config::AgentConfiguration] def agent @agent ||= Contrast::Config::AgentConfiguration.new end # @return [Contrast::Config::ApplicationConfiguration] def application @application ||= Contrast::Config::ApplicationConfiguration.new end # @return [Contrast::Config::ServerConfiguration] def server @server ||= Contrast::Config::ServerConfiguration.new end # @return [Contrast::Config::AssessConfiguration] def assess @assess ||= Contrast::Config::AssessConfiguration.new end # @return [Contrast::Config::InventoryConfiguration] def inventory @inventory ||= Contrast::Config::InventoryConfiguration.new end # @return [Contrast::Config::ProtectConfiguration] def protect @protect ||= Contrast::Config::ProtectConfiguration.new end # @return [Contrast::Config::ServiceConfiguration] def service @service ||= Contrast::Config::ServiceConfiguration.new end end end end