Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #8 from SemanticSugar/v1.3.2-with-fixes
Browse files Browse the repository at this point in the history
Merge fixes into master
  • Loading branch information
Brujo Benavides authored May 14, 2019
2 parents 83c910e + 82bd8a3 commit bd31f8d
Show file tree
Hide file tree
Showing 16 changed files with 574 additions and 574 deletions.
28 changes: 14 additions & 14 deletions include/erlcloud_aws.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@
-record(aws_request,
{
%% Provided by requesting service
service :: s3,
uri :: string() | binary(),
method :: atom(),
request_headers :: [{string(), string()}],
request_body :: binary(),
service :: s3 | undefined,
uri :: string() | binary() | undefined,
method :: atom() | undefined,
request_headers :: [{string(), string()}] | undefined,
request_body :: binary() | undefined,

%% Read from response
attempt = 0 :: integer(),
response_type :: ok | error,
error_type :: aws | httpc,
httpc_error_reason :: term(),
response_status :: pos_integer(),
response_status_line :: string(),
response_headers :: [{string(), string()}],
response_body :: binary(),
response_type :: ok | error | undefined,
error_type :: aws | httpc | undefined,
httpc_error_reason :: term() | undefined,
response_status :: pos_integer() | undefined,
response_status_line :: string() | undefined,
response_headers :: [{string(), string()}] | undefined,
response_body :: binary() | undefined,

%% Service specific error information
should_retry :: boolean()
should_retry :: boolean() | undefined
}).

36 changes: 18 additions & 18 deletions src/erlcloud_cloudtrail.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@
%%
%% API
%%
-spec(create_trail/3 :: (string(), string(), aws_config()) -> ct_return()).
-spec(create_trail(string(), string(), aws_config()) -> ct_return()).
create_trail(Trail, S3BucketName, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)},
{<<"S3BucketName">>, list_to_binary(S3BucketName)}
],
ct_request("CreateTrail", Json, Config).

-spec(create_trail/4 :: (string(), string(), string(), aws_config()) -> ct_return()).
-spec(create_trail(string(), string(), string(), aws_config()) -> ct_return()).
create_trail(Trail, S3BucketName, SnsTopicName, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)},
{<<"S3BucketName">>, list_to_binary(S3BucketName)},
{<<"SnsTopicName">>, list_to_binary(SnsTopicName)}
],
ct_request("CreateTrail", Json, Config).

-spec(create_trail/5 :: (string(), string(), string(), boolean(), aws_config()) -> ct_return()).
-spec(create_trail(string(), string(), string(), boolean(), aws_config()) -> ct_return()).
create_trail(Trail, S3BucketName, SnsTopicName, IncludeGlobalServiceEvents, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)},
{<<"S3BucketName">>, list_to_binary(S3BucketName)},
Expand All @@ -53,7 +53,7 @@ create_trail(Trail, S3BucketName, SnsTopicName, IncludeGlobalServiceEvents, Conf
],
ct_request("CreateTrail", Json, Config).

-spec(create_trail/6 :: (string(), string(), string(), string(), boolean(), aws_config()) -> ct_return()).
-spec(create_trail(string(), string(), string(), string(), boolean(), aws_config()) -> ct_return()).
create_trail(Trail, S3BucketName, S3KeyPrefix, SnsTopicName, IncludeGlobalServiceEvents, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)},
{<<"S3BucketName">>, list_to_binary(S3BucketName)},
Expand All @@ -63,19 +63,19 @@ create_trail(Trail, S3BucketName, S3KeyPrefix, SnsTopicName, IncludeGlobalServic
],
ct_request("CreateTrail", Json, Config).

-spec(delete_trail/1 :: ([string()] ) -> ct_return()).
-spec(delete_trail([string()] ) -> ct_return()).
delete_trail(Trail) ->
delete_trail(Trail, default_config()).

-spec(delete_trail/2 :: ([string()], aws_config()) -> ct_return()).
-spec(delete_trail([string()], aws_config()) -> ct_return()).
delete_trail(Trail, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)}],
ct_request("DeleteTrail", Json, Config).

-spec(describe_trails/0 :: () -> ct_return()).
-spec(describe_trails() -> ct_return()).
describe_trails() -> describe_trails([]).

-spec(describe_trails/1 :: ([string()] | aws_config()) -> ct_return()).
-spec(describe_trails([string()] | aws_config()) -> ct_return()).
describe_trails(Config) when is_record(Config, aws_config) ->
describe_trails([], Config);

Expand All @@ -84,7 +84,7 @@ describe_trails(Config) when is_record(Config, aws_config) ->
describe_trails(Trails) ->
describe_trails(Trails, default_config()).

-spec(describe_trails/2 :: ([string()], aws_config()) -> ct_return()).
-spec(describe_trails([string()], aws_config()) -> ct_return()).
describe_trails([], Config) ->
ct_request("DescribeTrails", [], Config);

Expand All @@ -93,42 +93,42 @@ describe_trails(Trails, Config) ->
Json = [{<<"TrailNameList">>, [list_to_binary(T) || T <- Trails]}],
ct_request("DescribeTrails", Json, Config).

-spec(get_trail_status/1 :: ([string()] ) -> ct_return()).
-spec(get_trail_status([string()] ) -> ct_return()).
get_trail_status(Trail) ->
get_trail_status(Trail, default_config()).

