Skip to content

Commit 2bc8289

Browse files
authored
Merge pull request #164 from aws-beam/update-aws_apigatewaymanagementapi
Update aws_apigatewaymanagementapi after aws-codegen#119
2 parents 36b4ea3 + ba1a0e0 commit 2bc8289

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/aws_apigatewaymanagementapi.erl

+30-30
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
%% if applicable.
1212
-module(aws_apigatewaymanagementapi).
1313

14-
-export([delete_connection/4,
15-
delete_connection/5,
16-
get_connection/3,
17-
get_connection/5,
14+
-export([delete_connection/5,
15+
delete_connection/6,
16+
get_connection/4,
1817
get_connection/6,
19-
post_to_connection/4,
20-
post_to_connection/5]).
18+
get_connection/7,
19+
post_to_connection/5,
20+
post_to_connection/6]).
2121

2222
-include_lib("hackney/include/hackney_lib.hrl").
2323

@@ -94,18 +94,18 @@
9494
%%====================================================================
9595

9696
%% @doc Delete the connection with the provided id.
97-
-spec delete_connection(aws_client:aws_client(), list() | binary(), binary() | list(), delete_connection_request()) ->
97+
-spec delete_connection(aws_client:aws_client(), list() | binary(), list() | binary(), binary() | list(), delete_connection_request()) ->
9898
{ok, undefined, tuple()} |
9999
{error, any()} |
100100
{error, delete_connection_errors(), tuple()}.
101-
delete_connection(Client, Stage, ConnectionId, Input) ->
102-
delete_connection(Client, Stage, ConnectionId, Input, []).
101+
delete_connection(Client, ApiId, Stage, ConnectionId, Input) ->
102+
delete_connection(Client, ApiId, Stage, ConnectionId, Input, []).
103103

104-
-spec delete_connection(aws_client:aws_client(), list() | binary(), binary() | list(), delete_connection_request(), proplists:proplist()) ->
104+
-spec delete_connection(aws_client:aws_client(), list() | binary(), list() | binary(), binary() | list(), delete_connection_request(), proplists:proplist()) ->
105105
{ok, undefined, tuple()} |
106106
{error, any()} |
107107
{error, delete_connection_errors(), tuple()}.
108-
delete_connection(Client, Stage, ConnectionId, Input0, Options0) ->
108+
delete_connection(Client, ApiId, Stage, ConnectionId, Input0, Options0) ->
109109
Method = delete,
110110
Path = ["/", Stage, "/@connections/", aws_util:encode_uri(ConnectionId), ""],
111111
SuccessStatusCode = 204,
@@ -125,30 +125,30 @@ delete_connection(Client, Stage, ConnectionId, Input0, Options0) ->
125125
Query_ = [],
126126
Input = Input2,
127127

