%% WARNING: DO NOT EDIT, AUTO-GENERATED CODE! %% See https://github.com/aws-beam/aws-codegen for more details. %% @doc Welcome to the AWS Device Farm API documentation, which contains APIs %% for: %% %%
TestGrid in their names. For more information, see Testing Web
%% Applications on Selenium with Device Farm.
%%
%% RemoteWebDriver constructor.
create_test_grid_url(Client, Input)
when is_map(Client), is_map(Input) ->
create_test_grid_url(Client, Input, []).
create_test_grid_url(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"CreateTestGridUrl">>, Input, Options).
%% @doc Uploads an app or test scripts.
create_upload(Client, Input)
when is_map(Client), is_map(Input) ->
create_upload(Client, Input, []).
create_upload(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"CreateUpload">>, Input, Options).
%% @doc Creates a configuration record in Device Farm for your Amazon Virtual
%% Private Cloud (VPC) endpoint.
create_v_p_c_e_configuration(Client, Input)
when is_map(Client), is_map(Input) ->
create_v_p_c_e_configuration(Client, Input, []).
create_v_p_c_e_configuration(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"CreateVPCEConfiguration">>, Input, Options).
%% @doc Deletes a device pool given the pool ARN. Does not allow deletion of
%% curated pools owned by the system.
delete_device_pool(Client, Input)
when is_map(Client), is_map(Input) ->
delete_device_pool(Client, Input, []).
delete_device_pool(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DeleteDevicePool">>, Input, Options).
%% @doc Deletes a profile that can be applied to one or more private device
%% instances.
delete_instance_profile(Client, Input)
when is_map(Client), is_map(Input) ->
delete_instance_profile(Client, Input, []).
delete_instance_profile(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DeleteInstanceProfile">>, Input, Options).
%% @doc Deletes a network profile.
delete_network_profile(Client, Input)
when is_map(Client), is_map(Input) ->
delete_network_profile(Client, Input, []).
delete_network_profile(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DeleteNetworkProfile">>, Input, Options).
%% @doc Deletes an AWS Device Farm project, given the project ARN.
%%
%% Deleting this resource does not stop an in-progress run.
delete_project(Client, Input)
when is_map(Client), is_map(Input) ->
delete_project(Client, Input, []).
delete_project(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DeleteProject">>, Input, Options).
%% @doc Deletes a completed remote access session and its results.
delete_remote_access_session(Client, Input)
when is_map(Client), is_map(Input) ->
delete_remote_access_session(Client, Input, []).
delete_remote_access_session(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DeleteRemoteAccessSession">>, Input, Options).
%% @doc Deletes the run, given the run ARN.
%%
%% Deleting this resource does not stop an in-progress run.
delete_run(Client, Input)
when is_map(Client), is_map(Input) ->
delete_run(Client, Input, []).
delete_run(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DeleteRun">>, Input, Options).
%% @doc Deletes a Selenium testing project and all content generated under
%% it.
%%
%% NotEligible error if the user is not permitted
%% to invoke the operation. If you must be able to invoke this operation,
%% contact aws-devicefarm-support@amazon.com.
get_offering_status(Client, Input)
when is_map(Client), is_map(Input) ->
get_offering_status(Client, Input, []).
get_offering_status(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"GetOfferingStatus">>, Input, Options).
%% @doc Gets information about a project.
get_project(Client, Input)
when is_map(Client), is_map(Input) ->
get_project(Client, Input, []).
get_project(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"GetProject">>, Input, Options).
%% @doc Returns a link to a currently running remote access session.
get_remote_access_session(Client, Input)
when is_map(Client), is_map(Input) ->
get_remote_access_session(Client, Input, []).
get_remote_access_session(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"GetRemoteAccessSession">>, Input, Options).
%% @doc Gets information about a run.
get_run(Client, Input)
when is_map(Client), is_map(Input) ->
get_run(Client, Input, []).
get_run(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"GetRun">>, Input, Options).
%% @doc Gets information about a suite.
get_suite(Client, Input)
when is_map(Client), is_map(Input) ->
get_suite(Client, Input, []).
get_suite(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"GetSuite">>, Input, Options).
%% @doc Gets information about a test.
get_test(Client, Input)
when is_map(Client), is_map(Input) ->
get_test(Client, Input, []).
get_test(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"GetTest">>, Input, Options).
%% @doc Retrieves information about a Selenium testing project.
get_test_grid_project(Client, Input)
when is_map(Client), is_map(Input) ->
get_test_grid_project(Client, Input, []).
get_test_grid_project(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"GetTestGridProject">>, Input, Options).
%% @doc A session is an instance of a browser created through a
%% RemoteWebDriver with the URL from
%% CreateTestGridUrlResult$url. You can use the following to look up
%% sessions:
%%
%% NotEligible error if the caller is not permitted to invoke
%% the operation. Contact aws-devicefarm-support@amazon.com
%% if you must be able to invoke this operation.
list_offering_promotions(Client, Input)
when is_map(Client), is_map(Input) ->
list_offering_promotions(Client, Input, []).
list_offering_promotions(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListOfferingPromotions">>, Input, Options).
%% @doc Returns a list of all historical purchases, renewals, and system
%% renewal transactions for an AWS account. The list is paginated and ordered
%% by a descending timestamp (most recent transactions are first). The API
%% returns a NotEligible error if the user is not permitted to
%% invoke the operation. If you must be able to invoke this operation,
%% contact aws-devicefarm-support@amazon.com.
list_offering_transactions(Client, Input)
when is_map(Client), is_map(Input) ->
list_offering_transactions(Client, Input, []).
list_offering_transactions(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListOfferingTransactions">>, Input, Options).
%% @doc Returns a list of products or offerings that the user can manage
%% through the API. Each offering record indicates the recurring price per
%% unit and the frequency for that offering. The API returns a
%% NotEligible error if the user is not permitted to invoke the
%% operation. If you must be able to invoke this operation, contact aws-devicefarm-support@amazon.com.
list_offerings(Client, Input)
when is_map(Client), is_map(Input) ->
list_offerings(Client, Input, []).
list_offerings(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListOfferings">>, Input, Options).
%% @doc Gets information about projects.
list_projects(Client, Input)
when is_map(Client), is_map(Input) ->
list_projects(Client, Input, []).
list_projects(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListProjects">>, Input, Options).
%% @doc Returns a list of all currently running remote access sessions.
list_remote_access_sessions(Client, Input)
when is_map(Client), is_map(Input) ->
list_remote_access_sessions(Client, Input, []).
list_remote_access_sessions(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListRemoteAccessSessions">>, Input, Options).
%% @doc Gets information about runs, given an AWS Device Farm project ARN.
list_runs(Client, Input)
when is_map(Client), is_map(Input) ->
list_runs(Client, Input, []).
list_runs(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListRuns">>, Input, Options).
%% @doc Gets information about samples, given an AWS Device Farm job ARN.
list_samples(Client, Input)
when is_map(Client), is_map(Input) ->
list_samples(Client, Input, []).
list_samples(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListSamples">>, Input, Options).
%% @doc Gets information about test suites for a given job.
list_suites(Client, Input)
when is_map(Client), is_map(Input) ->
list_suites(Client, Input, []).
list_suites(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListSuites">>, Input, Options).
%% @doc List the tags for an AWS Device Farm resource.
list_tags_for_resource(Client, Input)
when is_map(Client), is_map(Input) ->
list_tags_for_resource(Client, Input, []).
list_tags_for_resource(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListTagsForResource">>, Input, Options).
%% @doc Gets a list of all Selenium testing projects in your account.
list_test_grid_projects(Client, Input)
when is_map(Client), is_map(Input) ->
list_test_grid_projects(Client, Input, []).
list_test_grid_projects(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListTestGridProjects">>, Input, Options).
%% @doc Returns a list of the actions taken in a TestGridSession.
list_test_grid_session_actions(Client, Input)
when is_map(Client), is_map(Input) ->
list_test_grid_session_actions(Client, Input, []).
list_test_grid_session_actions(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListTestGridSessionActions">>, Input, Options).
%% @doc Retrieves a list of artifacts created during the session.
list_test_grid_session_artifacts(Client, Input)
when is_map(Client), is_map(Input) ->
list_test_grid_session_artifacts(Client, Input, []).
list_test_grid_session_artifacts(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListTestGridSessionArtifacts">>, Input, Options).
%% @doc Retrieves a list of sessions for a TestGridProject.
list_test_grid_sessions(Client, Input)
when is_map(Client), is_map(Input) ->
list_test_grid_sessions(Client, Input, []).
list_test_grid_sessions(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListTestGridSessions">>, Input, Options).
%% @doc Gets information about tests in a given test suite.
list_tests(Client, Input)
when is_map(Client), is_map(Input) ->
list_tests(Client, Input, []).
list_tests(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListTests">>, Input, Options).
%% @doc Gets information about unique problems, such as exceptions or
%% crashes.
%%
%% Unique problems are defined as a single instance of an error across a run,
%% job, or suite. For example, if a call in your application consistently
%% raises an exception (OutOfBoundsException in
%% MyActivity.java:386), ListUniqueProblems returns a
%% single entry instead of many individual entries for that exception.
list_unique_problems(Client, Input)
when is_map(Client), is_map(Input) ->
list_unique_problems(Client, Input, []).
list_unique_problems(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListUniqueProblems">>, Input, Options).
%% @doc Gets information about uploads, given an AWS Device Farm project ARN.
list_uploads(Client, Input)
when is_map(Client), is_map(Input) ->
list_uploads(Client, Input, []).
list_uploads(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListUploads">>, Input, Options).
%% @doc Returns information about all Amazon Virtual Private Cloud (VPC)
%% endpoint configurations in the AWS account.
list_v_p_c_e_configurations(Client, Input)
when is_map(Client), is_map(Input) ->
list_v_p_c_e_configurations(Client, Input, []).
list_v_p_c_e_configurations(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ListVPCEConfigurations">>, Input, Options).
%% @doc Immediately purchases offerings for an AWS account. Offerings renew
%% with the latest total purchased quantity for an offering, unless the
%% renewal was overridden. The API returns a NotEligible error
%% if the user is not permitted to invoke the operation. If you must be able
%% to invoke this operation, contact aws-devicefarm-support@amazon.com.
purchase_offering(Client, Input)
when is_map(Client), is_map(Input) ->
purchase_offering(Client, Input, []).
purchase_offering(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"PurchaseOffering">>, Input, Options).
%% @doc Explicitly sets the quantity of devices to renew for an offering,
%% starting from the effectiveDate of the next period. The API
%% returns a NotEligible error if the user is not permitted to
%% invoke the operation. If you must be able to invoke this operation,
%% contact aws-devicefarm-support@amazon.com.
renew_offering(Client, Input)
when is_map(Client), is_map(Input) ->
renew_offering(Client, Input, []).
renew_offering(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"RenewOffering">>, Input, Options).
%% @doc Schedules a run.
schedule_run(Client, Input)
when is_map(Client), is_map(Input) ->
schedule_run(Client, Input, []).
schedule_run(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ScheduleRun">>, Input, Options).
%% @doc Initiates a stop request for the current job. AWS Device Farm
%% immediately stops the job on the device where tests have not started. You
%% are not billed for this device. On the device where tests have started,
%% setup suite and teardown suite tests run to completion on the device. You
%% are billed for setup, teardown, and any tests that were in progress or
%% already completed.
stop_job(Client, Input)
when is_map(Client), is_map(Input) ->
stop_job(Client, Input, []).
stop_job(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"StopJob">>, Input, Options).
%% @doc Ends a specified remote access session.
stop_remote_access_session(Client, Input)
when is_map(Client), is_map(Input) ->
stop_remote_access_session(Client, Input, []).
stop_remote_access_session(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"StopRemoteAccessSession">>, Input, Options).
%% @doc Initiates a stop request for the current test run. AWS Device Farm
%% immediately stops the run on devices where tests have not started. You are
%% not billed for these devices. On devices where tests have started
%% executing, setup suite and teardown suite tests run to completion on those
%% devices. You are billed for setup, teardown, and any tests that were in
%% progress or already completed.
stop_run(Client, Input)
when is_map(Client), is_map(Input) ->
stop_run(Client, Input, []).
stop_run(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"StopRun">>, Input, Options).
%% @doc Associates the specified tags to a resource with the specified
%% resourceArn. If existing tags on a resource are not specified
%% in the request parameters, they are not changed. When a resource is
%% deleted, the tags associated with that resource are also deleted.
tag_resource(Client, Input)
when is_map(Client), is_map(Input) ->
tag_resource(Client, Input, []).
tag_resource(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"TagResource">>, Input, Options).
%% @doc Deletes the specified tags from a resource.
untag_resource(Client, Input)
when is_map(Client), is_map(Input) ->
untag_resource(Client, Input, []).
untag_resource(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UntagResource">>, Input, Options).
%% @doc Updates information about a private device instance.
update_device_instance(Client, Input)
when is_map(Client), is_map(Input) ->
update_device_instance(Client, Input, []).
update_device_instance(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UpdateDeviceInstance">>, Input, Options).
%% @doc Modifies the name, description, and rules in a device pool given the
%% attributes and the pool ARN. Rule updates are all-or-nothing, meaning they
%% can only be updated as a whole (or not at all).
update_device_pool(Client, Input)
when is_map(Client), is_map(Input) ->
update_device_pool(Client, Input, []).
update_device_pool(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UpdateDevicePool">>, Input, Options).
%% @doc Updates information about an existing private device instance
%% profile.
update_instance_profile(Client, Input)
when is_map(Client), is_map(Input) ->
update_instance_profile(Client, Input, []).
update_instance_profile(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UpdateInstanceProfile">>, Input, Options).
%% @doc Updates the network profile.
update_network_profile(Client, Input)
when is_map(Client), is_map(Input) ->
update_network_profile(Client, Input, []).
update_network_profile(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UpdateNetworkProfile">>, Input, Options).
%% @doc Modifies the specified project name, given the project ARN and a new
%% name.
update_project(Client, Input)
when is_map(Client), is_map(Input) ->
update_project(Client, Input, []).
update_project(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UpdateProject">>, Input, Options).
%% @doc Change details of a project.
update_test_grid_project(Client, Input)
when is_map(Client), is_map(Input) ->
update_test_grid_project(Client, Input, []).
update_test_grid_project(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UpdateTestGridProject">>, Input, Options).
%% @doc Updates an uploaded test spec.
update_upload(Client, Input)
when is_map(Client), is_map(Input) ->
update_upload(Client, Input, []).
update_upload(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UpdateUpload">>, Input, Options).
%% @doc Updates information about an Amazon Virtual Private Cloud (VPC)
%% endpoint configuration.
update_v_p_c_e_configuration(Client, Input)
when is_map(Client), is_map(Input) ->
update_v_p_c_e_configuration(Client, Input, []).
update_v_p_c_e_configuration(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"UpdateVPCEConfiguration">>, 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 => <<"devicefarm">>},
Host = get_host(<<"devicefarm">>, Client1),
URL = get_url(Host, Client1),
Headers = [
{<<"Host">>, Host},
{<<"Content-Type">>, <<"application/x-amz-json-1.1">>},
{<<"X-Amz-Target">>, << <<"DeviceFarm_20150623.">>/binary, Action/binary>>}
],
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, [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, <<"/">>], <<"">>).