diff --git a/src/aws_config.erl b/src/aws_config.erl
index a8a6f6f2..780eafa3 100644
--- a/src/aws_config.erl
+++ b/src/aws_config.erl
@@ -141,7 +141,7 @@ deliver_config_snapshot(Client, Input, Options)
%% it is noncompliant if any of these resources do not comply.
%%
%% If AWS Config has no current evaluation results for the rule, it returns
-%% InsufficientData
. This result might indicate one of the
+%% INSUFFICIENT_DATA
. This result might indicate one of the
%% following conditions:
- AWS Config has never invoked an evaluation
%% for the rule. To check whether it has, use the
%%
DescribeConfigRuleEvaluationStatus
action to get the
@@ -171,7 +171,7 @@ describe_compliance_by_config_rule(Client, Input, Options)
%% these rules.
%%
%% If AWS Config has no current evaluation results for the resource, it
-%% returns InsufficientData
. This result might indicate one of
+%% returns INSUFFICIENT_DATA
. This result might indicate one of
%% the following conditions about the rules that evaluate the resource:
%% - AWS Config has never invoked an evaluation for the rule. To check
%% whether it has, use the
DescribeConfigRuleEvaluationStatus
diff --git a/src/aws_gamelift.erl b/src/aws_gamelift.erl
new file mode 100644
index 00000000..d19234f8
--- /dev/null
+++ b/src/aws_gamelift.erl
@@ -0,0 +1,677 @@
+%% WARNING: DO NOT EDIT, AUTO-GENERATED CODE!
+%% See https://github.com/jkakar/aws-codegen for more details.
+
+%% @doc Amazon GameLift Service
+%%
+%% Welcome to the Amazon GameLift API Reference. Amazon GameLift is a
+%% managed Amazon Web Services (AWS) service for developers who need a
+%% scalable, server-based solution for multiplayer games. Amazon GameLift
+%% provides setup and deployment of game servers, and handles infrastructure
+%% scaling and session management. For more information about the GameLift
+%% service, including a feature overview, getting started guide, and
+%% tutorial, see the accompanying Amazon
+%% GameLift Developer Guide.
+%%
+%% This reference describes the low-level service API for GameLift. You can
+%% call this API directly or use the AWS SDK for your preferred
+%% language. The AWS SDK includes a set of high-level GameLift actions
+%% multiplayer game sessions. Alternatively, you can use the AWS command-line interface (CLI)
+%% tool, which includes commands for GameLift. For administrative actions,
+%% you can use the Amazon GameLift console.
+%%
+%% Setting Up Your Game Servers
+%%
+%% Use these administrative actions to configure GameLift to host your game
+%% servers. When configuring GameLift, you'll need to (1) configure a build
+%% for your game and provide build files, and (2) set up one or more fleets
+%% to host game sessions.
+%%
+%% - Build actions:
- Fleet
+%% actions:
- Alias actions:
+%% Managing Game and Player Sessions Through GameLift
+%%
+%% Call these actions from your game clients and/or services to create and
+%% manage multiplayer game sessions.
+%%
+%% - Game sessions
- Player sessions
- Other
+%% actions:
+-module(aws_gamelift).
+
+-export([create_alias/2,
+ create_alias/3,
+ create_build/2,
+ create_build/3,
+ create_fleet/2,
+ create_fleet/3,
+ create_game_session/2,
+ create_game_session/3,
+ create_player_session/2,
+ create_player_session/3,
+ create_player_sessions/2,
+ create_player_sessions/3,
+ delete_alias/2,
+ delete_alias/3,
+ delete_build/2,
+ delete_build/3,
+ delete_fleet/2,
+ delete_fleet/3,
+ describe_alias/2,
+ describe_alias/3,
+ describe_build/2,
+ describe_build/3,
+ describe_e_c2_instance_limits/2,
+ describe_e_c2_instance_limits/3,
+ describe_fleet_attributes/2,
+ describe_fleet_attributes/3,
+ describe_fleet_capacity/2,
+ describe_fleet_capacity/3,
+ describe_fleet_events/2,
+ describe_fleet_events/3,
+ describe_fleet_port_settings/2,
+ describe_fleet_port_settings/3,
+ describe_fleet_utilization/2,
+ describe_fleet_utilization/3,
+ describe_game_sessions/2,
+ describe_game_sessions/3,
+ describe_player_sessions/2,
+ describe_player_sessions/3,
+ get_game_session_log_url/2,
+ get_game_session_log_url/3,
+ list_aliases/2,
+ list_aliases/3,
+ list_builds/2,
+ list_builds/3,
+ list_fleets/2,
+ list_fleets/3,
+ request_upload_credentials/2,
+ request_upload_credentials/3,
+ resolve_alias/2,
+ resolve_alias/3,
+ update_alias/2,
+ update_alias/3,
+ update_build/2,
+ update_build/3,
+ update_fleet_attributes/2,
+ update_fleet_attributes/3,
+ update_fleet_capacity/2,
+ update_fleet_capacity/3,
+ update_fleet_port_settings/2,
+ update_fleet_port_settings/3,
+ update_game_session/2,
+ update_game_session/3]).
+
+-include_lib("hackney/include/hackney_lib.hrl").
+
+%%====================================================================
+%% API
+%%====================================================================
+
+%% @doc Creates an alias for a fleet. You can use an alias to anonymize your
+%% fleet by referencing an alias instead of a specific fleet when you create
+%% game sessions. Amazon GameLift supports two types of routing strategies
+%% for aliases: simple and terminal. Use a simple alias to point to an active
+%% fleet. Use a terminal alias to display a message to incoming traffic
+%% instead of routing players to an active fleet. This option is useful when
+%% a game server is no longer supported but you want to provide better
+%% messaging than a standard 404 error.
+%%
+%% To create a fleet alias, specify an alias name, routing strategy, and
+%% optional description. If successful, a new alias record is returned,
+%% including an alias ID, which you can reference when creating a game
+%% session. To reassign the alias to another fleet ID, call
+%% UpdateAlias.
+create_alias(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_alias(Client, Input, []).
+create_alias(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateAlias">>, Input, Options).
+
+%% @doc Initializes a new build record and generates information required to
+%% upload a game build to Amazon GameLift. Once the build record has been
+%% created and is in an INITIALIZED state, you can upload your game build.
+%%
+%% To create a build, use the CLI command
+%% upload-build
, which creates a new build record and uploads
+%% the build files in one step. (See the Amazon
+%% GameLift Developer Guide for more details on the CLI and the upload
+%% process.) Call the CreateBuild
action only if you have your
+%% own Amazon Simple Storage Service (Amazon S3) client and need to manually
+%% upload your build files.
+%%
+%% To create a new build, optionally specify a build name and
+%% version. This metadata is stored with other properties in the build record
+%% and is displayed in the GameLift console (but not visible to players). If
+%% successful, this action returns the newly created build record along with
+%% an Amazon S3 storage location and AWS account credentials. Use the
+%% location and credentials to upload your game build.
+create_build(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_build(Client, Input, []).
+create_build(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateBuild">>, Input, Options).
+
+%% @doc Creates a new fleet to host game servers. A fleet consists of a set
+%% of Amazon Elastic Compute Cloud (Amazon EC2) instances of a certain type,
+%% which defines the CPU, memory, storage, and networking capacity of each
+%% host in the fleet. See Amazon EC2 Instance
+%% Types for more information. Each instance in the fleet hosts a game
+%% server created from the specified game build. Once a fleet is in an ACTIVE
+%% state, it can begin hosting game sessions.
+%%
+%% To create a new fleet, provide a name and the EC2 instance type for the
+%% new fleet, and specify the build and server launch path. Builds must be in
+%% a READY state before they can be used to build fleets. When configuring
+%% the new fleet, you can optionally (1) provide a set of launch parameters
+%% to be passed to a game server when activated; (2) limit incoming traffic
+%% to a specified range of IP addresses and port numbers; and (3) configure
+%% Amazon GameLift to store game session logs by specifying the path to the
+%% logs stored in your game server files. If the call is successful, Amazon
+%% GameLift performs the following tasks:
+%%
+%% - Creates a fleet record and sets the state to NEW.
- Sets
+%% the fleet's capacity to 1 "desired" and 1 "active" EC2 instance
+%% count.
- Creates an EC2 instance and begins the process of
+%% initializing the fleet and activating a game server on the instance.
+%% - Begins writing events to the fleet event log, which can be accessed in
+%% the GameLift console.
Once a fleet is created, use the
+%% following actions to change certain fleet properties (server launch
+%% parameters and log paths cannot be changed):
+%%
+%%
+create_fleet(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_fleet(Client, Input, []).
+create_fleet(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateFleet">>, Input, Options).
+
+%% @doc Creates a multiplayer game session for players. This action creates a
+%% game session record and assigns the new session to an instance in the
+%% specified fleet, which activates the server initialization process in your
+%% game server. A fleet must be in an ACTIVE state before a game session can
+%% be created for it.
+%%
+%% To create a game session, specify either a fleet ID or an alias ID and
+%% indicate the maximum number of players the game session allows. You can
+%% also provide a name and a set of properties for your game (optional). If
+%% successful, a GameSession object is returned containing session
+%% properties, including an IP address. By default, newly created game
+%% sessions are set to accept adding any new players to the game session. Use
+%% UpdateGameSession to change the creation policy.
+create_game_session(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_game_session(Client, Input, []).
+create_game_session(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateGameSession">>, Input, Options).
+
+%% @doc Adds a player to a game session and creates a player session record.
+%% A game session must be in an ACTIVE state, have a creation policy of
+%% ALLOW_ALL, and have an open player slot before players can be added to the
+%% session.
+%%
+%% To create a player session, specify a game session ID and player ID. If
+%% successful, the player is added to the game session and a new
+%% PlayerSession object is returned.
+create_player_session(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_player_session(Client, Input, []).
+create_player_session(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreatePlayerSession">>, Input, Options).
+
+%% @doc Adds a group of players to a game session. Similar to
+%% CreatePlayerSession, this action allows you to add multiple players
+%% in a single call, which is useful for games that provide party and/or
+%% matchmaking features. A game session must be in an ACTIVE state, have a
+%% creation policy of ALLOW_ALL, and have an open player slot before players
+%% can be added to the session.
+%%
+%% To create player sessions, specify a game session ID and a list of player
+%% IDs. If successful, the players are added to the game session and a set of
+%% new PlayerSession objects is returned.
+create_player_sessions(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_player_sessions(Client, Input, []).
+create_player_sessions(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreatePlayerSessions">>, Input, Options).
+
+%% @doc Deletes an alias. This action removes all record of the alias; game
+%% clients attempting to access a game server using the deleted alias receive
+%% an error. To delete an alias, specify the alias ID to be deleted.
+delete_alias(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_alias(Client, Input, []).
+delete_alias(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteAlias">>, Input, Options).
+
+%% @doc Deletes a build. This action permanently deletes the build record and
+%% any uploaded build files.
+%%
+%% To delete a build, specify its ID. Deleting a build does not affect the
+%% status of any active fleets, but you can no longer create new fleets for
+%% the deleted build.
+delete_build(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_build(Client, Input, []).
+delete_build(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteBuild">>, Input, Options).
+
+%% @doc Deletes everything related to a fleet. Before deleting a fleet, you
+%% must set the fleet's desired capacity to zero. See
+%% UpdateFleetCapacity.
+%%
+%% This action removes the fleet's resources and the fleet record. Once a
+%% fleet is deleted, you can no longer use that fleet.
+delete_fleet(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_fleet(Client, Input, []).
+delete_fleet(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteFleet">>, Input, Options).
+
+%% @doc Retrieves properties for a specified alias. To get the alias, specify
+%% an alias ID. If successful, an Alias object is returned.
+describe_alias(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_alias(Client, Input, []).
+describe_alias(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeAlias">>, Input, Options).
+
+%% @doc Retrieves properties for a build. To get a build record, specify a
+%% build ID. If successful, an object containing the build properties is
+%% returned.
+describe_build(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_build(Client, Input, []).
+describe_build(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeBuild">>, Input, Options).
+
+%% @doc Retrieves the maximum number of instances allowed, per AWS account,
+%% for each specified EC2 instance type. The current usage level for the AWS
+%% account is also retrieved.
+describe_e_c2_instance_limits(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_e_c2_instance_limits(Client, Input, []).
+describe_e_c2_instance_limits(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeEC2InstanceLimits">>, Input, Options).
+
+%% @doc Retrieves fleet properties, including metadata, status, and
+%% configuration, for one or more fleets. You can request attributes for all
+%% fleets, or specify a list of one or more fleet IDs. When requesting all
+%% fleets, use the pagination parameters to retrieve results as a set of
+%% sequential pages. If successful, a FleetAttributes object is
+%% returned for each requested fleet ID. When specifying a list of fleet IDs,
+%% attribute objects are returned only for fleets that currently exist.
+%%
+%% Some API actions may limit the number of fleet IDs allowed in one
+%% request. If a request exceeds this limit, the request fails and the error
+%% message includes the maximum allowed.
+%%
+%%
+describe_fleet_attributes(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_fleet_attributes(Client, Input, []).
+describe_fleet_attributes(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeFleetAttributes">>, Input, Options).
+
+%% @doc Retrieves the current status of fleet capacity for one or more
+%% fleets. This information includes the number of instances that have been
+%% requested for the fleet and the number currently active. You can request
+%% capacity for all fleets, or specify a list of one or more fleet IDs. When
+%% requesting all fleets, use the pagination parameters to retrieve results
+%% as a set of sequential pages. If successful, a FleetCapacity object
+%% is returned for each requested fleet ID. When specifying a list of fleet
+%% IDs, attribute objects are returned only for fleets that currently exist.
+%%
+%% Some API actions may limit the number of fleet IDs allowed in one
+%% request. If a request exceeds this limit, the request fails and the error
+%% message includes the maximum allowed.
+%%
+%%
+describe_fleet_capacity(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_fleet_capacity(Client, Input, []).
+describe_fleet_capacity(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeFleetCapacity">>, Input, Options).
+
+%% @doc Retrieves entries from the fleet event log. You can specify a time
+%% range to limit the result set. Use the pagination parameters to retrieve
+%% results as a set of sequential pages. If successful, a collection of event
+%% log entries matching the request are returned.
+describe_fleet_events(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_fleet_events(Client, Input, []).
+describe_fleet_events(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeFleetEvents">>, Input, Options).
+
+%% @doc Retrieves the port settings for a fleet. Port settings are used to
+%% limit incoming traffic access to game servers in the fleet. To get a
+%% fleet's port settings, specify a fleet ID. If successful, an
+%% IpPermission object is returned for the requested fleet ID. If the
+%% requested fleet has been deleted, the result set will be empty.
+describe_fleet_port_settings(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_fleet_port_settings(Client, Input, []).
+describe_fleet_port_settings(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeFleetPortSettings">>, Input, Options).
+
+%% @doc Retrieves utilization statistics for one or more fleets. You can
+%% request utilization data for all fleets, or specify a list of one or more
+%% fleet IDs. When requesting all fleets, use the pagination parameters to
+%% retrieve results as a set of sequential pages. If successful, a
+%% FleetUtilization object is returned for each requested fleet ID.
+%% When specifying a list of fleet IDs, utilization objects are returned only
+%% for fleets that currently exist.
+%%
+%% Some API actions may limit the number of fleet IDs allowed in one
+%% request. If a request exceeds this limit, the request fails and the error
+%% message includes the maximum allowed.
+%%
+%%
+describe_fleet_utilization(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_fleet_utilization(Client, Input, []).
+describe_fleet_utilization(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeFleetUtilization">>, Input, Options).
+
+%% @doc Retrieves properties for one or more game sessions. This action can
+%% be used in several ways: (1) provide a GameSessionId parameter to
+%% request properties for a specific game session; (2) provide a
+%% FleetId or AliasId parameter to request properties for all
+%% game sessions running on a fleet.
+%%
+%% To get game session record(s), specify only one of the following: game
+%% session ID, fleet ID, or alias ID. You can filter this request by game
+%% session status. Use the pagination parameters to retrieve results as a set
+%% of sequential pages. If successful, a GameSession object is
+%% returned for each session matching the request.
+describe_game_sessions(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_game_sessions(Client, Input, []).
+describe_game_sessions(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribeGameSessions">>, Input, Options).
+
+%% @doc Retrieves properties for one or more player sessions. This action can
+%% be used in several ways: (1) provide a PlayerSessionId parameter to
+%% request properties for a specific player session; (2) provide a
+%% GameSessionId parameter to request properties for all player
+%% sessions in the specified game session; (3) provide a PlayerId
+%% parameter to request properties for all player sessions of a specified
+%% player.
+%%
+%% To get game session record(s), specify only one of the following: a player
+%% session ID, a game session ID, or a player ID. You can filter this request
+%% by player session status. Use the pagination parameters to retrieve
+%% results as a set of sequential pages. If successful, a
+%% PlayerSession object is returned for each session matching the
+%% request.
+describe_player_sessions(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ describe_player_sessions(Client, Input, []).
+describe_player_sessions(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DescribePlayerSessions">>, Input, Options).
+
+%% @doc Retrieves the location of stored game session logs for a specified
+%% game session. When a game session is terminated, Amazon GameLift
+%% automatically stores the logs in Amazon S3. Use this URL to download the
+%% logs.
+%%
+%% See the AWS
+%% Service Limits page for maximum log file sizes. Log files that exceed
+%% this limit are not saved.
+%%
+%%
+get_game_session_log_url(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_game_session_log_url(Client, Input, []).
+get_game_session_log_url(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetGameSessionLogUrl">>, Input, Options).
+
+%% @doc Retrieves a collection of alias records for this AWS account. You can
+%% filter the result set by alias name and/or routing strategy type. Use the
+%% pagination parameters to retrieve results in sequential pages.
+%%
+%% Aliases are not listed in any particular order.
+%%
+%%
+list_aliases(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_aliases(Client, Input, []).
+list_aliases(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListAliases">>, Input, Options).
+
+%% @doc Retrieves build records for all builds associated with an AWS
+%% account. You can filter the result set by build status. Use the pagination
+%% parameters to retrieve results in a set of sequential pages.
+%%
+%% Build records are not listed in any particular order.
+%%
+%%
+list_builds(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_builds(Client, Input, []).
+list_builds(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListBuilds">>, Input, Options).
+
+%% @doc Retrieves a collection of fleet records for this AWS account. You can
+%% filter the result set by build ID. Use the pagination parameters to
+%% retrieve results in sequential pages.
+%%
+%% Fleet records are not listed in any particular order.
+%%
+%%
+list_fleets(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_fleets(Client, Input, []).
+list_fleets(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListFleets">>, Input, Options).
+
+%% @doc Retrieves a fresh set of upload credentials and the assigned Amazon
+%% S3 storage location for a specific build. Valid credentials are required
+%% to upload your game build files to Amazon S3.
+%%
+%% Call this action only if you need credentials for a build
+%% created with CreateBuild. This is a rare situation; in most cases,
+%% builds are created using the CLI command upload-build
, which
+%% creates a build record and also uploads build files.
+%%
+%% Upload credentials are returned when you create the build,
+%% but they have a limited lifespan. You can get fresh credentials and use
+%% them to re-upload game files until the state of that build changes to
+%% READY. Once this happens, you must create a brand new build.
+request_upload_credentials(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ request_upload_credentials(Client, Input, []).
+request_upload_credentials(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"RequestUploadCredentials">>, Input, Options).
+
+%% @doc Retrieves the fleet ID that a specified alias is currently pointing
+%% to.
+resolve_alias(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ resolve_alias(Client, Input, []).
+resolve_alias(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ResolveAlias">>, Input, Options).
+
+%% @doc Updates properties for an alias. To update properties, specify the
+%% alias ID to be updated and provide the information to be changed. To
+%% reassign an alias to another fleet, provide an updated routing strategy.
+%% If successful, the updated alias record is returned.
+update_alias(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_alias(Client, Input, []).
+update_alias(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateAlias">>, Input, Options).
+
+%% @doc Updates metadata in a build record, including the build name and
+%% version. To update the metadata, specify the build ID to update and
+%% provide the new values. If successful, a build object containing the
+%% updated metadata is returned.
+update_build(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_build(Client, Input, []).
+update_build(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateBuild">>, Input, Options).
+
+%% @doc Updates fleet properties, including name and description, for a
+%% fleet. To update metadata, specify the fleet ID and the property values
+%% you want to change. If successful, the fleet ID for the updated fleet is
+%% returned.
+update_fleet_attributes(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_fleet_attributes(Client, Input, []).
+update_fleet_attributes(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateFleetAttributes">>, Input, Options).
+
+%% @doc Updates capacity settings for a fleet. Use this action to specify the
+%% number of EC2 instances (hosts) you want this fleet to contain. Before
+%% calling this action, you may want to call DescribeEC2InstanceLimits
+%% to get the maximum capacity based on the fleet's EC2 instance type.
+%%
+%% To update fleet capacity, specify the fleet ID and the desired number of
+%% instances. If successful, Amazon GameLift starts or terminates instances
+%% so that the fleet's active instance count matches the desired instance
+%% count. You can view a fleet's current capacity information by calling
+%% DescribeFleetCapacity. If the desired instance count is higher than
+%% the instance type's limit, the "Limit Exceeded" exception will occur.
+update_fleet_capacity(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_fleet_capacity(Client, Input, []).
+update_fleet_capacity(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateFleetCapacity">>, Input, Options).
+
+%% @doc Updates port settings for a fleet. To update settings, specify the
+%% fleet ID to be updated and list the permissions you want to update. List
+%% the permissions you want to add in InboundPermissionAuthorizations,
+%% and permissions you want to remove in InboundPermissionRevocations.
+%% Permissions to be removed must match existing fleet permissions. If
+%% successful, the fleet ID for the updated fleet is returned.
+update_fleet_port_settings(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_fleet_port_settings(Client, Input, []).
+update_fleet_port_settings(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateFleetPortSettings">>, Input, Options).
+
+%% @doc Updates game session properties. This includes the session name,
+%% maximum player count and the player session creation policy, which either
+%% allows or denies new players from joining the session. To update a game
+%% session, specify the game session ID and the values you want to change. If
+%% successful, an updated GameSession object is returned.
+update_game_session(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_game_session(Client, Input, []).
+update_game_session(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateGameSession">>, 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 :: {binary(), binary()}.
+request(Client, Action, Input, Options) ->
+ Client1 = Client#{service => <<"gamelift">>},
+ Host = get_host(<<"gamelift">>, Client1),
+ URL = get_url(Host, Client1),
+ Headers = [{<<"Host">>, Host},
+ {<<"Content-Type">>, <<"application/x-amz-json-1.1">>},
+ {<<"X-Amz-Target">>, << <<"GameLift.">>/binary, Action/binary>>}],
+ Payload = jsx:encode(Input),
+ Headers1 = aws_request:sign_request(Client1, <<"POST">>, URL, Headers, Payload),
+ Response = hackney:request(post, URL, Headers1, 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, [return_maps]),
+ {ok, Result, {200, ResponseHeaders, Client}}
+ end;
+handle_response({ok, StatusCode, ResponseHeaders, Client}) ->
+ {ok, Body} = hackney:body(Client),
+ Error = jsx:decode(Body, [return_maps]),
+ Exception = maps:get(<<"__type">>, Error, undefined),
+ Reason = maps:get(<<"message">>, Error, undefined),
+ {error, {Exception, Reason}, {StatusCode, ResponseHeaders, Client}};
+handle_response({error, Reason}) ->
+ {error, Reason}.
+
+get_host(_EndpointPrefix, #{region := <<"local">>}) ->
+ <<"localhost">>;
+get_host(EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
+ aws_util:binary_join([EndpointPrefix,
+ <<".">>,
+ Region,
+ <<".">>,
+ Endpoint],
+ <<"">>).
+
+get_url(Host, Client) ->
+ Proto = maps:get(proto, Client),
+ Port = maps:get(port, Client),
+ aws_util:binary_join([Proto, <<"://">>, Host, <<":">>, Port, <<"/">>],
+ <<"">>).
diff --git a/src/aws_mca.erl b/src/aws_mca.erl
new file mode 100644
index 00000000..3c3afdf7
--- /dev/null
+++ b/src/aws_mca.erl
@@ -0,0 +1,88 @@
+%% WARNING: DO NOT EDIT, AUTO-GENERATED CODE!
+%% See https://github.com/jkakar/aws-codegen for more details.
+
+%% @doc Provides AWS Marketplace business intelligence data on-demand.
+-module(aws_mca).
+
+-export([generate_data_set/2,
+ generate_data_set/3]).
+
+-include_lib("hackney/include/hackney_lib.hrl").
+
+%%====================================================================
+%% API
+%%====================================================================
+
+%% @doc Given a data set type and data set publication date, asynchronously
+%% publishes the requested data set to the specified S3 bucket and notifies
+%% the specified SNS topic once the data is available. Returns a unique
+%% request identifier that can be used to correlate requests with
+%% notifications from the SNS topic. Data sets will be published in
+%% comma-separated values (CSV) format with the file name
+%% {data_set_type}_YYYY-MM-DD.csv. If a file with the same name already
+%% exists (e.g. if the same data set is requested twice), the original file
+%% will be overwritten by the new file. Requires a Role with an attached
+%% permissions policy providing Allow permissions for the following actions:
+%% s3:PutObject, s3:GetBucketLocation, sns:GetTopicAttributes, sns:Publish,
+%% iam:GetRolePolicy.
+generate_data_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ generate_data_set(Client, Input, []).
+generate_data_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GenerateDataSet">>, 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 :: {binary(), binary()}.
+request(Client, Action, Input, Options) ->
+ Client1 = Client#{service => <<"marketplacecommerceanalytics">>},
+ Host = get_host(<<"marketplacecommerceanalytics">>, Client1),
+ URL = get_url(Host, Client1),
+ Headers = [{<<"Host">>, Host},
+ {<<"Content-Type">>, <<"application/x-amz-json-1.1">>},
+ {<<"X-Amz-Target">>, << <<"MarketplaceCommerceAnalytics20150701.">>/binary, Action/binary>>}],
+ Payload = jsx:encode(Input),
+ Headers1 = aws_request:sign_request(Client1, <<"POST">>, URL, Headers, Payload),
+ Response = hackney:request(post, URL, Headers1, 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, [return_maps]),
+ {ok, Result, {200, ResponseHeaders, Client}}
+ end;
+handle_response({ok, StatusCode, ResponseHeaders, Client}) ->
+ {ok, Body} = hackney:body(Client),
+ Error = jsx:decode(Body, [return_maps]),
+ Exception = maps:get(<<"__type">>, Error, undefined),
+ Reason = maps:get(<<"message">>, Error, undefined),
+ {error, {Exception, Reason}, {StatusCode, ResponseHeaders, Client}};
+handle_response({error, Reason}) ->
+ {error, Reason}.
+
+get_host(_EndpointPrefix, #{region := <<"local">>}) ->
+ <<"localhost">>;
+get_host(EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
+ aws_util:binary_join([EndpointPrefix,
+ <<".">>,
+ Region,
+ <<".">>,
+ Endpoint],
+ <<"">>).
+
+get_url(Host, Client) ->
+ Proto = maps:get(proto, Client),
+ Port = maps:get(port, Client),
+ aws_util:binary_join([Proto, <<"://">>, Host, <<":">>, Port, <<"/">>],
+ <<"">>).
diff --git a/src/aws_waf.erl b/src/aws_waf.erl
new file mode 100644
index 00000000..f5828984
--- /dev/null
+++ b/src/aws_waf.erl
@@ -0,0 +1,899 @@
+%% WARNING: DO NOT EDIT, AUTO-GENERATED CODE!
+%% See https://github.com/jkakar/aws-codegen for more details.
+
+%% @doc This is the AWS WAF API Reference. This guide is for
+%% developers who need detailed information about the AWS WAF API actions,
+%% data types, and errors. For detailed information about AWS WAF features
+%% and an overview of how to use the AWS WAF API, see the AWS WAF
+%% Developer Guide.
+-module(aws_waf).
+
+-export([create_byte_match_set/2,
+ create_byte_match_set/3,
+ create_i_p_set/2,
+ create_i_p_set/3,
+ create_rule/2,
+ create_rule/3,
+ create_size_constraint_set/2,
+ create_size_constraint_set/3,
+ create_sql_injection_match_set/2,
+ create_sql_injection_match_set/3,
+ create_web_a_c_l/2,
+ create_web_a_c_l/3,
+ delete_byte_match_set/2,
+ delete_byte_match_set/3,
+ delete_i_p_set/2,
+ delete_i_p_set/3,
+ delete_rule/2,
+ delete_rule/3,
+ delete_size_constraint_set/2,
+ delete_size_constraint_set/3,
+ delete_sql_injection_match_set/2,
+ delete_sql_injection_match_set/3,
+ delete_web_a_c_l/2,
+ delete_web_a_c_l/3,
+ get_byte_match_set/2,
+ get_byte_match_set/3,
+ get_change_token/2,
+ get_change_token/3,
+ get_change_token_status/2,
+ get_change_token_status/3,
+ get_i_p_set/2,
+ get_i_p_set/3,
+ get_rule/2,
+ get_rule/3,
+ get_sampled_requests/2,
+ get_sampled_requests/3,
+ get_size_constraint_set/2,
+ get_size_constraint_set/3,
+ get_sql_injection_match_set/2,
+ get_sql_injection_match_set/3,
+ get_web_a_c_l/2,
+ get_web_a_c_l/3,
+ list_byte_match_sets/2,
+ list_byte_match_sets/3,
+ list_i_p_sets/2,
+ list_i_p_sets/3,
+ list_rules/2,
+ list_rules/3,
+ list_size_constraint_sets/2,
+ list_size_constraint_sets/3,
+ list_sql_injection_match_sets/2,
+ list_sql_injection_match_sets/3,
+ list_web_a_c_ls/2,
+ list_web_a_c_ls/3,
+ update_byte_match_set/2,
+ update_byte_match_set/3,
+ update_i_p_set/2,
+ update_i_p_set/3,
+ update_rule/2,
+ update_rule/3,
+ update_size_constraint_set/2,
+ update_size_constraint_set/3,
+ update_sql_injection_match_set/2,
+ update_sql_injection_match_set/3,
+ update_web_a_c_l/2,
+ update_web_a_c_l/3]).
+
+-include_lib("hackney/include/hackney_lib.hrl").
+
+%%====================================================================
+%% API
+%%====================================================================
+
+%% @doc Creates a ByteMatchSet
. You then use
+%% UpdateByteMatchSet to identify the part of a web request that you
+%% want AWS WAF to inspect, such as the values of the User-Agent
+%% header or the query string. For example, you can create a
+%% ByteMatchSet
that matches any requests with
+%% User-Agent
headers that contain the string
+%% BadBot
. You can then configure AWS WAF to reject those
+%% requests.
+%%
+%% To create and configure a ByteMatchSet
, perform the following
+%% steps:
+%%
+%% - Use GetChangeToken to get the change token that you
+%% provide in the
ChangeToken
parameter of a
+%% CreateByteMatchSet
request. - Submit a
+%%
CreateByteMatchSet
request. - Use
+%%
GetChangeToken
to get the change token that you provide in
+%% the ChangeToken
parameter of an
+%% UpdateByteMatchSet
request. - Submit an
+%% UpdateByteMatchSet request to specify the part of the request that
+%% you want AWS WAF to inspect (for example, the header or the URI) and the
+%% value that you want AWS WAF to watch for.
For more information
+%% about how to use the AWS WAF API to allow or block HTTP requests, see the
+%% AWS WAF
+%% Developer Guide.
+create_byte_match_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_byte_match_set(Client, Input, []).
+create_byte_match_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateByteMatchSet">>, Input, Options).
+
+%% @doc Creates an IPSet, which you use to specify which web requests
+%% you want to allow or block based on the IP addresses that the requests
+%% originate from. For example, if you're receiving a lot of requests from
+%% one or more individual IP addresses or one or more ranges of IP addresses
+%% and you want to block the requests, you can create an IPSet
+%% that contains those IP addresses and then configure AWS WAF to block the
+%% requests.
+%%
+%% To create and configure an IPSet
, perform the following
+%% steps:
+%%
+%% - Use GetChangeToken to get the change token that you
+%% provide in the
ChangeToken
parameter of a
+%% CreateIPSet
request. - Submit a
+%%
CreateIPSet
request. - Use
GetChangeToken
+%% to get the change token that you provide in the ChangeToken
+%% parameter of an UpdateIPSet request. - Submit an
+%%
UpdateIPSet
request to specify the IP addresses that you want
+%% AWS WAF to watch for.
For more information about how to use the
+%% AWS WAF API to allow or block HTTP requests, see the AWS WAF
+%% Developer Guide.
+create_i_p_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_i_p_set(Client, Input, []).
+create_i_p_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateIPSet">>, Input, Options).
+
+%% @doc Creates a Rule
, which contains the IPSet
+%% objects, ByteMatchSet
objects, and other predicates that
+%% identify the requests that you want to block. If you add more than one
+%% predicate to a Rule
, a request must match all of the
+%% specifications to be allowed or blocked. For example, suppose you add the
+%% following to a Rule
:
+%%
+%% - An
IPSet
that matches the IP address
+%% 192.0.2.44/32
- A
ByteMatchSet
that
+%% matches BadBot
in the User-Agent
header
+%%
You then add the Rule
to a WebACL
and
+%% specify that you want to blocks requests that satisfy the
+%% Rule
. For a request to be blocked, it must come from the IP
+%% address 192.0.2.44 and the User-Agent
header in the
+%% request must contain the value BadBot
.
+%%
+%% To create and configure a Rule
, perform the following steps:
+%%
+%% - Create and update the predicates that you want to include in the
+%%
Rule
. For more information, see CreateByteMatchSet,
+%% CreateIPSet, and CreateSqlInjectionMatchSet. - Use
+%% GetChangeToken to get the change token that you provide in the
+%%
ChangeToken
parameter of a CreateRule
+%% request. - Submit a
CreateRule
request. - Use
+%%
GetChangeToken
to get the change token that you provide in
+%% the ChangeToken
parameter of an UpdateRule
+%% request. - Submit an
UpdateRule
request to specify the
+%% predicates that you want to include in the Rule
.
+%% - Create and update a
WebACL
that contains the
+%% Rule
. For more information, see CreateWebACL.
+%%
For more information about how to use the AWS WAF API to allow or
+%% block HTTP requests, see the AWS WAF
+%% Developer Guide.
+create_rule(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_rule(Client, Input, []).
+create_rule(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateRule">>, Input, Options).
+
+%% @doc Creates a SizeConstraintSet
. You then use
+%% UpdateSizeConstraintSet to identify the part of a web request that
+%% you want AWS WAF to check for length, such as the length of the
+%% User-Agent
header or the length of the query string. For
+%% example, you can create a SizeConstraintSet
that matches any
+%% requests that have a query string that is longer than 100 bytes. You can
+%% then configure AWS WAF to reject those requests.
+%%
+%% To create and configure a SizeConstraintSet
, perform the
+%% following steps:
+%%
+%% - Use GetChangeToken to get the change token that you
+%% provide in the
ChangeToken
parameter of a
+%% CreateSizeConstraintSet
request. - Submit a
+%%
CreateSizeConstraintSet
request. - Use
+%%
GetChangeToken
to get the change token that you provide in
+%% the ChangeToken
parameter of an
+%% UpdateSizeConstraintSet
request. - Submit an
+%% UpdateSizeConstraintSet request to specify the part of the request
+%% that you want AWS WAF to inspect (for example, the header or the URI) and
+%% the value that you want AWS WAF to watch for.
For more
+%% information about how to use the AWS WAF API to allow or block HTTP
+%% requests, see the AWS WAF
+%% Developer Guide.
+create_size_constraint_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_size_constraint_set(Client, Input, []).
+create_size_constraint_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateSizeConstraintSet">>, Input, Options).
+
+%% @doc Creates a SqlInjectionMatchSet, which you use to allow, block,
+%% or count requests that contain snippets of SQL code in a specified part of
+%% web requests. AWS WAF searches for character sequences that are likely to
+%% be malicious strings.
+%%
+%% To create and configure a SqlInjectionMatchSet
, perform the
+%% following steps:
+%%
+%% - Use GetChangeToken to get the change token that you
+%% provide in the
ChangeToken
parameter of a
+%% CreateSqlInjectionMatchSet
request. - Submit a
+%%
CreateSqlInjectionMatchSet
request. - Use
+%%
GetChangeToken
to get the change token that you provide in
+%% the ChangeToken
parameter of an
+%% UpdateSqlInjectionMatchSet request. - Submit an
+%% UpdateSqlInjectionMatchSet request to specify the parts of web
+%% requests in which you want to allow, block, or count malicious SQL
+%% code.
For more information about how to use the AWS WAF API to
+%% allow or block HTTP requests, see the AWS WAF
+%% Developer Guide.
+create_sql_injection_match_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_sql_injection_match_set(Client, Input, []).
+create_sql_injection_match_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateSqlInjectionMatchSet">>, Input, Options).
+
+%% @doc Creates a WebACL
, which contains the Rules
+%% that identify the CloudFront web requests that you want to allow, block,
+%% or count. AWS WAF evaluates Rules
in order based on the value
+%% of Priority
for each Rule
.
+%%
+%% You also specify a default action, either ALLOW
or
+%% BLOCK
. If a web request doesn't match any of the
+%% Rules
in a WebACL
, AWS WAF responds to the
+%% request with the default action.
+%%
+%% To create and configure a WebACL
, perform the following
+%% steps:
+%%
+%% - Create and update the
ByteMatchSet
objects and other
+%% predicates that you want to include in Rules
. For more
+%% information, see CreateByteMatchSet, UpdateByteMatchSet,
+%% CreateIPSet, UpdateIPSet, CreateSqlInjectionMatchSet,
+%% and UpdateSqlInjectionMatchSet. - Create and update the
+%%
Rules
that you want to include in the WebACL
.
+%% For more information, see CreateRule and UpdateRule.
+%% - Use GetChangeToken to get the change token that you provide in
+%% the
ChangeToken
parameter of a CreateWebACL
+%% request. - Submit a
CreateWebACL
request. - Use
+%%
GetChangeToken
to get the change token that you provide in
+%% the ChangeToken
parameter of an UpdateWebACL
+%% request. - Submit an UpdateWebACL request to specify the
+%%
Rules
that you want to include in the WebACL
, to
+%% specify the default action, and to associate the WebACL
with
+%% a CloudFront distribution.
For more information about how to
+%% use the AWS WAF API, see the AWS WAF
+%% Developer Guide.
+create_web_a_c_l(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ create_web_a_c_l(Client, Input, []).
+create_web_a_c_l(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"CreateWebACL">>, Input, Options).
+
+%% @doc Permanently deletes a ByteMatchSet. You can't delete a
+%% ByteMatchSet
if it's still used in any Rules
or
+%% if it still includes any ByteMatchTuple objects (any filters).
+%%
+%% If you just want to remove a ByteMatchSet
from a
+%% Rule
, use UpdateRule.
+%%
+%% To permanently delete a ByteMatchSet
, perform the following
+%% steps:
+%%
+%% - Update the
ByteMatchSet
to remove filters, if any.
+%% For more information, see UpdateByteMatchSet. - Use
+%% GetChangeToken to get the change token that you provide in the
+%%
ChangeToken
parameter of a DeleteByteMatchSet
+%% request. - Submit a
DeleteByteMatchSet
request.
+%%
+delete_byte_match_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_byte_match_set(Client, Input, []).
+delete_byte_match_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteByteMatchSet">>, Input, Options).
+
+%% @doc Permanently deletes an IPSet. You can't delete an
+%% IPSet
if it's still used in any Rules
or if it
+%% still includes any IP addresses.
+%%
+%% If you just want to remove an IPSet
from a Rule
,
+%% use UpdateRule.
+%%
+%% To permanently delete an IPSet
from AWS WAF, perform the
+%% following steps:
+%%
+%% - Update the
IPSet
to remove IP address ranges, if
+%% any. For more information, see UpdateIPSet. - Use
+%% GetChangeToken to get the change token that you provide in the
+%%
ChangeToken
parameter of a DeleteIPSet
+%% request. - Submit a
DeleteIPSet
request.
+delete_i_p_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_i_p_set(Client, Input, []).
+delete_i_p_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteIPSet">>, Input, Options).
+
+%% @doc Permanently deletes a Rule. You can't delete a
+%% Rule
if it's still used in any WebACL
objects or
+%% if it still includes any predicates, such as ByteMatchSet
+%% objects.
+%%
+%% If you just want to remove a Rule
from a WebACL
,
+%% use UpdateWebACL.
+%%
+%% To permanently delete a Rule
from AWS WAF, perform the
+%% following steps:
+%%
+%% - Update the
Rule
to remove predicates, if any. For
+%% more information, see UpdateRule. - Use
+%% GetChangeToken to get the change token that you provide in the
+%%
ChangeToken
parameter of a DeleteRule
+%% request. - Submit a
DeleteRule
request.
+delete_rule(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_rule(Client, Input, []).
+delete_rule(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteRule">>, Input, Options).
+
+%% @doc Permanently deletes a SizeConstraintSet. You can't delete a
+%% SizeConstraintSet
if it's still used in any
+%% Rules
or if it still includes any SizeConstraint
+%% objects (any filters).
+%%
+%% If you just want to remove a SizeConstraintSet
from a
+%% Rule
, use UpdateRule.
+%%
+%% To permanently delete a SizeConstraintSet
, perform the
+%% following steps:
+%%
+%% - Update the
SizeConstraintSet
to remove filters, if
+%% any. For more information, see UpdateSizeConstraintSet.
+%% - Use GetChangeToken to get the change token that you provide in
+%% the
ChangeToken
parameter of a
+%% DeleteSizeConstraintSet
request. - Submit a
+%%
DeleteSizeConstraintSet
request.
+delete_size_constraint_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_size_constraint_set(Client, Input, []).
+delete_size_constraint_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteSizeConstraintSet">>, Input, Options).
+
+%% @doc Permanently deletes a SqlInjectionMatchSet. You can't delete a
+%% SqlInjectionMatchSet
if it's still used in any
+%% Rules
or if it still contains any
+%% SqlInjectionMatchTuple objects.
+%%
+%% If you just want to remove a SqlInjectionMatchSet
from a
+%% Rule
, use UpdateRule.
+%%
+%% To permanently delete a SqlInjectionMatchSet
from AWS WAF,
+%% perform the following steps:
+%%
+%% - Update the
SqlInjectionMatchSet
to remove filters,
+%% if any. For more information, see UpdateSqlInjectionMatchSet.
+%% - Use GetChangeToken to get the change token that you provide in
+%% the
ChangeToken
parameter of a
+%% DeleteSqlInjectionMatchSet
request. - Submit a
+%%
DeleteSqlInjectionMatchSet
request.
+delete_sql_injection_match_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_sql_injection_match_set(Client, Input, []).
+delete_sql_injection_match_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteSqlInjectionMatchSet">>, Input, Options).
+
+%% @doc Permanently deletes a WebACL. You can't delete a
+%% WebACL
if it still contains any Rules
.
+%%
+%% To delete a WebACL
, perform the following steps:
+%%
+%% - Update the
WebACL
to remove Rules
, if
+%% any. For more information, see UpdateWebACL. - Use
+%% GetChangeToken to get the change token that you provide in the
+%%
ChangeToken
parameter of a DeleteWebACL
+%% request. - Submit a
DeleteWebACL
request.
+delete_web_a_c_l(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ delete_web_a_c_l(Client, Input, []).
+delete_web_a_c_l(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"DeleteWebACL">>, Input, Options).
+
+%% @doc Returns the ByteMatchSet specified by
+%% ByteMatchSetId
.
+get_byte_match_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_byte_match_set(Client, Input, []).
+get_byte_match_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetByteMatchSet">>, Input, Options).
+
+%% @doc When you want to create, update, or delete AWS WAF objects, get a
+%% change token and include the change token in the create, update, or delete
+%% request. Change tokens ensure that your application doesn't submit
+%% conflicting requests to AWS WAF.
+%%
+%% Each create, update, or delete request must use a unique change token. If
+%% your application submits a GetChangeToken
request and then
+%% submits a second GetChangeToken
request before submitting a
+%% create, update, or delete request, the second GetChangeToken
+%% request returns the same value as the first GetChangeToken
+%% request.
+%%
+%% When you use a change token in a create, update, or delete request, the
+%% status of the change token changes to PENDING
, which
+%% indicates that AWS WAF is propagating the change to all AWS WAF servers.
+%% Use GetChangeTokenStatus
to determine the status of your
+%% change token.
+get_change_token(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_change_token(Client, Input, []).
+get_change_token(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetChangeToken">>, Input, Options).
+
+%% @doc Returns the status of a ChangeToken
that you got by
+%% calling GetChangeToken. ChangeTokenStatus
is one of
+%% the following values:
+%%
+%% PROVISIONED
: You requested the change token by
+%% calling GetChangeToken
, but you haven't used it yet in a call
+%% to create, update, or delete an AWS WAF object.
+%% PENDING
: AWS WAF is propagating the create, update, or
+%% delete request to all AWS WAF servers. IN_SYNC
:
+%% Propagation is complete.
+get_change_token_status(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_change_token_status(Client, Input, []).
+get_change_token_status(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetChangeTokenStatus">>, Input, Options).
+
+%% @doc Returns the IPSet that is specified by IPSetId
.
+get_i_p_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_i_p_set(Client, Input, []).
+get_i_p_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetIPSet">>, Input, Options).
+
+%% @doc Returns the Rule that is specified by the RuleId
+%% that you included in the GetRule
request.
+get_rule(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_rule(Client, Input, []).
+get_rule(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetRule">>, Input, Options).
+
+%% @doc Gets detailed information about a specified number of requests--a
+%% sample--that AWS WAF randomly selects from among the first 5,000 requests
+%% that your AWS resource received during a time range that you choose. You
+%% can specify a sample size of up to 100 requests, and you can specify any
+%% time range in the previous three hours.
+%%
+%% GetSampledRequests
returns a time range, which is usually the
+%% time range that you specified. However, if your resource (such as a
+%% CloudFront distribution) received 5,000 requests before the specified time
+%% range elapsed, GetSampledRequests
returns an updated time
+%% range. This new time range indicates the actual period during which AWS
+%% WAF selected the requests in the sample.
+get_sampled_requests(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_sampled_requests(Client, Input, []).
+get_sampled_requests(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetSampledRequests">>, Input, Options).
+
+%% @doc Returns the SizeConstraintSet specified by
+%% SizeConstraintSetId
.
+get_size_constraint_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_size_constraint_set(Client, Input, []).
+get_size_constraint_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetSizeConstraintSet">>, Input, Options).
+
+%% @doc Returns the SqlInjectionMatchSet that is specified by
+%% SqlInjectionMatchSetId
.
+get_sql_injection_match_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_sql_injection_match_set(Client, Input, []).
+get_sql_injection_match_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetSqlInjectionMatchSet">>, Input, Options).
+
+%% @doc Returns the WebACL that is specified by WebACLId
.
+get_web_a_c_l(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ get_web_a_c_l(Client, Input, []).
+get_web_a_c_l(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"GetWebACL">>, Input, Options).
+
+%% @doc Returns an array of ByteMatchSetSummary objects.
+list_byte_match_sets(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_byte_match_sets(Client, Input, []).
+list_byte_match_sets(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListByteMatchSets">>, Input, Options).
+
+%% @doc Returns an array of IPSetSummary objects in the response.
+list_i_p_sets(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_i_p_sets(Client, Input, []).
+list_i_p_sets(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListIPSets">>, Input, Options).
+
+%% @doc Returns an array of RuleSummary objects.
+list_rules(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_rules(Client, Input, []).
+list_rules(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListRules">>, Input, Options).
+
+%% @doc Returns an array of SizeConstraintSetSummary objects.
+list_size_constraint_sets(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_size_constraint_sets(Client, Input, []).
+list_size_constraint_sets(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListSizeConstraintSets">>, Input, Options).
+
+%% @doc Returns an array of SqlInjectionMatchSet objects.
+list_sql_injection_match_sets(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_sql_injection_match_sets(Client, Input, []).
+list_sql_injection_match_sets(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListSqlInjectionMatchSets">>, Input, Options).
+
+%% @doc Returns an array of WebACLSummary objects in the response.
+list_web_a_c_ls(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ list_web_a_c_ls(Client, Input, []).
+list_web_a_c_ls(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"ListWebACLs">>, Input, Options).
+
+%% @doc Inserts or deletes ByteMatchTuple objects (filters) in a
+%% ByteMatchSet. For each ByteMatchTuple
object, you
+%% specify the following values:
+%%
+%% - Whether to insert or delete the object from the array. If you
+%% want to change a
ByteMatchSetUpdate
object, you delete the
+%% existing object and add a new one. - The part of a web request that
+%% you want AWS WAF to inspect, such as a query string or the value of the
+%%
User-Agent
header. - The bytes (typically a string
+%% that corresponds with ASCII characters) that you want AWS WAF to look for.
+%% For more information, including how you specify the values for the AWS WAF
+%% API and the AWS CLI or SDKs, see
TargetString
in the
+%% ByteMatchTuple data type. - Where to look, such as at the
+%% beginning or the end of a query string.
- Whether to perform any
+%% conversions on the request, such as converting it to lowercase, before
+%% inspecting it for the specified string.
For example, you can
+%% add a ByteMatchSetUpdate
object that matches web requests in
+%% which User-Agent
headers contain the string
+%% BadBot
. You can then configure AWS WAF to block those
+%% requests.
+%%
+%% To create and configure a ByteMatchSet
, perform the following
+%% steps:
+%%
+%% - Create a
ByteMatchSet.
For more information, see
+%% CreateByteMatchSet. - Use GetChangeToken to get the
+%% change token that you provide in the
ChangeToken
parameter of
+%% an UpdateByteMatchSet
request. - Submit an
+%%
UpdateByteMatchSet
request to specify the part of the request
+%% that you want AWS WAF to inspect (for example, the header or the URI) and
+%% the value that you want AWS WAF to watch for.
For more
+%% information about how to use the AWS WAF API to allow or block HTTP
+%% requests, see the AWS WAF
+%% Developer Guide.
+update_byte_match_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_byte_match_set(Client, Input, []).
+update_byte_match_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateByteMatchSet">>, Input, Options).
+
+%% @doc Inserts or deletes IPSetDescriptor objects in an
+%% IPSet
. For each IPSetDescriptor
object, you
+%% specify the following values:
+%%
+%% - Whether to insert or delete the object from the array. If you
+%% want to change an
IPSetDescriptor
object, you delete the
+%% existing object and add a new one. - The IP address version,
+%%
IPv4
. - The IP address in CIDR notation, for example,
+%%
192.0.2.0/24
(for the range of IP addresses from
+%% 192.0.2.0
to 192.0.2.255
) or
+%% 192.0.2.44/32
(for the individual IP address
+%% 192.0.2.44
).
AWS WAF supports /8, /16, /24, and
+%% /32 IP address ranges. For more information about CIDR notation, see the
+%% Wikipedia entry Classless
+%% Inter-Domain Routing.
+%%
+%% You use an IPSet
to specify which web requests you want to
+%% allow or block based on the IP addresses that the requests originated
+%% from. For example, if you're receiving a lot of requests from one or a
+%% small number of IP addresses and you want to block the requests, you can
+%% create an IPSet
that specifies those IP addresses, and then
+%% configure AWS WAF to block the requests.
+%%
+%% To create and configure an IPSet
, perform the following
+%% steps:
+%%
+%% - Submit a CreateIPSet request.
- Use
+%% GetChangeToken to get the change token that you provide in the
+%%
ChangeToken
parameter of an UpdateIPSet request.
+%% - Submit an
UpdateIPSet
request to specify the IP addresses
+%% that you want AWS WAF to watch for.
When you update an
+%% IPSet
, you specify the IP addresses that you want to add
+%% and/or the IP addresses that you want to delete. If you want to change an
+%% IP address, you delete the existing IP address and add the new one.
+%%
+%% For more information about how to use the AWS WAF API to allow or block
+%% HTTP requests, see the AWS WAF
+%% Developer Guide.
+update_i_p_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_i_p_set(Client, Input, []).
+update_i_p_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateIPSet">>, Input, Options).
+
+%% @doc Inserts or deletes Predicate objects in a Rule
.
+%% Each Predicate
object identifies a predicate, such as a
+%% ByteMatchSet or an IPSet, that specifies the web requests
+%% that you want to allow, block, or count. If you add more than one
+%% predicate to a Rule
, a request must match all of the
+%% specifications to be allowed, blocked, or counted. For example, suppose
+%% you add the following to a Rule
:
+%%
+%% - A
ByteMatchSet
that matches the value
+%% BadBot
in the User-Agent
header - An
+%%
IPSet
that matches the IP address
+%% 192.0.2.44
You then add the Rule
to a
+%% WebACL
and specify that you want to block requests that
+%% satisfy the Rule
. For a request to be blocked, the
+%% User-Agent
header in the request must contain the value
+%% BadBot
and the request must originate from the IP
+%% address 192.0.2.44.
+%%
+%% To create and configure a Rule
, perform the following steps:
+%%
+%% - Create and update the predicates that you want to include in the
+%%
Rule
. - Create the
Rule
. See
+%% CreateRule. - Use
GetChangeToken
to get the
+%% change token that you provide in the ChangeToken
parameter of
+%% an UpdateRule request. - Submit an
UpdateRule
+%% request to add predicates to the Rule
. - Create and
+%% update a
WebACL
that contains the Rule
. See
+%% CreateWebACL.
If you want to replace one
+%% ByteMatchSet
or IPSet
with another, you delete
+%% the existing one and add the new one.
+%%
+%% For more information about how to use the AWS WAF API to allow or block
+%% HTTP requests, see the AWS WAF
+%% Developer Guide.
+update_rule(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_rule(Client, Input, []).
+update_rule(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateRule">>, Input, Options).
+
+%% @doc Inserts or deletes SizeConstraint objects (filters) in a
+%% SizeConstraintSet. For each SizeConstraint
object, you
+%% specify the following values:
+%%
+%% - Whether to insert or delete the object from the array. If you
+%% want to change a
SizeConstraintSetUpdate
object, you delete
+%% the existing object and add a new one. - The part of a web request
+%% that you want AWS WAF to evaluate, such as the length of a query string or
+%% the length of the
User-Agent
header. - Whether to
+%% perform any transformations on the request, such as converting it to
+%% lowercase, before checking its length. Note that transformations of the
+%% request body are not supported because the AWS resource forwards only the
+%% first
8192
bytes of your request to AWS WAF. - A
+%%
ComparisonOperator
used for evaluating the selected part of
+%% the request against the specified Size
, such as equals,
+%% greater than, less than, and so on. - The length, in bytes, that
+%% you want AWS WAF to watch for in selected part of the request. The length
+%% is computed after applying the transformation.
For example, you
+%% can add a SizeConstraintSetUpdate
object that matches web
+%% requests in which the length of the User-Agent
header is
+%% greater than 100 bytes. You can then configure AWS WAF to block those
+%% requests.
+%%
+%% To create and configure a SizeConstraintSet
, perform the
+%% following steps:
+%%
+%% - Create a
SizeConstraintSet.
For more information,
+%% see CreateSizeConstraintSet. - Use GetChangeToken to
+%% get the change token that you provide in the
ChangeToken
+%% parameter of an UpdateSizeConstraintSet
request.
+%% - Submit an
UpdateSizeConstraintSet
request to specify the
+%% part of the request that you want AWS WAF to inspect (for example, the
+%% header or the URI) and the value that you want AWS WAF to watch for.
+%%
For more information about how to use the AWS WAF API to allow or
+%% block HTTP requests, see the AWS WAF
+%% Developer Guide.
+update_size_constraint_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_size_constraint_set(Client, Input, []).
+update_size_constraint_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateSizeConstraintSet">>, Input, Options).
+
+%% @doc Inserts or deletes SqlInjectionMatchTuple objects (filters) in
+%% a SqlInjectionMatchSet. For each
+%% SqlInjectionMatchTuple
object, you specify the following
+%% values:
+%%
+%% Action
: Whether to insert the object into or delete
+%% the object from the array. To change a
+%% SqlInjectionMatchTuple
, you delete the existing object and
+%% add a new one. FieldToMatch
: The part of web
+%% requests that you want AWS WAF to inspect and, if you want AWS WAF to
+%% inspect a header, the name of the header.
+%% TextTransformation
: Which text transformation, if any, to
+%% perform on the web request before inspecting the request for snippets of
+%% malicious SQL code.
You use SqlInjectionMatchSet
+%% objects to specify which CloudFront requests you want to allow, block, or
+%% count. For example, if you're receiving requests that contain snippets of
+%% SQL code in the query string and you want to block the requests, you can
+%% create a SqlInjectionMatchSet
with the applicable settings,
+%% and then configure AWS WAF to block the requests.
+%%
+%% To create and configure a SqlInjectionMatchSet
, perform the
+%% following steps:
+%%
+%% - Submit a CreateSqlInjectionMatchSet request.
- Use
+%% GetChangeToken to get the change token that you provide in the
+%%
ChangeToken
parameter of an UpdateIPSet request.
+%% - Submit an
UpdateSqlInjectionMatchSet
request to specify
+%% the parts of web requests that you want AWS WAF to inspect for snippets of
+%% SQL code.
For more information about how to use the AWS WAF API
+%% to allow or block HTTP requests, see the AWS WAF
+%% Developer Guide.
+update_sql_injection_match_set(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_sql_injection_match_set(Client, Input, []).
+update_sql_injection_match_set(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateSqlInjectionMatchSet">>, Input, Options).
+
+%% @doc Inserts or deletes ActivatedRule objects in a
+%% WebACL
. Each Rule
identifies web requests that
+%% you want to allow, block, or count. When you update a WebACL
,
+%% you specify the following values:
+%%
+%% - A default action for the
WebACL
, either
+%% ALLOW
or BLOCK
. AWS WAF performs the default
+%% action if a request doesn't match the criteria in any of the
+%% Rules
in a WebACL
. - The
+%%
Rules
that you want to add and/or delete. If you want to
+%% replace one Rule
with another, you delete the existing
+%% Rule
and add the new one. - For each
+%%
Rule
, whether you want AWS WAF to allow requests, block
+%% requests, or count requests that match the conditions in the
+%% Rule
. - The order in which you want AWS WAF to
+%% evaluate the
Rules
in a WebACL
. If you add more
+%% than one Rule
to a WebACL
, AWS WAF evaluates
+%% each request against the Rules
in order based on the value of
+%% Priority
. (The Rule
that has the lowest value
+%% for Priority
is evaluated first.) When a web request matches
+%% all of the predicates (such as ByteMatchSets
and
+%% IPSets
) in a Rule
, AWS WAF immediately takes the
+%% corresponding action, allow or block, and doesn't evaluate the request
+%% against the remaining Rules
in the WebACL
, if
+%% any. - The CloudFront distribution that you want to associate with
+%% the
WebACL
.
To create and configure a
+%% WebACL
, perform the following steps:
+%%
+%% - Create and update the predicates that you want to include in
+%%
Rules
. For more information, see CreateByteMatchSet,
+%% UpdateByteMatchSet, CreateIPSet, UpdateIPSet,
+%% CreateSqlInjectionMatchSet, and
+%% UpdateSqlInjectionMatchSet. - Create and update the
+%%
Rules
that you want to include in the WebACL
.
+%% For more information, see CreateRule and UpdateRule.
+%% - Create a
WebACL
. See CreateWebACL. - Use
+%%
GetChangeToken
to get the change token that you provide in
+%% the ChangeToken
parameter of an UpdateWebACL
+%% request. - Submit an
UpdateWebACL
request to specify
+%% the Rules
that you want to include in the
+%% WebACL
, to specify the default action, and to associate the
+%% WebACL
with a CloudFront distribution.
For more
+%% information about how to use the AWS WAF API to allow or block HTTP
+%% requests, see the AWS WAF
+%% Developer Guide.
+update_web_a_c_l(Client, Input)
+ when is_map(Client), is_map(Input) ->
+ update_web_a_c_l(Client, Input, []).
+update_web_a_c_l(Client, Input, Options)
+ when is_map(Client), is_map(Input), is_list(Options) ->
+ request(Client, <<"UpdateWebACL">>, 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 :: {binary(), binary()}.
+request(Client, Action, Input, Options) ->
+ Client1 = Client#{service => <<"waf">>},
+ Host = get_host(<<"waf">>, Client1),
+ URL = get_url(Host, Client1),
+ Headers = [{<<"Host">>, Host},
+ {<<"Content-Type">>, <<"application/x-amz-json-1.1">>},
+ {<<"X-Amz-Target">>, << <<"AWSWAF_20150824.">>/binary, Action/binary>>}],
+ Payload = jsx:encode(Input),
+ Headers1 = aws_request:sign_request(Client1, <<"POST">>, URL, Headers, Payload),
+ Response = hackney:request(post, URL, Headers1, 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, [return_maps]),
+ {ok, Result, {200, ResponseHeaders, Client}}
+ end;
+handle_response({ok, StatusCode, ResponseHeaders, Client}) ->
+ {ok, Body} = hackney:body(Client),
+ Error = jsx:decode(Body, [return_maps]),
+ Exception = maps:get(<<"__type">>, Error, undefined),
+ Reason = maps:get(<<"message">>, Error, undefined),
+ {error, {Exception, Reason}, {StatusCode, ResponseHeaders, Client}};
+handle_response({error, Reason}) ->
+ {error, Reason}.
+
+get_host(_EndpointPrefix, #{region := <<"local">>}) ->
+ <<"localhost">>;
+get_host(EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
+ aws_util:binary_join([EndpointPrefix,
+ <<".">>,
+ Region,
+ <<".">>,
+ Endpoint],
+ <<"">>).
+
+get_url(Host, Client) ->
+ Proto = maps:get(proto, Client),
+ Port = maps:get(port, Client),
+ aws_util:binary_join([Proto, <<"://">>, Host, <<":">>, Port, <<"/">>],
+ <<"">>).