/**
* Get the log of the current or last Terraform execution of a given
* subscription.
*
* @param subscription
* The related subscription.
* @return the streaming {@link Response} with output.
* @throws IOException
* When Terraform content cannot be written.
*/
@GET
@Produces(MediaType.TEXT_HTML)
@Path("{subscription:\\d+}/terraform.log")
public Response getTerraformLog(@PathParam("subscription") final int subscription) throws IOException {
final Subscription entity = subscriptionResource.checkVisibleSubscription(subscription);
final File log = toFile(entity, MAIN_LOG);
// Check there is a log file
if (log.exists()) {
final StreamingOutput so = o -> FileUtils.copyFile(toFile(entity, MAIN_LOG), o);
return Response.ok().entity(so).build();
}
// No log file for now
return Response.status(Status.NOT_FOUND).build();
}
TerraformResource.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:plugin-prov
作者:
评论列表
文章目录