handle sts error (#7088)

This commit is contained in:
Mitsuhiro Tanda
2016-12-30 16:59:06 +01:00
committed by Torkel Ödegaard
parent 08bad530dc
commit 9855ea8c6c
2 changed files with 50 additions and 19 deletions
+6 -2
View File
@@ -248,9 +248,13 @@ func handleGetDimensions(req *cwRequest, c *middleware.Context) {
}
func getAllMetrics(cwData *datasourceInfo) (cloudwatch.ListMetricsOutput, error) {
creds, err := getCredentials(cwData)
if err != nil {
return cloudwatch.ListMetricsOutput{}, err
}
cfg := &aws.Config{
Region: aws.String(cwData.Region),
Credentials: getCredentials(cwData),
Credentials: creds,
}
svc := cloudwatch.New(session.New(cfg), cfg)
@@ -260,7 +264,7 @@ func getAllMetrics(cwData *datasourceInfo) (cloudwatch.ListMetricsOutput, error)
}
var resp cloudwatch.ListMetricsOutput
err := svc.ListMetricsPages(params,
err = svc.ListMetricsPages(params,
func(page *cloudwatch.ListMetricsOutput, lastPage bool) bool {
metrics.M_Aws_CloudWatch_ListMetrics.Inc(1)
metrics, _ := awsutil.ValuesAtPath(page, "Metrics")