Skip to content

Commit

Permalink
hotfix: manually patch generated code for custom S3 metadata
Browse files Browse the repository at this point in the history
This is only necessary until aws-beam#201 and
aws-beam/aws-codegen#117 are merged, and a new
release of the aws-elixir library is done.
  • Loading branch information
jhosteny committed Nov 19, 2024
1 parent 367ad0c commit fc7a5b3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
32 changes: 28 additions & 4 deletions lib/aws/generated/s3.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4787,6 +4787,12 @@ defmodule AWS.S3 do
]
|> Request.build_params(input)

{custom_headers, input} =
[
{"Metadata", "x-amz-meta-"}
]
|> Request.build_params(input)

query_params = []

options =
Expand All @@ -4809,7 +4815,7 @@ defmodule AWS.S3 do

meta = metadata()

Request.request_rest(client, meta, :put, url_path, query_params, headers, input, options, 200)
Request.request_rest(client, meta, :put, url_path, query_params, custom_headers ++ headers, input, options, 200)
end

@doc """
Expand Down Expand Up @@ -5324,6 +5330,12 @@ defmodule AWS.S3 do
]
|> Request.build_params(input)

{custom_headers, input} =
[
{"Metadata", "x-amz-meta-"}
]
|> Request.build_params(input)

query_params = []

options =
Expand Down Expand Up @@ -5352,7 +5364,7 @@ defmodule AWS.S3 do
:post,
url_path,
query_params,
headers,
custom_headers ++ headers,
input,
options,
200
Expand Down Expand Up @@ -13299,6 +13311,12 @@ defmodule AWS.S3 do
]
|> Request.build_params(input)

{custom_headers, input} =
[
{"Metadata", "x-amz-meta-"}
]
|> Request.build_params(input)

query_params = []

options =
Expand Down Expand Up @@ -13332,7 +13350,7 @@ defmodule AWS.S3 do

meta = metadata()

Request.request_rest(client, meta, :put, url_path, query_params, headers, input, options, 200)
Request.request_rest(client, meta, :put, url_path, query_params, custom_headers ++ headers, input, options, 200)
end

@doc """
Expand Down Expand Up @@ -14966,6 +14984,12 @@ defmodule AWS.S3 do
]
|> Request.build_params(input)

{custom_headers, input} =
[
{"Metadata", "x-amz-meta-"}
]
|> Request.build_params(input)

query_params = []

options =
Expand All @@ -14983,7 +15007,7 @@ defmodule AWS.S3 do
:post,
url_path,
query_params,
headers,
custom_headers ++ headers,
input,
options,
200
Expand Down
9 changes: 9 additions & 0 deletions lib/aws/request.ex
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ defmodule AWS.Request do
nil ->
{headers, params}

param_value when is_map(param_value) ->
headers =
Enum.reduce(param_value, headers, fn {k, v}, headers ->
[{header_name <> k, v}] ++ headers
end)

params = Map.delete(params, param_name)
{headers, params}

param_value ->
headers = [{header_name, param_value} | headers]
params = Map.delete(params, param_name)
Expand Down

0 comments on commit fc7a5b3

Please sign in to comment.