use of software.amazon.awssdk.services.greengrassv2data.model.GetDeploymentConfigurationResponse in project aws-greengrass-nucleus by aws-greengrass.
the class DeploymentDocumentDownloader method getDeploymentConfiguration.
private GetDeploymentConfigurationResponse getDeploymentConfiguration(String deploymentId) throws RetryableDeploymentDocumentDownloadException {
String thingName = Coerce.toString(deviceConfiguration.getThingName());
GetDeploymentConfigurationRequest getDeploymentConfigurationRequest = GetDeploymentConfigurationRequest.builder().deploymentId(deploymentId).coreDeviceThingName(thingName).build();
GetDeploymentConfigurationResponse deploymentConfiguration;
try {
logger.atInfo().kv("DeploymentId", deploymentId).kv("ThingName", thingName).log("Calling Greengrass cloud to get full deployment configuration.");
deploymentConfiguration = greengrassServiceClientFactory.getGreengrassV2DataClient().getDeploymentConfiguration(getDeploymentConfigurationRequest);
} catch (AwsServiceException e) {
throw new RetryableDeploymentDocumentDownloadException("Greengrass Cloud Service returned an error when getting full deployment configuration.", e);
} catch (SdkClientException e) {
throw new RetryableDeploymentDocumentDownloadException("Failed to contact Greengrass cloud or unable to parse response.", e);
}
return deploymentConfiguration;
}
use of software.amazon.awssdk.services.greengrassv2data.model.GetDeploymentConfigurationResponse in project aws-greengrass-nucleus by aws-greengrass.
the class DeploymentDocumentDownloader method downloadDeploymentDocument.
protected String downloadDeploymentDocument(String deploymentId) throws DeploymentTaskFailureException, RetryableDeploymentDocumentDownloadException {
// 1. Get url, digest, and algorithm by calling gg data plane
GetDeploymentConfigurationResponse response = getDeploymentConfiguration(deploymentId);
String preSignedUrl = response.preSignedUrl();
String algorithm = response.integrityCheck().algorithm();
String digest = response.integrityCheck().digest();
validate(preSignedUrl, algorithm, digest);
// 2. Download configuration and check integrity.
String configurationInString = downloadFromUrl(deploymentId, preSignedUrl);
checkIntegrity(algorithm, digest, configurationInString);
return configurationInString;
}
Aggregations