use of com.amazonaws.athena.connector.integ.clients.CloudFormationClient in project aws-athena-query-federation by awslabs.
the class DocDbIntegTest method setUpTableData.
/**
* Create and invoke a special Lambda function that sets up the MongoDB table used by the integration tests.
*/
@Override
protected void setUpTableData() {
logger.info("----------------------------------------------------");
logger.info("Setting up table for DB ({}): {}", docdbDbName, docdbTableMovies);
logger.info("----------------------------------------------------");
String mongoLambdaName = "integ-mongodb-" + UUID.randomUUID();
AWSLambda lambdaClient = AWSLambdaClientBuilder.defaultClient();
CloudFormationClient cloudFormationMongoClient = new CloudFormationClient(getMongoLambdaStack(mongoLambdaName));
try {
// Create the Lambda function.
cloudFormationMongoClient.createStack();
// Invoke the Lambda function.
lambdaClient.invoke(new InvokeRequest().withFunctionName(mongoLambdaName).withInvocationType(InvocationType.RequestResponse));
} finally {
// Delete the Lambda function.
cloudFormationMongoClient.deleteStack();
lambdaClient.shutdown();
}
}
Aggregations