From 4ac364a9b9a92fb215471b9c8a681b7319180df8 Mon Sep 17 00:00:00 2001 From: Ransom Richardson Date: Thu, 3 May 2012 14:35:52 -0400 Subject: [PATCH] Fix cond_delete/3 Fix dialyzer issues --- src/ddb.erl | 2 +- src/ddb_iam.erl | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ddb.erl b/src/ddb.erl index 6570790..5d1a668 100644 --- a/src/ddb.erl +++ b/src/ddb.erl @@ -262,7 +262,7 @@ delete(Name, Keys, Returns) -spec cond_delete(tablename(), key_json(), update_cond()) -> json_reply(). cond_delete(Name, Keys, Condition) -> - cond_update(Name, Keys, Condition, 'none'). + cond_delete(Name, Keys, Condition, 'none'). -spec cond_delete(tablename(), key_json(), update_cond(), returns()) -> json_reply(). diff --git a/src/ddb_iam.erl b/src/ddb_iam.erl index 71f8daa..c95df77 100644 --- a/src/ddb_iam.erl +++ b/src/ddb_iam.erl @@ -26,6 +26,7 @@ -export([credentials/2, token/1]). -include_lib("ibrowse/include/ibrowse.hrl"). +-include_lib("xmerl/include/xmerl.hrl"). -define(IAM_ENDPOINT, "https://sts.amazonaws.com/"). -define(IAM_AWS_VERSION, "2011-06-15"). @@ -46,14 +47,15 @@ credentials(AccessKeyId, SecretAccessKey) -> 'ok' = application:set_env('iam', 'accesskeyid', AccessKeyId), 'ok' = application:set_env('iam', 'secretaccesskey', SecretAccessKey). --spec credentials() -> {string(), string()}. +-spec credentials() -> {'ok', string(), string()}. credentials() -> {'ok', AccessKeyId} = application:get_env('iam', 'accesskeyid'), {'ok', SecretAccessKey} = application:get_env('iam', 'secretaccesskey'), {'ok', AccessKeyId, SecretAccessKey}. --spec token(pos_integer()) -> {'ok', string(), string(), string()} | +-spec token(pos_integer()) -> {'ok', string(), string(), string()} | + {'error', 'maximum_retries_reached'} | {'error', string(), string()}. token(Duration) @@ -75,8 +77,9 @@ token(Duration) {'error', Code, Message} end. --spec request(string(), string(), non_neg_integer()) -> {'ok', string()} | - {'error', string()}. +-spec request(string(), string(), non_neg_integer()) -> {'ok', #xmlElement{}} | + {'error', 'maximum_retries_reached'} | + {'error', #xmlElement{}}. request(Action, Endpoint, Duration) -> {'ok', AccessKeyId, SecretAccessKey} = credentials(),