Search in sources :

Example 1 with GetDeploymentConfigurationRequest

use of software.amazon.awssdk.services.greengrassv2data.model.GetDeploymentConfigurationRequest 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;
}
Also used : RetryableDeploymentDocumentDownloadException(com.aws.greengrass.deployment.exceptions.RetryableDeploymentDocumentDownloadException) SdkClientException(software.amazon.awssdk.core.exception.SdkClientException) GetDeploymentConfigurationRequest(software.amazon.awssdk.services.greengrassv2data.model.GetDeploymentConfigurationRequest) GetDeploymentConfigurationResponse(software.amazon.awssdk.services.greengrassv2data.model.GetDeploymentConfigurationResponse) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException)

Aggregations

RetryableDeploymentDocumentDownloadException (com.aws.greengrass.deployment.exceptions.RetryableDeploymentDocumentDownloadException)1 AwsServiceException (software.amazon.awssdk.awscore.exception.AwsServiceException)1 SdkClientException (software.amazon.awssdk.core.exception.SdkClientException)1 GetDeploymentConfigurationRequest (software.amazon.awssdk.services.greengrassv2data.model.GetDeploymentConfigurationRequest)1 GetDeploymentConfigurationResponse (software.amazon.awssdk.services.greengrassv2data.model.GetDeploymentConfigurationResponse)1