Search in sources :

Example 1 with ComponentDeploymentSpecification

use of software.amazon.awssdk.services.greengrassv2.model.ComponentDeploymentSpecification in project aws-greengrass-nucleus by aws-greengrass.

the class BaseE2ETestCase method draftAndCreateDeployment.

@SuppressWarnings("PMD.LinguisticNaming")
protected CreateDeploymentResponse draftAndCreateDeployment(CreateDeploymentRequest createDeploymentRequest) {
    // update package name with random suffix to avoid conflict in cloud
    Map<String, ComponentDeploymentSpecification> updatedPkgMetadata = new HashMap<>();
    createDeploymentRequest.components().forEach((key, val) -> updatedPkgMetadata.put(getTestComponentNameInCloud(key), val));
    createDeploymentRequest = createDeploymentRequest.toBuilder().components(updatedPkgMetadata).build();
    // set default value
    if (createDeploymentRequest.targetArn() == null) {
        createDeploymentRequest = createDeploymentRequest.toBuilder().targetArn(thingGroupArn).build();
    }
    if (createDeploymentRequest.deploymentPolicies() == null) {
        createDeploymentRequest = createDeploymentRequest.toBuilder().deploymentPolicies(DeploymentPolicies.builder().configurationValidationPolicy(DeploymentConfigurationValidationPolicy.builder().timeoutInSeconds(120).build()).componentUpdatePolicy(DeploymentComponentUpdatePolicy.builder().action(NOTIFY_COMPONENTS).timeoutInSeconds(120).build()).failureHandlingPolicy(DO_NOTHING).build()).build();
    }
    logger.atInfo().kv("CreateDeploymentRequest", createDeploymentRequest).log();
    CreateDeploymentResponse createDeploymentResult = greengrassClient.createDeployment(createDeploymentRequest);
    logger.atInfo().kv("CreateDeploymentResult", createDeploymentResult).log();
    // Keep track of deployments to clean up
    createdDeployments.add(CancelDeploymentRequest.builder().deploymentId(createDeploymentResult.deploymentId()).build());
    return createDeploymentResult;
}
Also used : CreateDeploymentResponse(software.amazon.awssdk.services.greengrassv2.model.CreateDeploymentResponse) HashMap(java.util.HashMap) ComponentDeploymentSpecification(software.amazon.awssdk.services.greengrassv2.model.ComponentDeploymentSpecification)

Aggregations

HashMap (java.util.HashMap)1 ComponentDeploymentSpecification (software.amazon.awssdk.services.greengrassv2.model.ComponentDeploymentSpecification)1 CreateDeploymentResponse (software.amazon.awssdk.services.greengrassv2.model.CreateDeploymentResponse)1