bp-gen code clone from cli repo
[dcaegen2/platform.git] / mod / bpgenerator / src / main / java / org / onap / blueprintgenerator / models / blueprint / StartInputs.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.blueprint;
22
23 import java.util.ArrayList;
24 import java.util.LinkedHashMap;
25 import java.util.TreeMap;
26
27 import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
28
29 import com.fasterxml.jackson.annotation.JsonInclude;
30 import com.fasterxml.jackson.annotation.JsonInclude.Include;
31
32 import lombok.Getter; import lombok.Setter;
33
34 @Getter @Setter
35 @JsonInclude(value=Include.NON_NULL)
36 public class StartInputs {
37         //private ArrayList<String> ports;
38         private GetInput envs;
39
40         public TreeMap<String, LinkedHashMap<String, Object>> createOnapStartInputs(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs){
41                 TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
42                 retInputs = inps;
43                 LinkedHashMap<String, Object> stringType  = new LinkedHashMap<String, Object>();
44
45 //              ArrayList<String> port = new ArrayList<String>();
46 //              String external = "";
47 //              if(cs.getAuxilary().getPorts() != null) {
48 //                      for(String s: cs.getAuxilary().getPorts()) {
49 //                              //create the ports
50 //                              String portNumber = "";
51 //                              StringBuffer buf = new StringBuffer();
52 //                              for(int i = 0; i < s.length(); i++) {
53 //                                      if(!(s.charAt(i) == ':')) {
54 //                                              buf.append(s.charAt(i));
55 //                                      }
56 //                                      else {
57 //                                              external = s.replace(buf.toString() + ":", "");
58 //                                              break;
59 //                                      }
60 //                              }
61 //                              portNumber = buf.toString();
62 //                              String p = "concat: [" + '"' + portNumber + ":" + '"' +", {get_input: external_port }]";
63 //                              port.add(p);
64 //                      }
65 //              }
66 //              this.setPorts(port);
67 //              //add the external port input
68 //              if(cs.getAuxilary().getPorts() != null) {
69 //                      stringType.put("type", "string");
70 //                      stringType.put("description", "Kubernetes node port on which collector is exposed");
71 //                      stringType.put("default", "'" + external + "'") ;
72 //                      retInputs.put("external_port", stringType);
73 //              }
74
75                 //set the envs
76                 GetInput env = new GetInput();
77                 env.setGet_input("envs");
78                 this.setEnvs(env);
79                 LinkedHashMap<String, Object> eMap = new LinkedHashMap();
80                 eMap.put("default", "{}");
81                 retInputs.put("envs", eMap);
82
83                 return retInputs;
84         }
85 }