Automation adds INFO.yaml
[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     private static final String DEFAULT_OUTPUT_TYPE = "P12";
30
31     private String urlToCertService;
32     private Integer requestTimeout;
33     private String certsOutputPath;
34     private String caName;
35     private String outputType;
36
37
38     public ClientConfiguration() {
39         urlToCertService = DEFAULT_REQUEST_URL;
40         requestTimeout = DEFAULT_TIMEOUT_MS;
41         outputType = DEFAULT_OUTPUT_TYPE;
42     }
43
44
45     public String getUrlToCertService() {
46         return urlToCertService;
47     }
48
49     public ClientConfiguration setUrlToCertService(String urlToCertService) {
50         this.urlToCertService = urlToCertService;
51         return this;
52     }
53
54     public Integer getRequestTimeout() {
55         return requestTimeout;
56     }
57
58     public ClientConfiguration setRequestTimeout(Integer requestTimeout) {
59         this.requestTimeout = requestTimeout;
60         return this;
61     }
62
63     public String getCertsOutputPath() {
64         return certsOutputPath;
65     }
66
67     public ClientConfiguration setCertsOutputPath(String certsOutputPath) {
68         this.certsOutputPath = certsOutputPath;
69         return this;
70     }
71
72     public String getCaName() {
73         return caName;
74     }
75
76     public ClientConfiguration setCaName(String caName) {
77         this.caName = caName;
78         return this;
79     }
80
81     public String getOutputType() {
82         return outputType;
83     }
84
85     public ClientConfiguration setOutputType(String outputType) {
86         this.outputType = outputType;
87         return this;
88     }
89
90     @Override
91     public String toString() {
92         return String.format("%s: %s, %s: %s, %s: %s, %s: %s, %s: %s",
93                 ClientConfigurationEnvs.REQUEST_URL, urlToCertService,
94                 ClientConfigurationEnvs.REQUEST_TIMEOUT, requestTimeout,
95                 ClientConfigurationEnvs.OUTPUT_PATH, certsOutputPath,
96                 ClientConfigurationEnvs.CA_NAME, caName,
97                 ClientConfigurationEnvs.OUTPUT_TYPE, outputType);
98     }
99 }