Skip to content

Commit

Permalink
Update services based on release-2024-11-13 of AWS Go SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Nov 14, 2024
1 parent 68b47ae commit 07b6b0b
Show file tree
Hide file tree
Showing 9 changed files with 375 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .latest-tag-aws-sdk-go
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release-2024-11-12
release-2024-11-13
4 changes: 4 additions & 0 deletions src/aws_accessanalyzer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
%% <<"isPublic">> => [boolean()],
%% <<"principal">> => map(),
%% <<"resource">> => [string()],
%% <<"resourceControlPolicyRestriction">> => string(),
%% <<"resourceOwnerAccount">> => [string()],
%% <<"resourceType">> => string(),
%% <<"sources">> => list(finding_source()()),
Expand Down Expand Up @@ -512,6 +513,7 @@
%% <<"isPublic">> => [boolean()],
%% <<"principal">> => map(),
%% <<"resource">> => [string()],
%% <<"resourceControlPolicyRestriction">> => string(),
%% <<"resourceOwnerAccount">> => [string()],
%% <<"resourceType">> => string(),
%% <<"sources">> => list(finding_source()()),
Expand Down Expand Up @@ -643,6 +645,7 @@
%% <<"isPublic">> => [boolean()],
%% <<"principal">> => map(),
%% <<"resource">> => [string()],
%% <<"resourceControlPolicyRestriction">> => string(),
%% <<"resourceOwnerAccount">> => [string()],
%% <<"resourceType">> => string(),
%% <<"sources">> => list(finding_source()()),
Expand Down Expand Up @@ -884,6 +887,7 @@
%% <<"condition">> => map(),
%% <<"isPublic">> => [boolean()],
%% <<"principal">> => map(),
%% <<"resourceControlPolicyRestriction">> => string(),
%% <<"sources">> => list(finding_source()())
%% }
-type external_access_details() :: #{binary() => any()}.
Expand Down
10 changes: 10 additions & 0 deletions src/aws_application_signals.erl
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@

%% Example:
%% create_service_level_objective_input() :: #{
%% <<"BurnRateConfigurations">> => list(burn_rate_configuration()()),
%% <<"Description">> => string(),
%% <<"Goal">> => goal(),
%% <<"Name">> := string(),
Expand All @@ -239,6 +240,7 @@
%% Example:
%% service_level_objective() :: #{
%% <<"Arn">> => string(),
%% <<"BurnRateConfigurations">> => list(burn_rate_configuration()()),
%% <<"CreatedTime">> => [non_neg_integer()],
%% <<"Description">> => string(),
%% <<"EvaluationType">> => list(any()),
Expand Down Expand Up @@ -389,6 +391,13 @@
-type get_service_level_objective_output() :: #{binary() => any()}.


%% Example:
%% burn_rate_configuration() :: #{
%% <<"LookBackWindowMinutes">> => integer()
%% }
-type burn_rate_configuration() :: #{binary() => any()}.


%% Example:
%% list_tags_for_resource_response() :: #{
%% <<"Tags">> => list(tag()())
Expand Down Expand Up @@ -511,6 +520,7 @@

%% Example:
%% update_service_level_objective_input() :: #{
%% <<"BurnRateConfigurations">> => list(burn_rate_configuration()()),
%% <<"Description">> => string(),
%% <<"Goal">> => goal(),
%% <<"RequestBasedSliConfig">> => request_based_service_level_indicator_config(),
Expand Down
51 changes: 51 additions & 0 deletions src/aws_b2bi.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
delete_profile/3,
delete_transformer/2,
delete_transformer/3,
generate_mapping/2,
generate_mapping/3,
get_capability/2,
get_capability/3,
get_partnership/2,
Expand Down Expand Up @@ -236,6 +238,13 @@
%% }
-type input_conversion() :: #{binary() => any()}.

%% Example:
%% generate_mapping_response() :: #{
%% <<"mappingAccuracy">> => [float()],
%% <<"mappingTemplate">> => [string()]
%% }
-type generate_mapping_response() :: #{binary() => any()}.

