use of com.aws.greengrass.deployment.model.RunWith in project aws-greengrass-nucleus by aws-greengrass.
the class DeploymentDocumentConverter method buildDeploymentPackageConfigurations.
private static List<DeploymentPackageConfiguration> buildDeploymentPackageConfigurations(LocalOverrideRequest localOverrideRequest, Map<String, String> newRootComponents) {
Map<String, DeploymentPackageConfiguration> packageConfigurations = new HashMap<>();
if (localOverrideRequest.getConfigurationUpdate() != null) {
localOverrideRequest.getConfigurationUpdate().forEach((componentName, configUpdate) -> {
packageConfigurations.computeIfAbsent(componentName, DeploymentPackageConfiguration::new);
packageConfigurations.get(componentName).setConfigurationUpdateOperation(configUpdate);
packageConfigurations.get(componentName).setResolvedVersion(ANY_VERSION);
});
}
// Add to or update root component with version in the configuration lists
newRootComponents.forEach((rootComponentName, version) -> {
DeploymentPackageConfiguration pkg = packageConfigurations.computeIfAbsent(rootComponentName, DeploymentPackageConfiguration::new);
pkg.setResolvedVersion(version);
pkg.setRootComponent(true);
});
if (localOverrideRequest.getComponentToRunWithInfo() != null) {
localOverrideRequest.getComponentToRunWithInfo().forEach((componentName, runWithInfo) -> {
if (runWithInfo != null) {
packageConfigurations.computeIfAbsent(componentName, DeploymentPackageConfiguration::new);
RunWith runWith = RunWith.builder().posixUser(runWithInfo.getPosixUser()).windowsUser(runWithInfo.getWindowsUser()).systemResourceLimits(convertSystemResourceLimits(runWithInfo.getSystemResourceLimits())).build();
packageConfigurations.get(componentName).setRunWith(runWith);
}
});
}
return new ArrayList<>(packageConfigurations.values());
}
Aggregations