use of com.spectralogic.ds3autogen.go.generators.client.BaseClientGenerator in project ds3_autogen by SpectraLogic.
the class GoCodeGenerator method generateClientFile.
/**
* Generates a client file for commands that have the specified {@link HttpVerb}
*/
private void generateClientFile(final ImmutableList<Ds3Request> ds3Requests, final HttpVerb httpVerb) throws IOException, TemplateException {
if (isEmpty(ds3Requests)) {
LOG.info("There were no commands with verb {} to generate the {} client file", getClientFileName(httpVerb), httpVerb.toString());
}
final Template tmpl = config.getTemplate("client/client_template.ftl");
final ClientModelGenerator<?> generator = new BaseClientGenerator();
final Client client = generator.generate(ds3Requests);
final Path path = destDir.resolve(BASE_PROJECT_PATH.resolve(Paths.get(getClientFileName(httpVerb) + ".go")));
LOG.info("Getting OutputStream for file: {}", path.toString());
try (final OutputStream outputStream = fileUtils.getOutputFile(path);
final Writer writer = new OutputStreamWriter(outputStream)) {
tmpl.process(client, writer);
}
}
Aggregations