1 /**============LICENSE_START=======================================================
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
10 http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.blueprintgenerator.models.blueprint;
23 import java.util.LinkedHashMap;
24 import java.util.TreeMap;
26 import com.fasterxml.jackson.annotation.JsonInclude;
28 import lombok.AllArgsConstructor;
29 import lombok.Builder;
31 import lombok.NoArgsConstructor;
34 //TODO: Auto-generated Javadoc
36 * @see java.lang.Object#toString()
41 * @see java.lang.Object#toString()
46 * Instantiates a new resource config obj.
51 * Instantiates a new resource config obj.
53 * @param limits the limits
54 * @param requests the requests
58 public class ResourceConfig {
61 private TreeMap<String, GetInput> limits;
64 private TreeMap<String, GetInput> requests;
68 * Creates the resource config.
70 * @param inps the inps
71 * @param name the name
72 * @return the tree map
74 public TreeMap<String, LinkedHashMap<String, Object>> createResourceConfig(TreeMap<String, LinkedHashMap<String, Object>> inps, String name){
75 TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
77 LinkedHashMap<String, Object> mi = new LinkedHashMap<String, Object>();
78 mi.put("type", "string");
79 mi.put("default", "128Mi");
81 LinkedHashMap<String, Object> m = new LinkedHashMap<String, Object>();
82 m.put("type", "string");
83 m.put("default", "250m");
86 if(!name.equals("")) {
91 TreeMap<String, GetInput> lim = new TreeMap<String, GetInput>();
93 GetInput cpu = new GetInput();
94 cpu.setGet_input(name + "cpu_limit");
97 GetInput memL = new GetInput();
98 memL.setGet_input(name + "memory_limit");
99 lim.put("memory", memL);
101 retInputs.put(name + "cpu_limit", m);
102 retInputs.put(name + "memory_limit", mi);
107 TreeMap<String, GetInput> req = new TreeMap<String, GetInput>();
109 GetInput cpuR = new GetInput();
110 cpuR.setGet_input(name + "cpu_request");
111 req.put("cpu", cpuR);
113 GetInput memR = new GetInput();
114 memR.setGet_input(name + "memory_request");
115 req.put("memory", memR);
117 retInputs.put(name + "cpu_request", m);
118 retInputs.put(name + "memory_request", mi);
120 this.setRequests(req);