Skip to content

Commit

Permalink
Update services based on v1.44.170 of AWS Go SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Dec 30, 2022
1 parent eaecd99 commit 0b4dd67
Show file tree
Hide file tree
Showing 192 changed files with 10,728 additions and 8,818 deletions.
2 changes: 1 addition & 1 deletion .latest-tag-aws-sdk-go
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.44.169
v1.44.170
88 changes: 49 additions & 39 deletions src/aws_accessanalyzer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ apply_archive_rule(Client, Input0, Options0) ->
Path = ["/archive-rule"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -125,10 +125,10 @@ cancel_policy_generation(Client, JobId, Input0, Options0) ->
Path = ["/policy/generation/", aws_util:encode_uri(JobId), ""],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -149,10 +149,10 @@ create_access_preview(Client, Input0, Options0) ->
Path = ["/access-preview"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -172,10 +172,10 @@ create_analyzer(Client, Input0, Options0) ->
Path = ["/analyzer"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -201,10 +201,10 @@ create_archive_rule(Client, AnalyzerName, Input0, Options0) ->
Path = ["/analyzer/", aws_util:encode_uri(AnalyzerName), "/archive-rule"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -229,10 +229,10 @@ delete_analyzer(Client, AnalyzerName, Input0, Options0) ->
Path = ["/analyzer/", aws_util:encode_uri(AnalyzerName), ""],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -253,10 +253,10 @@ delete_archive_rule(Client, AnalyzerName, RuleName, Input0, Options0) ->
Path = ["/analyzer/", aws_util:encode_uri(AnalyzerName), "/archive-rule/", aws_util:encode_uri(RuleName), ""],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand Down Expand Up @@ -439,10 +439,10 @@ list_access_preview_findings(Client, AccessPreviewId, Input0, Options0) ->
Path = ["/access-preview/", aws_util:encode_uri(AccessPreviewId), ""],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand Down Expand Up @@ -492,10 +492,10 @@ list_analyzed_resources(Client, Input0, Options0) ->
Path = ["/analyzed-resource"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand Down Expand Up @@ -575,10 +575,10 @@ list_findings(Client, Input0, Options0) ->
Path = ["/finding"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand Down Expand Up @@ -650,10 +650,10 @@ start_policy_generation(Client, Input0, Options0) ->
Path = ["/policy/generation"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -674,10 +674,10 @@ start_resource_scan(Client, Input0, Options0) ->
Path = ["/resource/scan"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -697,10 +697,10 @@ tag_resource(Client, ResourceArn, Input0, Options0) ->
Path = ["/tags/", aws_util:encode_uri(ResourceArn), ""],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -720,10 +720,10 @@ untag_resource(Client, ResourceArn, Input0, Options0) ->
Path = ["/tags/", aws_util:encode_uri(ResourceArn), ""],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -744,10 +744,10 @@ update_archive_rule(Client, AnalyzerName, RuleName, Input0, Options0) ->
Path = ["/analyzer/", aws_util:encode_uri(AnalyzerName), "/archive-rule/", aws_util:encode_uri(RuleName), ""],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -767,10 +767,10 @@ update_findings(Client, Input0, Options0) ->
Path = ["/finding"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -794,10 +794,10 @@ validate_policy(Client, Input0, Options0) ->
Path = ["/policy/validation"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand Down Expand Up @@ -832,25 +832,35 @@ do_request(Client, Method, Path, Query, Headers0, Input, Options, SuccessStatusC
Host = build_host(<<"access-analyzer">>, Client1),
URL0 = build_url(Host, Path, Client1),
URL = aws_request:add_query(URL0, Query),
AdditionalHeaders = [ {<<"Host">>, Host}
, {<<"Content-Type">>, <<"application/x-amz-json-1.1">>}
],
Headers1 = aws_request:add_headers(AdditionalHeaders, Headers0),

AdditionalHeaders1 = [ {<<"Host">>, Host}
, {<<"Content-Type">>, <<"application/x-amz-json-1.1">>}
],
Payload =
case proplists:get_value(send_body_as_binary, Options) of
true ->
maps:get(<<"Body">>, Input, <<"">>);
false ->
encode_payload(Input)
end,
AdditionalHeaders = case proplists:get_value(append_sha256_content_hash, Options) of
true ->
add_checksum_hash_header(AdditionalHeaders1, Payload);
false ->
AdditionalHeaders1
end,
Headers1 = aws_request:add_headers(AdditionalHeaders, Headers0),

MethodBin = aws_request:method_to_binary(Method),
SignedHeaders = aws_request:sign_request(Client1, MethodBin, URL, Headers1, Payload),
Response = hackney:request(Method, URL, SignedHeaders, Payload, Options),
DecodeBody = not proplists:get_value(receive_body_as_binary, Options),
handle_response(Response, SuccessStatusCode, DecodeBody).

add_checksum_hash_header(Headers, Body) ->
[ {<<"X-Amz-CheckSum-SHA256">>, base64:encode(crypto:hash(sha256, Body))}
| Headers
].

handle_response({ok, StatusCode, ResponseHeaders}, SuccessStatusCode, _DecodeBody)
when StatusCode =:= 200;
StatusCode =:= 202;
Expand Down
40 changes: 25 additions & 15 deletions src/aws_account.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ delete_alternate_contact(Client, Input0, Options0) ->
Path = ["/deleteAlternateContact"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand Down Expand Up @@ -72,10 +72,10 @@ get_alternate_contact(Client, Input0, Options0) ->
Path = ["/getAlternateContact"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -99,10 +99,10 @@ get_contact_information(Client, Input0, Options0) ->
Path = ["/getContactInformation"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand Down Expand Up @@ -132,10 +132,10 @@ put_alternate_contact(Client, Input0, Options0) ->
Path = ["/putAlternateContact"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand All @@ -159,10 +159,10 @@ put_contact_information(Client, Input0, Options0) ->
Path = ["/putContactInformation"],
SuccessStatusCode = 200,
Options = [{send_body_as_binary, false},
{receive_body_as_binary, false}
{receive_body_as_binary, false},
{append_sha256_content_hash, false}
| Options0],


Headers = [],
Input1 = Input0,

Expand Down Expand Up @@ -196,25 +196,35 @@ do_request(Client, Method, Path, Query, Headers0, Input, Options, SuccessStatusC
Host = build_host(<<"account">>, Client1),
URL0 = build_url(Host, Path, Client1),
URL = aws_request:add_query(URL0, Query),
AdditionalHeaders = [ {<<"Host">>, Host}
, {<<"Content-Type">>, <<"application/x-amz-json-1.1">>}
],
Headers1 = aws_request:add_headers(AdditionalHeaders, Headers0),

AdditionalHeaders1 = [ {<<"Host">>, Host}
, {<<"Content-Type">>, <<"application/x-amz-json-1.1">>}
],
Payload =
case proplists:get_value(send_body_as_binary, Options) of
true ->
maps:get(<<"Body">>, Input, <<"">>);
false ->
encode_payload(Input)
end,
AdditionalHeaders = case proplists:get_value(append_sha256_content_hash, Options) of
true ->
add_checksum_hash_header(AdditionalHeaders1, Payload);
false ->
AdditionalHeaders1
end,
Headers1 = aws_request:add_headers(AdditionalHeaders, Headers0),

MethodBin = aws_request:method_to_binary(Method),
SignedHeaders = aws_request:sign_request(Client1, MethodBin, URL, Headers1, Payload),
Response = hackney:request(Method, URL, SignedHeaders, Payload, Options),
DecodeBody = not proplists:get_value(receive_body_as_binary, Options),
handle_response(Response, SuccessStatusCode, DecodeBody).

add_checksum_hash_header(Headers, Body) ->
[ {<<"X-Amz-CheckSum-SHA256">>, base64:encode(crypto:hash(sha256, Body))}
| Headers
].

handle_response({ok, StatusCode, ResponseHeaders}, SuccessStatusCode, _DecodeBody)
when StatusCode =:= 200;
StatusCode =:= 202;
Expand Down
Loading

0 comments on commit 0b4dd67

Please sign in to comment.