-spec(get_trail_status/2 :: ([string()], aws_config()) -> ct_return()).
-spec(get_trail_status([string()], aws_config()) -> ct_return()).
get_trail_status(Trail, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)}],
ct_request("GetTrailStatus", Json, Config).

-spec(start_logging/1 :: ([string()] ) -> ct_return()).
-spec(start_logging([string()] ) -> ct_return()).
start_logging(Trail) ->
start_logging(Trail, default_config()).

-spec(start_logging/2 :: ([string()], aws_config()) -> ct_return()).
-spec(start_logging([string()], aws_config()) -> ct_return()).
start_logging(Trail, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)}],
ct_request("StartLogging", Json, Config).

-spec(stop_logging/1 :: ([string()] ) -> ct_return()).
-spec(stop_logging([string()] ) -> ct_return()).
stop_logging(Trail) ->
stop_logging(Trail, default_config()).

-spec(stop_logging/2 :: ([string()], aws_config()) -> ct_return()).
-spec(stop_logging([string()], aws_config()) -> ct_return()).
stop_logging(Trail, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)}],
ct_request("StopLogging", Json, Config).

-spec(update_trail/4 :: (string(), string(), string(), aws_config()) -> ct_return()).
-spec(update_trail(string(), string(), string(), aws_config()) -> ct_return()).
update_trail(Trail, S3BucketName, SnsTopicName, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)},
{<<"S3BucketName">>, list_to_binary(S3BucketName)},
{<<"SnsTopicName">>, list_to_binary(SnsTopicName)}
],
ct_request("UpdateTrail", Json, Config).

-spec(update_trail/5 :: (string(), string(), string(), boolean(), aws_config()) -> ct_return()).
-spec(update_trail(string(), string(), string(), boolean(), aws_config()) -> ct_return()).
update_trail(Trail, S3BucketName, SnsTopicName, IncludeGlobalServiceEvents, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)},
{<<"S3BucketName">>, list_to_binary(S3BucketName)},
Expand All @@ -138,7 +138,7 @@ update_trail(Trail, S3BucketName, SnsTopicName, IncludeGlobalServiceEvents, Conf
ct_request("UpdateTrail", Json, Config).


-spec(update_trail/6 :: (string(), string(), string(), string(), boolean(), aws_config()) -> ct_return()).
-spec(update_trail(string(), string(), string(), string(), boolean(), aws_config()) -> ct_return()).
update_trail(Trail, S3BucketName, S3KeyPrefix, SnsTopicName, IncludeGlobalServiceEvents, Config) ->
Json = [{<<"Name">>, list_to_binary(Trail)},
{<<"S3BucketName">>, list_to_binary(S3BucketName)},
Expand Down
8 changes: 4 additions & 4 deletions src/erlcloud_ddb.erl
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,23 @@
%%% Library initialization.
%%%------------------------------------------------------------------------------

-spec(new/2 :: (string(), string()) -> aws_config()).
-spec(new(string(), string()) -> aws_config()).
new(AccessKeyID, SecretAccessKey) ->
#aws_config{access_key_id=AccessKeyID,
secret_access_key=SecretAccessKey}.

-spec(new/3 :: (string(), string(), string()) -> aws_config()).
-spec(new(string(), string(), string()) -> aws_config()).
new(AccessKeyID, SecretAccessKey, Host) ->
#aws_config{access_key_id=AccessKeyID,
secret_access_key=SecretAccessKey,
ddb_host=Host}.

-spec(configure/2 :: (string(), string()) -> ok).
-spec(configure(string(), string()) -> ok).
configure(AccessKeyID, SecretAccessKey) ->
put(aws_config, new(AccessKeyID, SecretAccessKey)),
ok.

-spec(configure/3 :: (string(), string(), string()) -> ok).
-spec(configure(string(), string(), string()) -> ok).
configure(AccessKeyID, SecretAccessKey, Host) ->
put(aws_config, new(AccessKeyID, SecretAccessKey, Host)),
ok.
Expand Down
8 changes: 4 additions & 4 deletions src/erlcloud_ddb2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,23 @@
%%% Library initialization.
%%%------------------------------------------------------------------------------

-spec(new/2 :: (string(), string()) -> aws_config()).
-spec(new(string(), string()) -> aws_config()).
new(AccessKeyID, SecretAccessKey) ->
#aws_config{access_key_id=AccessKeyID,
secret_access_key=SecretAccessKey}.

-spec(new/3 :: (string(), string(), string()) -> aws_config()).
-spec(new(string(), string(), string()) -> aws_config()).
new(AccessKeyID, SecretAccessKey, Host) ->
#aws_config{access_key_id=AccessKeyID,
secret_access_key=SecretAccessKey,
ddb_host=Host}.

-spec(configure/2 :: (string(), string()) -> ok).
-spec(configure(string(), string()) -> ok).
configure(AccessKeyID, SecretAccessKey) ->
put(aws_config, new(AccessKeyID, SecretAccessKey)),
ok.

-spec(configure/3 :: (string(), string(), string()) -> ok).
-spec(configure(string(), string(), string()) -> ok).
configure(AccessKeyID, SecretAccessKey, Host) ->
put(aws_config, new(AccessKeyID, SecretAccessKey, Host)),
ok.
Expand Down
Loading

0 comments on commit bd31f8d

Please sign in to comment.