Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
d1ccf832
Commit
d1ccf832
authored
Nov 20, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(cloudwatch) use paging
parent
28968144
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
pkg/api/cloudwatch/cloudwatch.go
+19
-2
No files found.
pkg/api/cloudwatch/cloudwatch.go
View file @
d1ccf832
...
...
@@ -7,6 +7,7 @@ import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
...
...
@@ -119,7 +120,15 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) {
Dimensions
:
reqParam
.
Parameters
.
Dimensions
,
}
resp
,
err
:=
svc
.
ListMetrics
(
params
)
var
resp
cloudwatch
.
ListMetricsOutput
err
:=
svc
.
ListMetricsPages
(
params
,
func
(
page
*
cloudwatch
.
ListMetricsOutput
,
lastPage
bool
)
bool
{
metrics
,
_
:=
awsutil
.
ValuesAtPath
(
page
,
"Metrics"
)
for
_
,
metric
:=
range
metrics
{
resp
.
Metrics
=
append
(
resp
.
Metrics
,
metric
.
(
*
cloudwatch
.
Metric
))
}
return
!
lastPage
})
if
err
!=
nil
{
c
.
JsonApiErr
(
500
,
"Unable to call AWS API"
,
err
)
return
...
...
@@ -160,7 +169,15 @@ func handleDescribeInstances(req *cwRequest, c *middleware.Context) {
params
.
InstanceIds
=
reqParam
.
Parameters
.
InstanceIds
}
resp
,
err
:=
svc
.
DescribeInstances
(
params
)
var
resp
ec2
.
DescribeInstancesOutput
err
:=
svc
.
DescribeInstancesPages
(
params
,
func
(
page
*
ec2
.
DescribeInstancesOutput
,
lastPage
bool
)
bool
{
reservations
,
_
:=
awsutil
.
ValuesAtPath
(
page
,
"Reservations"
)
for
_
,
reservation
:=
range
reservations
{
resp
.
Reservations
=
append
(
resp
.
Reservations
,
reservation
.
(
*
ec2
.
Reservation
))
}
return
!
lastPage
})
if
err
!=
nil
{
c
.
JsonApiErr
(
500
,
"Unable to call AWS API"
,
err
)
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment