in src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java [293:312]
private void verifyCodeDeployApplication(AWSClients aws) throws IllegalArgumentException {
// Check that the application exists
ListApplicationsResult applications = aws.codedeploy.listApplications();
String applicationName = getApplicationNameFromEnv();
String deploymentGroupName = getDeploymentGroupNameFromEnv();
if (!applications.getApplications().contains(applicationName)) {
throw new IllegalArgumentException("Cannot find application named '" + applicationName + "'");
}
// Check that the deployment group exists
ListDeploymentGroupsResult deploymentGroups = aws.codedeploy.listDeploymentGroups(
new ListDeploymentGroupsRequest()
.withApplicationName(applicationName)
);
if (!deploymentGroups.getDeploymentGroups().contains(deploymentGroupName)) {
throw new IllegalArgumentException("Cannot find deployment group named '" + deploymentGroupName + "'");
}
}