* * org.onap.dcae
* * ================================================================================
* * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+ * * Copyright (c) 2021 Nokia. All rights reserved.
* * ================================================================================
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
import org.onap.blueprintgenerator.model.common.ResourceConfig;
import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
-import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add ResourceConfig
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add
+ * ResourceConfig
*/
-
-
@Service("onapResourceConfigService")
public class ResourceConfigService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- //Method to create Resouce Config for properties
- public Map<String,Object> createResourceConfig(Map<String, LinkedHashMap<String, Object>> inputs, String name){
- Map<String,Object> response = new HashMap<>();
+ @Value("${resources.cpuLimit}")
+ private String defaultCpuLimit;
+
+ @Value("${resources.memoryLimit}")
+ private String defaultMemoryLimit;
+
+ /**
+ * Creates Resouce Config for properties
+ *
+ * @param inputs Inputs
+ * @param name Name
+ * @return
+ */
+ public Map<String, Object> createResourceConfig(
+ Map<String, Map<String, Object>> inputs, String name) {
+ Map<String, Object> response = new HashMap<>();
ResourceConfig resourceConfig = new ResourceConfig();
- LinkedHashMap<String, Object> memoryLimit = blueprintHelperService.createStringInput(Constants.MEMORY_LIMIT_128Mi);
+ Map<String, Object> memoryLimit =
+ blueprintHelperService.createStringInput(defaultMemoryLimit);
- LinkedHashMap<String, Object> cpuLimit = blueprintHelperService.createStringInput( Constants.CPU_LIMIT_250m);
+ Map<String, Object> cpuLimit =
+ blueprintHelperService.createStringInput(defaultCpuLimit);
name = blueprintHelperService.getNamePrefix(name);
response.put("inputs", inputs);
return response;
}
-
}