in aws-lambda-server/src/main/java/jetbrains/buildServer/runner/lambda/IamClient.kt [14:27]
fun getIamClientFromProperties(awsConnectionsManager: AwsConnectionsManager, project: SProject, properties: Map<String, String>): AmazonIdentityManagement {
try {
val credentialsData = awsConnectionsManager.getLinkedAwsConnection(properties, project)?.awsCredentialsHolder?.awsCredentials
?: throw JsonControllerException("No AWS Connection found", HttpStatus.BAD_REQUEST)
val credentialsProvider = AWSStaticCredentialsProvider(BasicAWSCredentials(credentialsData.accessKeyId, credentialsData.secretAccessKey))
return AmazonIdentityManagementClientBuilder.standard()
.withCredentials(credentialsProvider)
.build()
} catch (e: LinkedAwsConnNotFoundException) {
throw JsonControllerException(e.localizedMessage, HttpStatus.BAD_REQUEST);
}
}