Merge "Added policyNodes, db, tls support"
[dcaegen2/platform.git] / mod / bpgenerator / src / main / java / org / onap / blueprintgenerator / models / dmaapbp / DmaapStreams.java
1 /**============LICENSE_START=======================================================
2  org.onap.dcae
3  ================================================================================
4  Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
5  ================================================================================
6  Licensed under the Apache License, Version 2.0 (the "License");
7  you may not use this file except in compliance with the License.
8  You may obtain a copy of the License at
9
10       http://www.apache.org/licenses/LICENSE-2.0
11  
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17  ============LICENSE_END=========================================================
18  
19  */
20
21 package org.onap.blueprintgenerator.models.dmaapbp;
22
23 import java.util.LinkedHashMap;
24 import java.util.TreeMap;
25
26 import org.onap.blueprintgenerator.models.blueprint.Appconfig;
27 import org.onap.blueprintgenerator.models.blueprint.GetInput;
28 import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
29 import org.onap.blueprintgenerator.models.componentspec.HealthCheck;
30
31 import com.fasterxml.jackson.annotation.JsonInclude;
32 import com.fasterxml.jackson.annotation.JsonInclude.Include;
33
34 import lombok.Getter;
35 import lombok.Setter;
36
37 @Getter @Setter
38 @JsonInclude(value=Include.NON_NULL)
39 public class DmaapStreams {
40
41         private String name;
42         private GetInput location;
43         private GetInput client_role;
44         private String type;
45
46         private GetInput username;
47         private GetInput password;
48         //private GetInput delivery_url;
49
50         private GetInput privileged;
51         private GetInput decompress;
52
53         private String route;
54         private String scheme;
55
56         public TreeMap<String, LinkedHashMap<String, Object>> createStreams(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String name, String type, String key, String route, char o){
57                 TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
58                 LinkedHashMap<String, Object> stringType = new LinkedHashMap();
59                 stringType.put("type", "string");
60
61                 //set the name
62                 this.setName(name);
63
64                 //set the type
65                 this.setType(type);
66
67                 //set the location
68                 GetInput location = new GetInput();
69                 location.setGet_input(key + "_" + name + "_location");
70                 retInputs.put(key + "_" + name + "_location", stringType);
71                 this.setLocation(location);
72
73                 //if its data router we need to add some more
74                 if(type.equals("data_router") || type.equals("data router")) {
75                         if(o == 's') {
76                                 //set the username
77                                 GetInput username = new GetInput();
78                                 username.setGet_input(key + "_" + name + "_username");
79                                 this.setUsername(username);
80                                 retInputs.put(key + "_" + name + "_username", stringType);
81
82                                 //set the password
83                                 GetInput password = new GetInput();
84                                 password.setGet_input(key + "_" + name + "_password");
85                                 this.setPassword(password);
86                                 retInputs.put(key + "_" + name + "_password", stringType);
87
88                                 //set privileged
89                                 GetInput priviliged = new GetInput();
90                                 priviliged.setGet_input(key + "_" + name + "_priviliged");
91                                 this.setPrivileged(priviliged);
92                                 retInputs.put(key + "_" + name + "_priviliged", stringType);
93
94                                 //set decompress
95                                 GetInput decompress = new GetInput();
96                                 decompress.setGet_input(key + "_" + name + "_decompress");
97                                 this.setDecompress(decompress);
98                                 retInputs.put(key + "_" + name + "_decompress", stringType);
99
100                                 this.setRoute(route);
101                                 this.setScheme("https");
102                         }
103
104 //                      //set the delivery url
105 //                      GetInput delivery = new GetInput();
106 //                      delivery.setGet_input(name + "_delivery_url");
107 //                      this.setDelivery_url(delivery);
108 //                      retInputs.put(name + "delivery_url", stringType);
109
110                 } else {
111                         //set the client role
112                         GetInput client = new GetInput();
113                         client.setGet_input(key + "_" + name + "_client_role");
114                         this.setClient_role(client);
115                         retInputs.put(key + "_" + name + "_client_role", stringType);
116                 }
117                 return retInputs;
118         }
119 }