%% Example:
%% untag_resource_request() :: #{
%% <<"TagKeys">> := list(string()())
Expand Down Expand Up @@ -550,6 +559,14 @@
%% }
-type create_transformer_response() :: #{binary() => any()}.

%% Example:
%% generate_mapping_request() :: #{
%% <<"inputFileContent">> := string(),
%% <<"mappingType">> := list(any()),
%% <<"outputFileContent">> := string()
%% }
-type generate_mapping_request() :: #{binary() => any()}.

%% Example:
%% x12_interchange_control_headers() :: #{
%% <<"acknowledgmentRequestedCode">> => string(),
Expand Down Expand Up @@ -882,6 +899,12 @@
resource_not_found_exception() |
conflict_exception().

-type generate_mapping_errors() ::
throttling_exception() |
validation_exception() |
access_denied_exception() |
internal_server_exception().

-type get_capability_errors() ::
throttling_exception() |
validation_exception() |
Expand Down Expand Up @@ -1252,6 +1275,34 @@ delete_transformer(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DeleteTransformer">>, Input, Options).

%% @doc Takes sample input and output documents and uses Amazon Bedrock to
%% generate a mapping automatically.
%%
%% Depending on the accuracy and other factors, you can then edit the mapping
%% for your needs.
%%
%% Before you can use the AI-assisted feature for Amazon Web Services B2B
%% Data Interchange you must enable models in Amazon Bedrock. For details,
%% see AI-assisted template mapping prerequisites:
%% https://docs.aws.amazon.com/b2bi/latest/userguide/ai-assisted-mapping.html#ai-assist-prereq
%% in
%% the Amazon Web Services B2B Data Interchange User guide.
-spec generate_mapping(aws_client:aws_client(), generate_mapping_request()) ->
{ok, generate_mapping_response(), tuple()} |
{error, any()} |
{error, generate_mapping_errors(), tuple()}.
generate_mapping(Client, Input)
when is_map(Client), is_map(Input) ->
generate_mapping(Client, Input, []).

-spec generate_mapping(aws_client:aws_client(), generate_mapping_request(), proplists:proplist()) ->
{ok, generate_mapping_response(), tuple()} |
{error, any()} |
{error, generate_mapping_errors(), tuple()}.
generate_mapping(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"GenerateMapping">>, Input, Options).

%% @doc Retrieves the details for the specified capability.
%%
%% A trading capability contains the information required to transform
Expand Down
173 changes: 173 additions & 0 deletions src/aws_billing.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
%% WARNING: DO NOT EDIT, AUTO-GENERATED CODE!
%% See https://github.com/aws-beam/aws-codegen for more details.

%% @doc
%% You can use the Billing API to programatically list the billing views
%% available to you for a given time period.
%%
%% A billing view represents a set of billing data.
%%
%% The Billing API provides the following endpoint:
%%
%% `https://billing.us-east-1.api.aws'
-module(aws_billing).

-export([list_billing_views/2,
list_billing_views/3]).

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


%% Example:
%% access_denied_exception() :: #{
%% <<"message">> => string()
%% }
-type access_denied_exception() :: #{binary() => any()}.

%% Example:
%% active_time_range() :: #{
%% <<"activeAfterInclusive">> => [non_neg_integer()],
%% <<"activeBeforeInclusive">> => [non_neg_integer()]
%% }
-type active_time_range() :: #{binary() => any()}.

%% Example:
%% billing_view_list_element() :: #{
%% <<"arn">> => string(),
%% <<"billingViewType">> => list(any()),
%% <<"name">> => string(),
%% <<"ownerAccountId">> => string()
%% }
-type billing_view_list_element() :: #{binary() => any()}.

%% Example:
%% internal_server_exception() :: #{
%% <<"message">> => string()
%% }
-type internal_server_exception() :: #{binary() => any()}.

%% Example:
%% list_billing_views_request() :: #{
%% <<"activeTimeRange">> := active_time_range(),
%% <<"maxResults">> => integer(),
%% <<"nextToken">> => string()
%% }
-type list_billing_views_request() :: #{binary() => any()}.

%% Example:
%% list_billing_views_response() :: #{
%% <<"billingViews">> => list(billing_view_list_element()()),
%% <<"nextToken">> => string()
%% }
-type list_billing_views_response() :: #{binary() => any()}.

%% Example:
%% throttling_exception() :: #{
%% <<"message">> => string()
%% }
-type throttling_exception() :: #{binary() => any()}.

%% Example:
%% validation_exception() :: #{
%% <<"fieldList">> => list(validation_exception_field()()),
%% <<"message">> => string(),
%% <<"reason">> => list(any())
%% }
-type validation_exception() :: #{binary() => any()}.

%% Example:
%% validation_exception_field() :: #{
%% <<"message">> => string(),
%% <<"name">> => string()
%% }
-type validation_exception_field() :: #{binary() => any()}.

-type list_billing_views_errors() ::
validation_exception() |
throttling_exception() |
internal_server_exception() |
access_denied_exception().

%%====================================================================
%% API
%%====================================================================

%% @doc Lists the billing views available for a given time period.
%%
%% Every Amazon Web Services account has a unique `PRIMARY' billing view
%% that represents the billing data available by default. Accounts that use
%% Billing Conductor also have `BILLING_GROUP' billing views representing
%% pro forma costs associated with each created billing group.
-spec list_billing_views(aws_client:aws_client(), list_billing_views_request()) ->
{ok, list_billing_views_response(), tuple()} |
{error, any()} |
{error, list_billing_views_errors(), tuple()}.
list_billing_views(Client, Input)
when is_map(Client), is_map(Input) ->
list_billing_views(Client, Input, []).

-spec list_billing_views(aws_client:aws_client(), list_billing_views_request(), proplists:proplist()) ->
{ok, list_billing_views_response(), tuple()} |
{error, any()} |
{error, list_billing_views_errors(), tuple()}.
list_billing_views(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListBillingViews">>, Input, Options).

%%====================================================================
%% Internal functions
%%====================================================================

-spec request(aws_client:aws_client(), binary(), map(), list()) ->
{ok, Result, {integer(), list(), hackney:client()}} |
{error, Error, {integer(), list(), hackney:client()}} |
{error, term()} when
Result :: map() | undefined,
Error :: map().
request(Client, Action, Input, Options) ->
RequestFun = fun() -> do_request(Client, Action, Input, Options) end,
aws_request:request(RequestFun, Options).

do_request(Client, Action, Input0, Options) ->
Client1 = Client#{service => <<"billing">>},
Host = build_host(<<"billing">>, Client1),
URL = build_url(Host, Client1),
Headers = [
{<<"Host">>, Host},
{<<"Content-Type">>, <<"application/x-amz-json-1.0">>},
{<<"X-Amz-Target">>, <<"AWSBilling.", Action/binary>>}
],

Input = Input0,

Payload = jsx:encode(Input),
SignedHeaders = aws_request:sign_request(Client1, <<"POST">>, URL, Headers, Payload),
Response = hackney:request(post, URL, SignedHeaders, Payload, Options),
handle_response(Response).

handle_response({ok, 200, ResponseHeaders, Client}) ->
case hackney:body(Client) of
{ok, <<>>} ->
{ok, undefined, {200, ResponseHeaders, Client}};
{ok, Body} ->
Result = jsx:decode(Body),
{ok, Result, {200, ResponseHeaders, Client}}
end;
handle_response({ok, StatusCode, ResponseHeaders, Client}) ->
{ok, Body} = hackney:body(Client),
Error = jsx:decode(Body),
{error, Error, {StatusCode, ResponseHeaders, Client}};
handle_response({error, Reason}) ->
{error, Reason}.

build_host(_EndpointPrefix, #{region := <<"local">>, endpoint := Endpoint}) ->
Endpoint;
build_host(_EndpointPrefix, #{region := <<"local">>}) ->
<<"localhost">>;
build_host(EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
aws_util:binary_join([EndpointPrefix, Region, Endpoint], <<".">>).

build_url(Host, Client) ->
Proto = aws_client:proto(Client),
Port = aws_client:port(Client),
aws_util:binary_join([Proto, <<"://">>, Host, <<":">>, Port, <<"/">>], <<"">>).
Loading

0 comments on commit 07b6b0b

Please sign in to comment.