Switch client and server to communicate over TLS
[oom/platform/cert-service.git] / certServiceClient / src / main / java / org / onap / aaf / certservice / client / configuration / model / ClientConfiguration.java
1 /*
2  * ============LICENSE_START=======================================================
3  * aaf-certservice-client
4  * ================================================================================
5  * Copyright (C) 2020 Nokia. 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
21 package org.onap.aaf.certservice.client.configuration.model;
22
23 import org.onap.aaf.certservice.client.configuration.ClientConfigurationEnvs;
24
25 public class ClientConfiguration implements ConfigurationModel {
26
27     private static final Integer DEFAULT_TIMEOUT_MS = 30000;
28     private static final String DEFAULT_REQUEST_URL = "https://aaf-cert-service:8443/v1/certificate/";
29
30     private String urlToCertService;
31     private Integer requestTimeout;
32     private String certsOutputPath;
33     private String caName;
34
35
36     public ClientConfiguration() {
37         urlToCertService = DEFAULT_REQUEST_URL;
38         requestTimeout = DEFAULT_TIMEOUT_MS;
39     }
40
41
42     public String getUrlToCertService() {
43         return urlToCertService;
44     }
45
46     public ClientConfiguration setUrlToCertService(String urlToCertService) {
47         this.urlToCertService = urlToCertService;
48         return this;
49     }
50
51     public Integer getRequestTimeout() {
52         return requestTimeout;
53     }
54
55     public ClientConfiguration setRequestTimeout(Integer requestTimeout) {
56         this.requestTimeout = requestTimeout;
57         return this;
58     }
59
60     public String getCertsOutputPath() {
61         return certsOutputPath;
62     }
63
64     public ClientConfiguration setCertsOutputPath(String certsOutputPath) {
65         this.certsOutputPath = certsOutputPath;
66         return this;
67     }
68
69     public String getCaName() {
70         return caName;
71     }
72
73     public ClientConfiguration setCaName(String caName) {
74         this.caName = caName;
75         return this;
76     }
77
78     @Override
79     public String toString() {
80         return String.format("%s: %s, %s: %s, %s: %s, %s: %s",
81                 ClientConfigurationEnvs.REQUEST_URL, urlToCertService,
82                 ClientConfigurationEnvs.REQUEST_TIMEOUT, requestTimeout,
83                 ClientConfigurationEnvs.OUTPUT_PATH, certsOutputPath,
84                 ClientConfigurationEnvs.CA_NAME, caName);
85     }
86 }