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
9e2ef543
Commit
9e2ef543
authored
Nov 26, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3343 from mtanda/cloudwatch_fix_credential_check
(cloudwatch) fix EC2RoleProvider parameter
parents
85382dc2
2aabb387
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
pkg/api/cloudwatch/cloudwatch.go
+15
-3
No files found.
pkg/api/cloudwatch/cloudwatch.go
View file @
9e2ef543
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2"
...
@@ -40,11 +41,12 @@ func init() {
...
@@ -40,11 +41,12 @@ func init() {
}
}
func
handleGetMetricStatistics
(
req
*
cwRequest
,
c
*
middleware
.
Context
)
{
func
handleGetMetricStatistics
(
req
*
cwRequest
,
c
*
middleware
.
Context
)
{
sess
:=
session
.
New
()
creds
:=
credentials
.
NewChainCredentials
(
creds
:=
credentials
.
NewChainCredentials
(
[]
credentials
.
Provider
{
[]
credentials
.
Provider
{
&
credentials
.
EnvProvider
{},
&
credentials
.
EnvProvider
{},
&
credentials
.
SharedCredentialsProvider
{
Filename
:
""
,
Profile
:
req
.
DataSource
.
Database
},
&
credentials
.
SharedCredentialsProvider
{
Filename
:
""
,
Profile
:
req
.
DataSource
.
Database
},
&
ec2rolecreds
.
EC2RoleProvider
{
ExpiryWindow
:
5
*
time
.
Minute
},
&
ec2rolecreds
.
EC2RoleProvider
{
Client
:
ec2metadata
.
New
(
sess
),
ExpiryWindow
:
5
*
time
.
Minute
},
})
})
cfg
:=
&
aws
.
Config
{
cfg
:=
&
aws
.
Config
{
...
@@ -87,11 +89,12 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) {
...
@@ -87,11 +89,12 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) {
}
}
func
handleListMetrics
(
req
*
cwRequest
,
c
*
middleware
.
Context
)
{
func
handleListMetrics
(
req
*
cwRequest
,
c
*
middleware
.
Context
)
{
sess
:=
session
.
New
()
creds
:=
credentials
.
NewChainCredentials
(
creds
:=
credentials
.
NewChainCredentials
(
[]
credentials
.
Provider
{
[]
credentials
.
Provider
{
&
credentials
.
EnvProvider
{},
&
credentials
.
EnvProvider
{},
&
credentials
.
SharedCredentialsProvider
{
Filename
:
""
,
Profile
:
req
.
DataSource
.
Database
},
&
credentials
.
SharedCredentialsProvider
{
Filename
:
""
,
Profile
:
req
.
DataSource
.
Database
},
&
ec2rolecreds
.
EC2RoleProvider
{
ExpiryWindow
:
5
*
time
.
Minute
},
&
ec2rolecreds
.
EC2RoleProvider
{
Client
:
ec2metadata
.
New
(
sess
),
ExpiryWindow
:
5
*
time
.
Minute
},
})
})
cfg
:=
&
aws
.
Config
{
cfg
:=
&
aws
.
Config
{
...
@@ -126,8 +129,17 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) {
...
@@ -126,8 +129,17 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) {
}
}
func
handleDescribeInstances
(
req
*
cwRequest
,
c
*
middleware
.
Context
)
{
func
handleDescribeInstances
(
req
*
cwRequest
,
c
*
middleware
.
Context
)
{
sess
:=
session
.
New
()
creds
:=
credentials
.
NewChainCredentials
(
[]
credentials
.
Provider
{
&
credentials
.
EnvProvider
{},
&
credentials
.
SharedCredentialsProvider
{
Filename
:
""
,
Profile
:
req
.
DataSource
.
Database
},
&
ec2rolecreds
.
EC2RoleProvider
{
Client
:
ec2metadata
.
New
(
sess
),
ExpiryWindow
:
5
*
time
.
Minute
},
})
cfg
:=
&
aws
.
Config
{
cfg
:=
&
aws
.
Config
{
Region
:
aws
.
String
(
req
.
Region
),
Region
:
aws
.
String
(
req
.
Region
),
Credentials
:
creds
,
}
}
svc
:=
ec2
.
New
(
session
.
New
(
cfg
),
cfg
)
svc
:=
ec2
.
New
(
session
.
New
(
cfg
),
cfg
)
...
...
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