chilts / awssum

(deprecated: use aws-sdk) Node.js modules for talking to lots of Web Service APIs.
Other
462 stars 57 forks source link

in CloudWatch.GetMetricStatistics, Unit is optional #137

Closed Rolandvl closed 11 years ago

Rolandvl commented 11 years ago

Hi,

According to the doc, the Unit param of GetMetricStatistic is optional, but you user 'required' to define it.

Roland.

techtribe commented 11 years ago

Apparantly you will need to add an unit before the call will be executed, while I am getting "Provide a Unit" error when skipping the Unit-param.

Please test yourself and you will find out that the documentation is contradicting itself many times...sad but true and there is no pattern to recognize. So test,...test,...,test... and so I can discover strange things that are important to a developer to use Awssum without strange hiccups.

See www.awssum.io for examples to test yourself.

FYI

Rolandvl commented 11 years ago

I' m sorry but by putting 'optional' in cloud watch-config.js at: ( I made the change locally)

GetMetricStatistics : { url : 'http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html', defaults : { Action : 'GetMetricStatistics', }, args : { Action : required, Dimensions : paramDataOptional, EndTime : required, MetricName : required, Namespace : required, Period : required, StartTime : required, Statistics : paramDataRequired, Unit : optional, }, },

I had no trouble when testing and AWS returns no errors...

I use it on to make a call with this params:

var HealthyHostCount = { EndTime : "2012-12-05T16:00:00.000Z", MetricName : "HealthyHostCount", Namespace : "AWS/ELB", Period : 300, StartTime : "2012-12-05T12:50:00.000Z", Statistics : [ 'Minimum' ], }

and it works fine...

techtribe commented 11 years ago

You are totally right, sorry for my mistake. I had mistaken the part @chilts checks the input and the AWS part. I've fixed it in the docs and master-branch. Will be added to next version of Awssum.

chilts commented 11 years ago

Thanks guys! :) Every fix like this make the library better ... many thanks!

Cheers, Andy