Skip to content

Commit 19ff997

Browse files
committed
Fix formatting and dialyzer issues
1 parent 097ca3f commit 19ff997

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/aws_credentials_eks.erl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,37 @@
77

88
-export([fetch/1]).
99

10-
-spec fetch(any()) ->
11-
{ok, aws_credentials:credentials(), aws_credentials_provider:expiration()} |
12-
{error, any()}.
10+
-spec fetch(aws_credentials_provider:options()) ->
11+
{error, _}
12+
| {ok, aws_credentials:credentials(), aws_credentials_provider:expiration()}.
1313
fetch(_Options) ->
1414
FullUri = os:getenv("AWS_CONTAINER_CREDENTIALS_FULL_URI"),
1515
TokenFile = os:getenv("AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"),
1616
AuthToken = read_token(TokenFile),
1717
Response = fetch_session_token(FullUri, AuthToken),
1818
make_map(Response).
1919

20-
-spec read_token(false | string()) -> {ok, string()} | {error, any()}.
20+
-spec read_token(false | string()) -> {error, _} | {ok, binary()}.
2121
read_token(false) -> {error, no_credentials};
2222
read_token(Path) -> file:read_file(Path).
2323

24-
-spec fetch_session_token(false | string(), {error, any()} | {ok, string()}) ->
25-
{error, any()} | {ok, aws_credentials_httpc:status_code(),
26-
aws_credentials_httpc:body(),
27-
aws_credentials_httpc:headers()}.
24+
-spec fetch_session_token(false | string(), {error, _} | {ok, string()}) ->
25+
{error, _}
26+
| {ok, aws_credentials_httpc:status_code(),
27+
aws_credentials_httpc:body(),
28+
aws_credentials_httpc:headers()}.
2829
fetch_session_token(false, _AuthToken) -> {error, no_credentials};
2930
fetch_session_token(_FullUri, {error, _Error} = Error) -> Error;
3031
fetch_session_token(FullUri, {ok, AuthToken}) ->
3132
aws_credentials_httpc:request(get, FullUri, [{?AUTHORIZATION_HEADER, AuthToken}]).
3233

3334

34-
-spec make_map({error, any()} | {ok, aws_credentials_httpc:status_code(),
35-
aws_credentials_httpc:body(),
36-
aws_credentials_httpc:headers()}) ->
37-
{error, any()} | {ok, aws_credentials:credentials(), aws_credentials_provider:expiration()}.
35+
-spec make_map({error, _}
36+
| {ok, aws_credentials_httpc:status_code(),
37+
aws_credentials_httpc:body(),
38+
aws_credentials_httpc:headers()}) ->
39+
{error, _}
40+
| {ok, aws_credentials:credentials(), aws_credentials_provider:expiration()}.
3841
make_map({error, _Error} = Error) -> Error;
3942
make_map({ok, _Status, Body, _Headers}) ->
4043
#{ <<"AccessKeyId">> := AccessKeyId

src/aws_credentials_httpc.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
-type httpc_result() :: {status_line(), [header()], body()}.
2323
-type status_line() :: {http_version(), status_code(), reason_phrase()}.
24-
-type header() :: {string(), string()}.
24+
-type header() :: {string(), binary() | string()}.
2525
-type body() :: binary().
2626
-type http_version() :: string().
2727
-type status_code() :: non_neg_integer().

0 commit comments

Comments
 (0)