41451a18aa8f3f7eda79bfaa9e49fddcd2f5527d
[sdnc/apps.git] /
1 /*
2  * ============LICENSE_START===================================================
3  * Copyright (c) 2018 Amdocs
4  * ============================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * ============LICENSE_END=====================================================
17  */
18 package org.onap.sdnc.apps.pomba.servicedecomposition;
19
20 import org.onap.aai.restclient.client.RestClient;
21 import org.springframework.beans.factory.annotation.Value;
22 import org.springframework.context.annotation.Bean;
23 import org.springframework.stereotype.Component;
24
25 @Component
26 public class AAIConfiguration {
27     @Value("${aai.host}")
28     private String host;
29
30     @Value("${aai.port}")
31     private String port;
32
33     @Value("${aai.httpProtocol}")
34     private String httpProtocol;
35
36     @Value("${aai.securityProtocol}")
37     private String securityProtocol;
38
39     @Value("${aai.connectionTimeout}")
40     private Integer connectionTimeout;
41
42     @Value("${aai.readTimeout}")
43     private Integer readTimeout;
44
45     @Value("${aai.serviceInstancePath}")
46     private String serviceInstancePath;
47
48     @Value("${aai.resourceList}")
49     private String resourceList;
50
51     @Bean(name="aaiClient")
52     public RestClient restClient() {
53         return new RestClient()
54                 .validateServerHostname(false)
55                 .validateServerCertChain(false)
56                 .connectTimeoutMs(this.connectionTimeout)
57                 .readTimeoutMs(this.readTimeout);
58     }
59
60     @Bean(name="aaiBaseUrl")
61     public String getURL() {
62         return this.httpProtocol + "://" + this.host + ":" + this.port;
63     }
64
65     @Bean(name="aaiServiceInstancePath")
66     public String getServiceInstancePath() {
67         return this.serviceInstancePath;
68     }
69
70     @Bean(name="aaiResourceList")
71     public String getResourceList() {
72         return this.resourceList;
73     }
74 }