2  * ============LICENSE_START=======================================================
 
   3  * dcaegen2-collectors-veshv
 
   4  * ================================================================================
 
   5  * Copyright (C) 2018-2019 NOKIA
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  20 package org.onap.dcae.collectors.veshv.commandline
 
  22 import org.apache.commons.cli.Option
 
  25 enum class CommandLineOption(val option: Option, val required: Boolean = false) {
 
  26     HEALTH_CHECK_API_PORT(
 
  28             .longOpt("health-check-api-port")
 
  30             .desc("Health check rest api listen port")
 
  35             .longOpt("listen-port")
 
  43             .longOpt("config-url")
 
  45             .desc("URL of ves configuration on consul")
 
  49     CONSUL_FIRST_REQUEST_DELAY(
 
  51             .longOpt("first-request-delay")
 
  53             .desc("Delay of first request to consul in seconds")
 
  56     CONSUL_REQUEST_INTERVAL(
 
  58             .longOpt("request-interval")
 
  60             .desc("Interval of consul configuration requests in seconds")
 
  67             .desc("VesHvCollector port")
 
  75             .desc("VesHvCollector host")
 
  81             .longOpt("kafka-bootstrap-servers")
 
  83             .desc("Comma-separated Kafka bootstrap servers in <host>:<port> format")
 
  89             .longOpt("kafka-topics")
 
  91             .desc("Comma-separated Kafka topics")
 
  97             .longOpt("ssl-disable")
 
  98             .desc("Disable SSL encryption")
 
 103             .longOpt("key-store")
 
 105             .desc("Key store in PKCS12 format")
 
 110                     .longOpt("key-store-password")
 
 112                     .desc("Key store password")
 
 117             .longOpt("trust-store")
 
 119             .desc("File with trusted certificate bundle in PKCS12 format")
 
 122     TRUST_STORE_PASSWORD(
 
 124             .longOpt("trust-store-password")
 
 126             .desc("Trust store password")
 
 131             .longOpt("idle-timeout-sec")
 
 134                 """Idle timeout for remote hosts. After given time without any data exchange the
 
 135                 |connection might be closed.""".trimMargin()
 
 139     MAXIMUM_PAYLOAD_SIZE_BYTES(
 
 141             .longOpt("max-payload-size")
 
 143             .desc("Maximum supported payload size in bytes")
 
 148             .longOpt("log-level")
 
 156             .desc("If present will start in dummy mode (dummy external services)")
 
 160     fun environmentVariableName(prefix: String = DEFAULT_ENV_PREFIX): String =
 
 161         option.longOpt.toUpperCase().replace('-', '_').let { mainPart ->
 
 162             "${prefix}_${mainPart}"
 
 166         private const val DEFAULT_ENV_PREFIX = "VESHV"