3030<% else %>
3131 Headers = [],
3232<% end %><%= if length(action.query_parameters) > 0 do %>
33- Query0 =
33+ Query0_ =
3434 [<%= for parameter <- Enum.drop(action.query_parameters, -1) do %>
3535 {<<"<%= parameter.location_name %>">>, <%= parameter.code_name %>},<% end %><%= for parameter <- Enum.slice action.query_parameters, -1..-1 do %>
3636 {<<"<%= parameter.location_name %>">>, <%= parameter.code_name %>}
3737 <% end %>],
38- Query = [H || {_, V} = H <- Query0 , V =/= undefined],
38+ Query_ = [H || {_, V} = H <- Query0_ , V =/= undefined],
3939<% else %>
40- Query = [],
40+ Query_ = [],
4141<% end %><%= if length(action.response_header_parameters) > 0 do %>
42- case request(Client, get, Path, Query , Headers, undefined, Options, SuccessStatusCode) of
42+ case request(Client, get, Path, Query_ , Headers, undefined, Options, SuccessStatusCode) of
4343 {ok, Body0, {_, ResponseHeaders, _} = Response} ->
4444 ResponseHeadersParams =
4545 [<%= for parameter <- Enum.drop action.response_header_parameters, -1 do %>
5757 Result ->
5858 Result
5959 end.<% else %>
60- request(Client, get, Path, Query , Headers, undefined, Options, SuccessStatusCode).<% end %>
60+ request(Client, get, Path, Query_ , Headers, undefined, Options, SuccessStatusCode).<% end %>
6161<% else %>
6262<%= action.function_name %>(Client<%= AWS.CodeGen.RestService.function_parameters(action) %>, Input) ->
6363 <%= action.function_name %>(Client<%= AWS.CodeGen.RestService.function_parameters(action) %>, Input, []).
7979 {<<"<%= parameter.location_name %>">>, <<"<%= parameter.name %>">>},<% end %><%= for parameter <- Enum.slice action.query_parameters, -1..-1 do %>
8080 {<<"<%= parameter.location_name %>">>, <<"<%= parameter.name %>">>}
8181 <% end %>],
82- {Query , Input} = aws_request:build_headers(QueryMapping, Input1),<% else %>
83- Query = [],
82+ {Query_ , Input} = aws_request:build_headers(QueryMapping, Input1),<% else %>
83+ Query_ = [],
8484 Input = Input1,
8585<% end %><%= if length(action.response_header_parameters) > 0 do %>
86- case request(Client, Method, Path, Query , Headers, Input, Options, SuccessStatusCode) of
86+ case request(Client, Method, Path, Query_ , Headers, Input, Options, SuccessStatusCode) of
8787 {ok, Body0, {_, ResponseHeaders, _} = Response} ->
8888 ResponseHeadersParams =
8989 [<%= for parameter <- Enum.drop action.response_header_parameters, -1 do %>
101101 Result ->
102102 Result
103103 end.<% else %>
104- request(Client, Method, Path, Query , Headers, Input, Options, SuccessStatusCode).<% end %>
104+ request(Client, Method, Path, Query_ , Headers, Input, Options, SuccessStatusCode).<% end %>
105105<% end %><% end %>
106106%%====================================================================
107107%% Internal functions
@@ -118,8 +118,8 @@ request(Client, Method, Path, Query, Headers0, Input, Options, SuccessStatusCode
118118 Client1 = Client#{service => <<"<%= context.signing_name %>">><%= if context.is_global do %>,
119119 region => <<"<%= context.credential_scope %>">><% end %>},
120120 <%= if context.endpoint_prefix == "s3-control" do %>AccountId = proplists:get_value(<<"x-amz-account-id">>, Headers0),
121- Host = get_host (AccountId, <<"<%= context.endpoint_prefix %>">>, Client1),<% else %>Host = get_host (<<"<%= context.endpoint_prefix %>">>, Client1),<% end %>
122- URL0 = get_url (Host, Path, Client1),
121+ Host = build_host (AccountId, <<"<%= context.endpoint_prefix %>">>, Client1),<% else %>Host = build_host (<<"<%= context.endpoint_prefix %>">>, Client1),<% end %>
122+ URL0 = build_url (Host, Path, Client1),
123123 URL = aws_request:add_query(URL0, Query),
124124 AdditionalHeaders = [ {<<"Host">>, Host}
125125 , {<<"Content-Type">>, <<"<%= context.content_type %>">>}
@@ -151,22 +151,22 @@ handle_response({ok, StatusCode, ResponseHeaders, Client}, _) ->
151151handle_response({error, Reason}, _) ->
152152 {error, Reason}.
153153<%= if context.endpoint_prefix == "s3-control" do %>
154- get_host (_AccountId, _EndpointPrefix, #{region := <<"local">>}) ->
154+ build_host (_AccountId, _EndpointPrefix, #{region := <<"local">>}) ->
155155 <<"localhost">>;
156- get_host (undefined, _EndpointPrefix, _Client) ->
156+ build_host (undefined, _EndpointPrefix, _Client) ->
157157 error(missing_account_id);
158- get_host (AccountId, EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
158+ build_host (AccountId, EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
159159 aws_util:binary_join([AccountId, EndpointPrefix, Region, Endpoint],
160160 <<".">>).<% else %>
161- get_host (_EndpointPrefix, #{region := <<"local">>}) ->
161+ build_host (_EndpointPrefix, #{region := <<"local">>}) ->
162162 <<"localhost">>;<%= if context.is_global do %>
163- get_host (EndpointPrefix, #{endpoint := Endpoint}) ->
163+ build_host (EndpointPrefix, #{endpoint := Endpoint}) ->
164164 aws_util:binary_join([EndpointPrefix, Endpoint], <<".">>).
165165<% else %>
166- get_host (EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
166+ build_host (EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
167167 aws_util:binary_join([EndpointPrefix, Region, Endpoint], <<".">>).
168168<% end %><% end %>
169- get_url (Host, Path0, Client) ->
169+ build_url (Host, Path0, Client) ->
170170 Proto = maps:get(proto, Client),
171171 Path = erlang:iolist_to_binary(Path0),
172172 Port = maps:get(port, Client),
0 commit comments