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
Showing
3 changed files
with
42 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var aws = require("aws-lib"); | ||
|
||
elb = aws.createELBClient(yourAccessKeyId, yourSecretAccessKey); | ||
|
||
elb.call("DescribeLoadBalancers", {}, function(result) { | ||
console.log(JSON.stringify(result, null, 2)); | ||
}) |
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
exports.init = function(genericAWSClient) { | ||
// Creates an ELB API client | ||
var createELBClient = function (accessKeyId, secretAccessKey, options) { | ||
options = options || {}; | ||
|
||
var client = elbClient({ | ||
host: options.host || "elasticloadbalancing.amazonaws.com", | ||
path: options.path || "/", | ||
accessKeyId: accessKeyId, | ||
secretAccessKey: secretAccessKey, | ||
secure: options.secure, | ||
version: options.version | ||
}); | ||
return client; | ||
} | ||
// Amazon ELB API handler which is wrapped around the genericAWSClient | ||
var elbClient = function(obj) { | ||
var aws = genericAWSClient({ | ||
host: obj.host, path: obj.path, accessKeyId: obj.accessKeyId, | ||
secretAccessKey: obj.secretAccessKey, secure: obj.secure | ||
}); | ||
obj.call = function(action, query, callback) { | ||
query["Action"] = action | ||
query["Version"] = obj.version || '2010-07-01' | ||
query["SignatureMethod"] = "HmacSHA256" | ||
query["SignatureVersion"] = "2" | ||
return aws.call(action, query, callback); | ||
} | ||
return obj; | ||
} | ||
return createELBClient; | ||
} |