1c1a355b9bfcd80e4b4bd72e52b57d33fcad8a07
[dcaegen2/collectors/hv-ves.git] /
1 /*
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20 package org.onap.dcae.collectors.veshv.commandline
21
22 import org.apache.commons.cli.Option
23
24
25 enum class CommandLineOption(val option: Option, val required: Boolean = false) {
26     HEALTH_CHECK_API_PORT(
27             Option.builder("H")
28                     .longOpt("health-check-api-port")
29                     .hasArg()
30                     .desc("Health check rest api listen port")
31                     .build()
32     ),
33     CONFIGURATION_FILE(
34             Option.builder("c")
35                     .longOpt("configuration-file")
36                     .hasArg()
37                     .desc("Json file containing HV-VES configuration")
38                     .build(),
39             required = true
40     ),
41     LISTEN_PORT(
42             Option.builder("p")
43                     .longOpt("listen-port")
44                     .hasArg()
45                     .desc("Listen port")
46                     .build(),
47             required = true
48     ),
49     VES_HV_PORT(
50             Option.builder("v")
51                     .longOpt("ves-port")
52                     .hasArg()
53                     .desc("VesHvCollector port")
54                     .build(),
55             required = true
56     ),
57     VES_HV_HOST(
58             Option.builder("h")
59                     .longOpt("ves-host")
60                     .hasArg()
61                     .desc("VesHvCollector host")
62                     .build(),
63             required = true
64     ),
65     KAFKA_SERVERS(
66             Option.builder("s")
67                     .longOpt("kafka-bootstrap-servers")
68                     .hasArg()
69                     .desc("Comma-separated Kafka bootstrap servers in <host>:<port> format")
70                     .build(),
71             required = true
72     ),
73     KAFKA_TOPICS(
74             Option.builder("f")
75                     .longOpt("kafka-topics")
76                     .hasArg()
77                     .desc("Comma-separated Kafka topics")
78                     .build(),
79             required = true
80     ),
81     SSL_DISABLE(
82             Option.builder("l")
83                     .longOpt("ssl-disable")
84                     .desc("Disable SSL encryption")
85                     .build()
86     ),
87     KEY_STORE_FILE(
88             Option.builder("k")
89                     .longOpt("key-store")
90                     .hasArg()
91                     .desc("Key store in PKCS12 format")
92                     .build()
93     ),
94     KEY_STORE_PASSWORD(
95             Option.builder("kp")
96                     .longOpt("key-store-password")
97                     .hasArg()
98                     .desc("Key store password")
99                     .build()
100     ),
101     TRUST_STORE_FILE(
102             Option.builder("t")
103                     .longOpt("trust-store")
104                     .hasArg()
105                     .desc("File with trusted certificate bundle in PKCS12 format")
106                     .build()
107     ),
108     TRUST_STORE_PASSWORD(
109             Option.builder("tp")
110                     .longOpt("trust-store-password")
111                     .hasArg()
112                     .desc("Trust store password")
113                     .build()
114     ),
115     MAXIMUM_PAYLOAD_SIZE_BYTES(
116             Option.builder("m")
117                     .longOpt("max-payload-size")
118                     .hasArg()
119                     .desc("Maximum supported payload size in bytes")
120                     .build()
121     );
122
123     fun environmentVariableName(prefix: String = DEFAULT_ENV_PREFIX): String =
124             option.longOpt.toUpperCase().replace('-', '_').let { mainPart ->
125                 "${prefix}_${mainPart}"
126             }
127
128     companion object {
129         private const val DEFAULT_ENV_PREFIX = "VESHV"
130     }
131 }