in src/main/java/com/awslabs/aws/greengrass/provisioner/lambda/AwsGreengrassProvisionerLambda.java [113:138]
private void validateRequiredParameters(LambdaInput lambdaInput) {
if (lambdaInput.GroupName == null) {
throw new RuntimeException("No group name specified");
}
if (lambdaInput.CoreRoleName == null) {
throw new RuntimeException("No core role name specified");
}
if (lambdaInput.CorePolicyName == null) {
throw new RuntimeException("No core policy name specified");
}
boolean csrPresent = !Optional.ofNullable(lambdaInput.Csr).orElse("").isEmpty();
boolean certificateArnPresent = !Optional.ofNullable(lambdaInput.CertificateArn).orElse("").isEmpty();
if (csrPresent && certificateArnPresent) {
throw new RuntimeException(String.join("", "Either specify a CSR [", lambdaInput.Csr, "], a certificate ARN [", lambdaInput.CertificateArn, "], or neither. Both CSR and certificate ARN options can not be present simultaneously."));
}
if ((lambdaInput.AccessKeyId != null) && (lambdaInput.SecretAccessKey != null)) {
if (lambdaInput.SessionToken == null) {
throw new RuntimeException("No session token detected for input credentials. Only temporary credentials can be passed in to this Lambda function for security reasons. Obtain temporary credentials from STS for this user/role and try again.");
}
}
}