128-
request(Client, Method, Path, Query_, CustomHeaders ++ Headers, Input, Options, SuccessStatusCode).
128+
request(Client#{api_id => ApiId}, Method, Path, Query_, CustomHeaders ++ Headers, Input, Options, SuccessStatusCode).
129129

130130
%% @doc Get information about the connection with the provided id.
131-
-spec get_connection(aws_client:aws_client(), list() | binary(), binary() | list()) ->
131+
-spec get_connection(aws_client:aws_client(), list() | binary(), list() | binary(), binary() | list()) ->
132132
{ok, get_connection_response(), tuple()} |
133133
{error, any()} |
134134
{error, get_connection_errors(), tuple()}.
135-
get_connection(Client, Stage, ConnectionId)
135+
get_connection(Client, ApiId, Stage, ConnectionId)
136136
when is_map(Client) ->
137-
get_connection(Client, Stage, ConnectionId, #{}, #{}).
137+
get_connection(Client, ApiId, Stage, ConnectionId, #{}, #{}).
138138

139-
-spec get_connection(aws_client:aws_client(), list() | binary(), binary() | list(), map(), map()) ->
139+
-spec get_connection(aws_client:aws_client(), list() | binary(), list() | binary(), binary() | list(), map(), map()) ->
140140
{ok, get_connection_response(), tuple()} |
141141
{error, any()} |
142142
{error, get_connection_errors(), tuple()}.
143-
get_connection(Client, Stage, ConnectionId, QueryMap, HeadersMap)
143+
get_connection(Client, ApiId, Stage, ConnectionId, QueryMap, HeadersMap)
144144
when is_map(Client), is_map(QueryMap), is_map(HeadersMap) ->
145-
get_connection(Client, Stage, ConnectionId, QueryMap, HeadersMap, []).
145+
get_connection(Client, ApiId, Stage, ConnectionId, QueryMap, HeadersMap, []).
146146

147-
-spec get_connection(aws_client:aws_client(), list() | binary(), binary() | list(), map(), map(), proplists:proplist()) ->
147+
-spec get_connection(aws_client:aws_client(), list() | binary(), list() | binary(), binary() | list(), map(), map(), proplists:proplist()) ->
148148
{ok, get_connection_response(), tuple()} |
149149
{error, any()} |
150150
{error, get_connection_errors(), tuple()}.
151-
get_connection(Client, Stage, ConnectionId, QueryMap, HeadersMap, Options0)
151+
get_connection(Client, ApiId, Stage, ConnectionId, QueryMap, HeadersMap, Options0)
152152
when is_map(Client), is_map(QueryMap), is_map(HeadersMap), is_list(Options0) ->
153153
Path = ["/", Stage, "/@connections/", aws_util:encode_uri(ConnectionId), ""],
154154
SuccessStatusCode = 200,
@@ -162,21 +162,21 @@ get_connection(Client, Stage, ConnectionId, QueryMap, HeadersMap, Options0)
162162

163163
Query_ = [],
164164

165-
request(Client, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode).
165+
request(Client#{api_id => ApiId}, get, Path, Query_, Headers, undefined, Options, SuccessStatusCode).
166166

167167
%% @doc Sends the provided data to the specified connection.
168-
-spec post_to_connection(aws_client:aws_client(), list() | binary(), binary() | list(), post_to_connection_request()) ->
168+
-spec post_to_connection(aws_client:aws_client(), list() | binary(), list() | binary(), binary() | list(), post_to_connection_request()) ->
169169
{ok, undefined, tuple()} |
170170
{error, any()} |
171171
{error, post_to_connection_errors(), tuple()}.
172-
post_to_connection(Client, Stage, ConnectionId, Input) ->
173-
post_to_connection(Client, Stage, ConnectionId, Input, []).
172+
post_to_connection(Client, ApiId, Stage, ConnectionId, Input) ->
173+
post_to_connection(Client, ApiId, Stage, ConnectionId, Input, []).
174174

175-
-spec post_to_connection(aws_client:aws_client(), list() | binary(), binary() | list(), post_to_connection_request(), proplists:proplist()) ->
175+
-spec post_to_connection(aws_client:aws_client(), list() | binary(), list() | binary(), binary() | list(), post_to_connection_request(), proplists:proplist()) ->
176176
{ok, undefined, tuple()} |
177177
{error, any()} |
178178
{error, post_to_connection_errors(), tuple()}.
179-
post_to_connection(Client, Stage, ConnectionId, Input0, Options0) ->
179+
post_to_connection(Client, ApiId, Stage, ConnectionId, Input0, Options0) ->
180180
Method = post,
181181
Path = ["/", Stage, "/@connections/", aws_util:encode_uri(ConnectionId), ""],
182182
SuccessStatusCode = 200,
@@ -196,7 +196,7 @@ post_to_connection(Client, Stage, ConnectionId, Input0, Options0) ->
196196
Query_ = [],
197197
Input = Input2,
198198

199-
request(Client, Method, Path, Query_, CustomHeaders ++ Headers, Input, Options, SuccessStatusCode).
199+
request(Client#{api_id => ApiId}, Method, Path, Query_, CustomHeaders ++ Headers, Input, Options, SuccessStatusCode).
200200

201201
%%====================================================================
202202
%% Internal functions
@@ -243,7 +243,7 @@ do_request(Client, Method, Path, Query, Headers0, Input, Options, SuccessStatusC
243243
Headers1 = aws_request:add_headers(AdditionalHeaders, Headers0),
244244

245245
MethodBin = aws_request:method_to_binary(Method),
246-
SignedHeaders = aws_request:sign_request(Client1, MethodBin, URL, Headers1, Payload),
246+
SignedHeaders = aws_request:sign_request(Client1, MethodBin, URL, Headers1, Payload, [{uri_encode_path, true}]),
247247
Response = hackney:request(Method, URL, SignedHeaders, Payload, Options),
248248
DecodeBody = not proplists:get_value(receive_body_as_binary, Options),
249249
handle_response(Response, SuccessStatusCode, DecodeBody).
@@ -305,8 +305,8 @@ build_host(_EndpointPrefix, #{region := <<"local">>, endpoint := Endpoint}) ->
305305
Endpoint;
306306
build_host(_EndpointPrefix, #{region := <<"local">>}) ->
307307
<<"localhost">>;
308-
build_host(EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
309-
aws_util:binary_join([EndpointPrefix, Region, Endpoint], <<".">>).
308+
build_host(EndpointPrefix, #{api_id := ApiId, region := Region, endpoint := Endpoint}) ->
309+
aws_util:binary_join([ApiId, EndpointPrefix, Region, Endpoint], <<".">>).
310310

311311
build_url(Host, Path0, Client) ->
312312
Proto = aws_client:proto(Client),

0 commit comments

Comments
 (0)