List of usage examples for com.amazonaws.services.apigateway.model GetExportRequest GetExportRequest
GetExportRequest
From source file:br.com.ingenieux.mojo.apigateway.DownloadApiDefinitionMojo.java
License:Apache License
@Override protected Object executeInternal() throws Exception { this.lookupIds(); Validate.notNull(restApiId);//from w ww.ja v a2s.co m Validate.notNull(stageName); Map<String, String> parameters = new LinkedHashMap<>(); parameters.put("extensions", "integrations,authorizers,postman"); final GetExportResult swaggerApi = getService() .getExport(new GetExportRequest().withExportType("swagger").withAccepts("application/json") .withRestApiId(restApiId).withStageName(stageName).withParameters(parameters)); String content = new String(swaggerApi.getBody().array(), Charset.defaultCharset()); getLog().info("Content: " + content); if (null != outputFile) { if (!outputFile.exists()) { outputFile.getParentFile().mkdirs(); getLog().info("Writing into file " + outputFile.getPath()); IOUtils.write(content, new FileOutputStream(outputFile)); } } return null; }