[SDC-BE] Update kafka ssl config
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / be / config / DistributionEngineConfiguration.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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.openecomp.sdc.be.config;
21
22 import java.util.ArrayList;
23 import java.util.HashSet;
24 import java.util.List;
25 import java.util.Map;
26 import java.util.Set;
27 import org.onap.config.api.JettySSLUtils;
28 import org.openecomp.sdc.common.api.BasicConfiguration;
29 import org.openecomp.sdc.common.http.config.ExternalServiceConfig;
30
31 public class DistributionEngineConfiguration extends BasicConfiguration {
32
33     private List<String> uebServers;
34     private String distributionNotifTopicName;
35     private String distributionStatusTopicName;
36     private String kafkaBootStrapServers;
37     private Integer initRetryIntervalSec;
38     private Integer initMaxIntervalSec;
39     private ComponentArtifactTypesConfig distribNotifServiceArtifactTypes;
40     private ComponentArtifactTypesConfig distribNotifResourceArtifactTypes;
41     private String uebPublicKey;
42     private String uebSecretKey;
43     private List<String> environments;
44     private DistributionStatusTopicConfig distributionStatusTopic;
45     private CreateTopicConfig createTopic;
46     private boolean startDistributionEngine;
47     private DistributionNotificationTopicConfig distributionNotificationTopic;
48     private Integer defaultArtifactInstallationTimeout = 60;
49     private Integer currentArtifactInstallationTimeout = 120;
50     private boolean useHttpsWithDmaap;
51     private ExternalServiceConfig aaiConfig;
52     private ExternalServiceConfig msoConfig;
53     private Integer opEnvRecoveryIntervalSec;
54     private Integer allowedTimeBeforeStaleSec;
55
56     public List<String> getUebServers() {
57         return uebServers;
58     }
59
60     public void setUebServers(List<String> uebServers) {
61         this.uebServers = uebServers;
62     }
63
64     public String getDistributionNotifTopicName() {
65         return distributionNotifTopicName;
66     }
67
68     public void setDistributionNotifTopicName(String distributionNotifTopicName) {
69         this.distributionNotifTopicName = distributionNotifTopicName;
70     }
71
72     public String getDistributionStatusTopicName() {
73         return distributionStatusTopicName;
74     }
75
76     public void setDistributionStatusTopicName(String distributionStatusTopicName) {
77         this.distributionStatusTopicName = distributionStatusTopicName;
78     }
79
80     public String getKafkaBootStrapServers() {
81         return kafkaBootStrapServers;
82     }
83
84     public void setKafkaBootStrapServers(String kafkaBootStrapServers) {
85         this.kafkaBootStrapServers = kafkaBootStrapServers;
86     }
87
88     public Integer getInitRetryIntervalSec() {
89         return initRetryIntervalSec;
90     }
91
92     public void setInitRetryIntervalSec(Integer initRetryIntervalSec) {
93         this.initRetryIntervalSec = initRetryIntervalSec;
94     }
95
96     public ComponentArtifactTypesConfig getDistribNotifServiceArtifactTypes() {
97         return distribNotifServiceArtifactTypes;
98     }
99
100     public void setDistribNotifServiceArtifactTypes(ComponentArtifactTypesConfig distribNotifServiceArtifactTypes) {
101         this.distribNotifServiceArtifactTypes = distribNotifServiceArtifactTypes;
102     }
103
104     public ComponentArtifactTypesConfig getDistribNotifResourceArtifactTypes() {
105         return distribNotifResourceArtifactTypes;
106     }
107
108     public void setDistribNotifResourceArtifactTypes(ComponentArtifactTypesConfig distribNotifResourceArtifactTypes) {
109         this.distribNotifResourceArtifactTypes = distribNotifResourceArtifactTypes;
110     }
111
112     public String getUebPublicKey() {
113         return uebPublicKey;
114     }
115
116     public void setUebPublicKey(String uebPublicKey) {
117         this.uebPublicKey = uebPublicKey;
118     }
119
120     public String getUebSecretKey() {
121         return uebSecretKey;
122     }
123
124     public void setUebSecretKey(String uebSecretKey) {
125         this.uebSecretKey = uebSecretKey;
126     }
127
128     public List<String> getEnvironments() {
129         return environments;
130     }
131
132     public void setEnvironments(List<String> environments) {
133         Set<String> set = new HashSet<>();
134         if (environments != null) {
135             set.addAll(environments);
136             this.environments = new ArrayList<>(set);
137         } else {
138             this.environments = null;
139         }
140     }
141
142     public DistributionStatusTopicConfig getDistributionStatusTopic() {
143         return distributionStatusTopic;
144     }
145
146     public void setDistributionStatusTopic(DistributionStatusTopicConfig distributionStatusTopic) {
147         this.distributionStatusTopic = distributionStatusTopic;
148     }
149
150     public Integer getInitMaxIntervalSec() {
151         return initMaxIntervalSec;
152     }
153
154     public void setInitMaxIntervalSec(Integer initMaxIntervalSec) {
155         this.initMaxIntervalSec = initMaxIntervalSec;
156     }
157
158     public CreateTopicConfig getCreateTopic() {
159         return createTopic;
160     }
161
162     public void setCreateTopic(CreateTopicConfig createTopic) {
163         this.createTopic = createTopic;
164     }
165
166     public boolean isStartDistributionEngine() {
167         return startDistributionEngine;
168     }
169
170     public void setStartDistributionEngine(boolean startDistributionEngine) {
171         this.startDistributionEngine = startDistributionEngine;
172     }
173
174     public DistributionNotificationTopicConfig getDistributionNotificationTopic() {
175         return distributionNotificationTopic;
176     }
177
178     public void setDistributionNotificationTopic(DistributionNotificationTopicConfig distributionNotificationTopic) {
179         this.distributionNotificationTopic = distributionNotificationTopic;
180     }
181
182     public int getDefaultArtifactInstallationTimeout() {
183         return defaultArtifactInstallationTimeout;
184     }
185
186     public void setDefaultArtifactInstallationTimeout(int defaultArtifactInstallationTimeout) {
187         this.defaultArtifactInstallationTimeout = defaultArtifactInstallationTimeout;
188     }
189
190     public int getCurrentArtifactInstallationTimeout() {
191         return currentArtifactInstallationTimeout;
192     }
193
194     public void setCurrentArtifactInstallationTimeout(int currentArtifactInstallationTimeout) {
195         this.currentArtifactInstallationTimeout = currentArtifactInstallationTimeout;
196     }
197
198     public boolean isUseHttpsWithDmaap() {
199         return useHttpsWithDmaap;
200     }
201
202     public void setUseHttpsWithDmaap(boolean useHttpsWithDmaap) {
203         this.useHttpsWithDmaap = useHttpsWithDmaap;
204     }
205
206     public Integer getOpEnvRecoveryIntervalSec() {
207         return opEnvRecoveryIntervalSec;
208     }
209
210     public void setOpEnvRecoveryIntervalSec(Integer opEnvRecoveryIntervalSec) {
211         this.opEnvRecoveryIntervalSec = opEnvRecoveryIntervalSec;
212     }
213
214     public Integer getAllowedTimeBeforeStaleSec() {
215         return allowedTimeBeforeStaleSec;
216     }
217
218     public void setAllowedTimeBeforeStaleSec(Integer allowedTimeBeforeStaleSec) {
219         this.allowedTimeBeforeStaleSec = allowedTimeBeforeStaleSec;
220     }
221
222     public ExternalServiceConfig getAaiConfig() {
223         return aaiConfig;
224     }
225
226     public void setAaiConfig(ExternalServiceConfig aaiConfig) {
227         this.aaiConfig = aaiConfig;
228     }
229
230     public ExternalServiceConfig getMsoConfig() {
231         return msoConfig;
232     }
233
234     public void setMsoConfig(ExternalServiceConfig msoConfig) {
235         this.msoConfig = msoConfig;
236     }
237
238     public enum ArtifcatTypeEnum {
239         MURANO_PKG("MURANO-PKG"), HEAT("HEAT"), DG_XML("DG_XML");
240         String value;
241
242         private ArtifcatTypeEnum(String value) {
243             this.value = value;
244         }
245
246         public String getValue() {
247             return value;
248         }
249     }
250
251     public static class DistribNotifServiceArtifacts {
252
253         Map<String, Object> service;
254         Map<String, Object> resource;
255
256         public Map<String, Object> getService() {
257             return service;
258         }
259
260         public void setService(Map<String, Object> service) {
261             this.service = service;
262         }
263
264         public Map<String, Object> getResource() {
265             return resource;
266         }
267
268         public void setResource(Map<String, Object> resource) {
269             this.resource = resource;
270         }
271     }
272
273     public static class NotifArtifactTypes {
274
275         List<String> info;
276         List<String> lifecycle;
277
278         public List<String> getInfo() {
279             return info;
280         }
281
282         public void setInfo(List<String> info) {
283             this.info = info;
284         }
285
286         public List<String> getLifecycle() {
287             return lifecycle;
288         }
289
290         public void setLifecycle(List<String> lifecycle) {
291             this.lifecycle = lifecycle;
292         }
293     }
294
295     public static class NotifArtifactTypesResource {
296
297         List<ArtifcatTypeEnum> lifecycle;
298     }
299
300     public static class CreateTopicConfig {
301
302         private Integer partitionCount;
303         private Integer replicationCount;
304
305         public Integer getPartitionCount() {
306             return partitionCount;
307         }
308
309         public void setPartitionCount(Integer partitionCount) {
310             this.partitionCount = partitionCount;
311         }
312
313         public Integer getReplicationCount() {
314             return replicationCount;
315         }
316
317         public void setReplicationCount(Integer replicationCount) {
318             this.replicationCount = replicationCount;
319         }
320
321         @Override
322         public String toString() {
323             return "CreateTopicConfig [partitionCount=" + partitionCount + ", replicationCount=" + replicationCount + "]";
324         }
325     }
326
327     public static class EnvironmentConfig {
328
329         private String name;
330         private List<String> uebServers;
331
332         public String getName() {
333             return name;
334         }
335
336         public void setName(String name) {
337             this.name = name;
338         }
339
340         public List<String> getUebServers() {
341             return uebServers;
342         }
343
344         public void setUebServers(List<String> uebServers) {
345             this.uebServers = uebServers;
346         }
347
348         @Override
349         public String toString() {
350             return "EnvironmentConfig [name=" + name + ", uebServers=" + uebServers + "]";
351         }
352     }
353
354     public static class DistributionStatusTopicConfig {
355
356         private Integer pollingIntervalSec;
357         private Integer fetchTimeSec;
358         private String consumerGroup;
359         private String consumerId;
360
361         public Integer getPollingIntervalSec() {
362             return pollingIntervalSec;
363         }
364
365         public void setPollingIntervalSec(Integer pollingIntervalSec) {
366             this.pollingIntervalSec = pollingIntervalSec;
367         }
368
369         public Integer getFetchTimeSec() {
370             return fetchTimeSec;
371         }
372
373         public void setFetchTimeSec(Integer fetchTimeSec) {
374             this.fetchTimeSec = fetchTimeSec;
375         }
376
377         public String getConsumerGroup() {
378             return consumerGroup;
379         }
380
381         public void setConsumerGroup(String consumerGroup) {
382             this.consumerGroup = consumerGroup;
383         }
384
385         public String getConsumerId() {
386             return consumerId;
387         }
388
389         public void setConsumerId(String consumerId) {
390             this.consumerId = consumerId;
391         }
392
393         @Override
394         public String toString() {
395             return "DistributionStatusTopicConfig [pollingIntervalSec=" + pollingIntervalSec + ", fetchTimeSec=" + fetchTimeSec + ", consumerGroup="
396                 + consumerGroup + ", consumerId=" + consumerId + "]";
397         }
398     }
399
400     public static class DistributionNotificationTopicConfig {
401
402         private Integer maxWaitingAfterSendingSeconds;
403         private Integer maxThreadPoolSize;
404         private Integer minThreadPoolSize;
405
406         public Integer getMaxWaitingAfterSendingSeconds() {
407             return maxWaitingAfterSendingSeconds;
408         }
409
410         public void setMaxWaitingAfterSendingSeconds(Integer maxWaitingAfterSendingSeconds) {
411             this.maxWaitingAfterSendingSeconds = maxWaitingAfterSendingSeconds;
412         }
413
414         public Integer getMaxThreadPoolSize() {
415             return maxThreadPoolSize;
416         }
417
418         public void setMaxThreadPoolSize(Integer maxThreadPoolSize) {
419             this.maxThreadPoolSize = maxThreadPoolSize;
420         }
421
422         public Integer getMinThreadPoolSize() {
423             return minThreadPoolSize;
424         }
425
426         public void setMinThreadPoolSize(Integer minThreadPoolSize) {
427             this.minThreadPoolSize = minThreadPoolSize;
428         }
429
430         @Override
431         public String toString() {
432             return "DistributionNotificationTopicConfig [maxWaitingAfterSendingSeconds=" + maxWaitingAfterSendingSeconds + ", maxThreadPoolSize="
433                 + maxThreadPoolSize + ", minThreadPoolSize=" + minThreadPoolSize + "]";
434         }
435     }
436
437     public static class ComponentArtifactTypesConfig {
438
439         private List<String> info;
440         private List<String> lifecycle;
441
442         public List<String> getInfo() {
443             return info;
444         }
445
446         public void setInfo(List<String> info) {
447             this.info = info;
448         }
449
450         public List<String> getLifecycle() {
451             return lifecycle;
452         }
453
454         public void setLifecycle(List<String> lifecycle) {
455             this.lifecycle = lifecycle;
456         }
457
458         @Override
459         public String toString() {
460             return "ArtifactTypesConfig [info=" + info + ", lifecycle=" + lifecycle + "]";
461         }
462     }
463
464     public JettySSLUtils.JettySslConfig getSSLConfig() {
465         return JettySSLUtils.getSSLConfig();
466     }
467 }