private void writeIntermediateModel(IntermediateModel model)
            throws IOException {
        final File modelDir = getModelDirectory(outputDirectory);
        PrintWriter writer = null;
        try {
            File outDir = new File(outputDirectory);
            if (!outDir.exists()) {
                if (!outDir.mkdirs()) {
                    throw new RuntimeException("Failed to create "
                                               + outDir.getAbsolutePath());
                }
            }

            File outputFile = new File(modelDir, fileNamePrefix + "-intermediate.json");

            if (!outputFile.exists()) {
                if (!outputFile.createNewFile()) {
                    throw new RuntimeException("Error creating file "
                                               + outputFile.getAbsolutePath());
                }
            }

            writer = new PrintWriter(outputFile, "UTF-8");
            Jackson.write(model, writer);
        } finally {
            if (writer != null) {
                writer.flush();
                writer.close();
            }
        }
    }
load ServiceModel. load code gen configuration from individual client. load Waiters. generate intermediate model. generate
code.
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/CodeGenerator.java