Skip to content

Commit

Permalink
Merge pull request #170 from cheese-head/add-support-for-ec2-protocol
Browse files Browse the repository at this point in the history
adding support for the ec2 protocol
  • Loading branch information
onno-vos-dev authored Dec 15, 2023
2 parents 2ee7feb + 8b9fefb commit dd8bf8c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/aws/request.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule AWS.Request do
alias AWS.Client
alias AWS.Signature

@valid_protocols ~w(query json rest-json rest-xml)
@valid_protocols ~w(query json rest-json rest-xml ec2)

@doc """
Request an AWS Service using a POST request with a protocol.
Expand Down Expand Up @@ -32,7 +32,7 @@ defmodule AWS.Request do
end

input =
if metadata.protocol == "query" do
if metadata.protocol in ~w(query ec2) do
Map.merge(input, %{"Action" => action, "Version" => metadata.api_version})
else
input
Expand Down Expand Up @@ -267,6 +267,7 @@ defmodule AWS.Request do
when protocol in @valid_protocols and is_map(payload) do
encode_format =
case protocol do
"ec2" -> :query
"query" -> :query
"rest-xml" -> :xml
json_type when json_type in ~w(json rest-json) -> :json
Expand All @@ -278,7 +279,7 @@ defmodule AWS.Request do
defp decode!(%Client{} = client, protocol, payload) when protocol in @valid_protocols do
decode_format =
case protocol do
xml_type when xml_type in ~w(query rest-xml) -> :xml
xml_type when xml_type in ~w(query rest-xml ec2) -> :xml
json_type when json_type in ~w(json rest-json) -> :json
end

Expand Down

0 comments on commit dd8bf8c

Please sign in to comment.