Search in sources :

Example 1 with RunWith

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());
}
Also used : DeploymentPackageConfiguration(com.aws.greengrass.deployment.model.DeploymentPackageConfiguration) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RunWith(com.aws.greengrass.deployment.model.RunWith)

Aggregations

DeploymentPackageConfiguration (com.aws.greengrass.deployment.model.DeploymentPackageConfiguration)1 RunWith (com.aws.greengrass.deployment.model.RunWith)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1