forked from mirkokiefer/aws-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89a7716
commit 93eb2ea
Showing
1 changed file
with
6 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,22 @@ | ||
exports.init = function(genericAWSClient) { | ||
// Creates a Simple Queue Service API client | ||
var createSQSClient = function (accessKeyId, secretAccessKey, options) { | ||
return function (accessKeyId, secretAccessKey, options) { | ||
options = options || {}; | ||
var client = SQSClient({ | ||
var aws = genericAWSClient({ | ||
host: options.host || "sqs.us-east-1.amazonaws.com", | ||
path: options.path || "/", | ||
agent: options.agent, | ||
accessKeyId: accessKeyId, | ||
secretAccessKey: secretAccessKey, | ||
secure: options.secure, | ||
version: options.version | ||
}); | ||
return client; | ||
} | ||
// Amazon Simple Queue Service API client | ||
var SQSClient = function(obj) { | ||
var aws = genericAWSClient({ | ||
host: obj.host, path: obj.path, accessKeyId: obj.accessKeyId, | ||
secretAccessKey: obj.secretAccessKey, secure: obj.secure, agent:obj.agent | ||
agent: options.agent | ||
}) | ||
obj.call = function(action, query, callback) { | ||
var callFn = function(action, query, callback) { | ||
query["Action"] = action | ||
query["Version"] = obj.version || '2009-02-01' | ||
query["Version"] = options.version || '2009-02-01' | ||
query["SignatureMethod"] = "HmacSHA256" | ||
query["SignatureVersion"] = "2" | ||
return aws.call(action, query, callback); | ||
} | ||
return obj; | ||
return {call: callFn}; | ||
} | ||
return createSQSClient; | ||
} |