2 * ============LICENSE_START=======================================================
3 * dcaegen2-collectors-veshv
4 * ================================================================================
5 * Copyright (C) 2018 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.utils.commandline
22 import org.apache.commons.cli.Option
25 enum class CommandLineOption(val option: Option) {
26 HEALTH_CHECK_API_PORT(Option.builder("H")
27 .longOpt("health-check-api-port")
29 .desc("Health check rest api listen port")
32 LISTEN_PORT(Option.builder("p")
33 .longOpt("listen-port")
39 CONSUL_CONFIG_URL(Option.builder("c")
40 .longOpt("config-url")
43 .desc("URL of ves configuration on consul")
46 CONSUL_FIRST_REQUEST_DELAY(Option.builder("d")
47 .longOpt("first-request-delay")
49 .desc("Delay of first request to consul in seconds")
52 CONSUL_REQUEST_INTERVAL(Option.builder("I")
53 .longOpt("request-interval")
55 .desc("Interval of consul configuration requests in seconds")
58 VES_HV_PORT(Option.builder("v")
62 .desc("VesHvCollector port")
65 VES_HV_HOST(Option.builder("h")
69 .desc("VesHvCollector host")
72 KAFKA_SERVERS(Option.builder("s")
73 .longOpt("kafka-bootstrap-servers")
76 .desc("Comma-separated Kafka bootstrap servers in <host>:<port> format")
79 KAFKA_TOPICS(Option.builder("f")
80 .longOpt("kafka-topics")
83 .desc("Comma-separated Kafka topics")
86 SSL_DISABLE(Option.builder("l")
87 .longOpt("ssl-disable")
88 .desc("Disable SSL encryption")
91 PRIVATE_KEY_FILE(Option.builder("k")
92 .longOpt("private-key-file")
94 .desc("File with private key in PEM format")
97 CERT_FILE(Option.builder("e")
100 .desc("File with certificate bundle")
103 TRUST_CERT_FILE(Option.builder("t")
104 .longOpt("trust-cert-file")
106 .desc("File with trusted certificate bundle for trusting connections")
109 IDLE_TIMEOUT_SEC(Option.builder("i")
110 .longOpt("idle-timeout-sec")
112 .desc("""Idle timeout for remote hosts. After given time without any data exchange the
113 |connection might be closed.""".trimMargin())
116 DUMMY_MODE(Option.builder("u")
118 .desc("If present will start in dummy mode (dummy external services)")
122 fun environmentVariableName(prefix: String = DEFAULT_ENV_PREFIX): String =
123 option.longOpt.toUpperCase().replace('-', '_').let { mainPart ->
124 "${prefix}_${mainPart}"
128 private const val DEFAULT_ENV_PREFIX = "VESHV"