CloudformationSensorConfiguration.java

  1. /*
  2.  * Cloudformation Plugin for SonarQube
  3.  * Copyright (C) 2019 James Pether Sörling
  4.  * james@hack23.com
  5.  *
  6.  * This program is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 3 of the License, or (at your option) any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public License
  17.  * along with this program; if not, write to the Free Software Foundation,
  18.  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  19.  */
  20. package com.hack23.sonar.cloudformation;

  21. import java.util.Optional;

  22. import org.sonar.api.config.Configuration;
  23. import org.sonar.api.scanner.ScannerSide;

  24. import com.hack23.sonar.cloudformation.reports.process.CloudformationConstants;

  25. /**
  26.  * The Class CloudformationSensorConfiguration.
  27.  */
  28. @ScannerSide
  29. public final class CloudformationSensorConfiguration {

  30.     /** The configuration. */
  31.     private final Configuration configuration;

  32.     /**
  33.      * Instantiates a new cloudformation sensor configuration.
  34.      *
  35.      * @param configuration the configuration
  36.      */
  37.     public CloudformationSensorConfiguration(final Configuration configuration) {
  38.         this.configuration = configuration;
  39.     }

  40.     /**
  41.      * Gets the cfn nag report files.
  42.      *
  43.      * @return the cfn nag report files
  44.      */
  45.     public Optional<String> getCfnNagReportFiles() {
  46.         return this.configuration.get(CloudformationConstants.CFN_NAG_REPORT_FILES_PROPERTY);
  47.     }

  48.     /**
  49.      * Gets the checkov report files.
  50.      *
  51.      * @return the checkov report files
  52.      */
  53.     public Optional<String> getCheckovReportFiles() {
  54.         return this.configuration.get(CloudformationConstants.CHECKOV_REPORT_FILES_PROPERTY);
  55.     }

  56. }