11defmodule AWS.CodeGen do
22 alias AWS.CodeGen.Spec
3+ @ moduledoc """
4+ AWS API Services generator.
35
6+ Generates the AWS client modules for the `aws-beam/aws-erlang` and
7+ `aws-beam/aws-elixir` projects.
8+
9+ Maintains a global `@configuration` that specifies what protocols
10+ are implemented for which target language (`:erlang` or `:elixir`).
11+
12+ The services that will be generated is discovered by finding all
13+ available specs in the provided `spec_base_path` and then checking
14+ if there is an available implementation for that protocol.
15+ """
16+
17+ # Configuration map which determines what AWS API protocols have an
18+ # implementation for what language.
419 @ configuration % {
520 :json => % {
621 :module => AWS.CodeGen.PostService ,
@@ -32,6 +47,9 @@ defmodule AWS.CodeGen do
3247 }
3348 }
3449
50+ @ doc """
51+ Entrypoint for the code generation.
52+ """
3553 def generate ( language , spec_base_path , template_base_path , output_base_path ) do
3654 endpoints_spec = get_endpoints_spec ( spec_base_path )
3755 tasks = Enum . map ( api_specs ( spec_base_path , language ) ,
@@ -43,6 +61,11 @@ defmodule AWS.CodeGen do
4361 Enum . each ( tasks , fn ( task ) -> Task . await ( task ) end )
4462 end
4563
64+ @ doc """
65+ Generate code for a specific API using `spec`.
66+
67+ Called throuhg Task.async/3.
68+ """
4669 def generate_code ( spec , language , endpoints_spec , template_base_path , output_path ) do
4770 template = @ configuration [ spec . protocol ] [ :template ] [ language ]
4871 if not is_nil ( template ) do
0 commit comments