use of com.amazonaws.athena.connector.lambda.metadata.ListSchemasResponse in project aws-athena-query-federation by awslabs.
the class MetadataHandler method doHandleRequest.
protected final void doHandleRequest(BlockAllocator allocator, ObjectMapper objectMapper, MetadataRequest req, OutputStream outputStream) throws Exception {
logger.info("doHandleRequest: request[{}]", req);
MetadataRequestType type = req.getRequestType();
switch(type) {
case LIST_SCHEMAS:
try (ListSchemasResponse response = doListSchemaNames(allocator, (ListSchemasRequest) req)) {
logger.info("doHandleRequest: response[{}]", response);
assertNotNull(response);
objectMapper.writeValue(outputStream, response);
}
return;
case LIST_TABLES:
try (ListTablesResponse response = doListTables(allocator, (ListTablesRequest) req)) {
logger.info("doHandleRequest: response[{}]", response);
assertNotNull(response);
objectMapper.writeValue(outputStream, response);
}
return;
case GET_TABLE:
try (GetTableResponse response = doGetTable(allocator, (GetTableRequest) req)) {
logger.info("doHandleRequest: response[{}]", response);
assertNotNull(response);
assertTypes(response);
objectMapper.writeValue(outputStream, response);
}
return;
case GET_TABLE_LAYOUT:
try (GetTableLayoutResponse response = doGetTableLayout(allocator, (GetTableLayoutRequest) req)) {
logger.info("doHandleRequest: response[{}]", response);
assertNotNull(response);
objectMapper.writeValue(outputStream, response);
}
return;
case GET_SPLITS:
verifier.checkBucketAuthZ(spillBucket);
try (GetSplitsResponse response = doGetSplits(allocator, (GetSplitsRequest) req)) {
logger.info("doHandleRequest: response[{}]", response);
assertNotNull(response);
objectMapper.writeValue(outputStream, response);
}
return;
default:
throw new IllegalArgumentException("Unknown request type " + type);
}
}
Aggregations