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
9ae6ac25
Commit
9ae6ac25
authored
Sep 26, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor dataproxy_cloudwatch
parent
01ec8d0b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
26 deletions
+6
-26
pkg/api/dataproxy_cloudwatch.go
+6
-26
No files found.
pkg/api/dataproxy_cloudwatch.go
View file @
9ae6ac25
...
...
@@ -33,8 +33,8 @@ func ProxyCloudWatchDataSourceRequest(c *middleware.Context) {
Parameters
struct
{
Namespace
string
`json:"Namespace"`
MetricName
string
`json:"MetricName"`
Dimensions
[]
map
[
string
]
string
`json:"Dimensions"`
Statistics
[]
string
`json:"Statistics"`
Dimensions
[]
*
cloudwatch
.
Dimension
`json:"Dimensions"`
Statistics
[]
*
string
`json:"Statistics"`
StartTime
int64
`json:"StartTime"`
EndTime
int64
`json:"EndTime"`
Period
int64
`json:"Period"`
...
...
@@ -42,23 +42,11 @@ func ProxyCloudWatchDataSourceRequest(c *middleware.Context) {
}{}
json
.
Unmarshal
([]
byte
(
body
),
reqParam
)
statistics
:=
make
([]
*
string
,
0
)
for
k
:=
range
reqParam
.
Parameters
.
Statistics
{
statistics
=
append
(
statistics
,
&
reqParam
.
Parameters
.
Statistics
[
k
])
}
dimensions
:=
make
([]
*
cloudwatch
.
Dimension
,
0
)
for
_
,
d
:=
range
reqParam
.
Parameters
.
Dimensions
{
dimensions
=
append
(
dimensions
,
&
cloudwatch
.
Dimension
{
Name
:
aws
.
String
(
d
[
"Name"
]),
Value
:
aws
.
String
(
d
[
"Value"
]),
})
}
params
:=
&
cloudwatch
.
GetMetricStatisticsInput
{
Namespace
:
aws
.
String
(
reqParam
.
Parameters
.
Namespace
),
MetricName
:
aws
.
String
(
reqParam
.
Parameters
.
MetricName
),
Dimensions
:
d
imensions
,
Statistics
:
s
tatistics
,
Dimensions
:
reqParam
.
Parameters
.
D
imensions
,
Statistics
:
reqParam
.
Parameters
.
S
tatistics
,
StartTime
:
aws
.
Time
(
time
.
Unix
(
reqParam
.
Parameters
.
StartTime
,
0
)),
EndTime
:
aws
.
Time
(
time
.
Unix
(
reqParam
.
Parameters
.
EndTime
,
0
)),
Period
:
aws
.
Int64
(
reqParam
.
Parameters
.
Period
),
...
...
@@ -77,23 +65,15 @@ func ProxyCloudWatchDataSourceRequest(c *middleware.Context) {
Parameters
struct
{
Namespace
string
`json:"Namespace"`
MetricName
string
`json:"MetricName"`
Dimensions
[]
map
[
string
]
string
`json:"Dimensions"`
Dimensions
[]
*
cloudwatch
.
DimensionFilter
`json:"Dimensions"`
}
`json:"parameters"`
}{}
json
.
Unmarshal
([]
byte
(
body
),
reqParam
)
dimensions
:=
make
([]
*
cloudwatch
.
DimensionFilter
,
0
)
for
_
,
d
:=
range
reqParam
.
Parameters
.
Dimensions
{
dimensions
=
append
(
dimensions
,
&
cloudwatch
.
DimensionFilter
{
Name
:
aws
.
String
(
d
[
"Name"
]),
Value
:
aws
.
String
(
d
[
"Value"
]),
})
}
params
:=
&
cloudwatch
.
ListMetricsInput
{
Namespace
:
aws
.
String
(
reqParam
.
Parameters
.
Namespace
),
MetricName
:
aws
.
String
(
reqParam
.
Parameters
.
MetricName
),
Dimensions
:
d
imensions
,
Dimensions
:
reqParam
.
Parameters
.
D
imensions
,
}
resp
,
err
:=
svc
.
ListMetrics
(
params
)
...
...
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