mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Allow Firehose authentication using sts credentials (#2034)
This commit is contained in:
parent
75868a7005
commit
ad12ee4db4
2 changed files with 13 additions and 4 deletions
2
Gopkg.lock
generated
2
Gopkg.lock
generated
|
|
@ -711,8 +711,10 @@
|
|||
"github.com/VividCortex/mysqlerr",
|
||||
"github.com/WatchBeam/clock",
|
||||
"github.com/aws/aws-sdk-go/aws",
|
||||
"github.com/aws/aws-sdk-go/aws/awserr",
|
||||
"github.com/aws/aws-sdk-go/aws/credentials",
|
||||
"github.com/aws/aws-sdk-go/aws/session",
|
||||
"github.com/aws/aws-sdk-go/service/firehose",
|
||||
"github.com/aws/aws-sdk-go/service/firehose/firehoseiface",
|
||||
"github.com/beevik/etree",
|
||||
"github.com/briandowns/spinner",
|
||||
|
|
|
|||
|
|
@ -34,10 +34,17 @@ type firehoseLogWriter struct {
|
|||
}
|
||||
|
||||
func NewFirehoseLogWriter(region, id, secret, stream string, logger log.Logger) (*firehoseLogWriter, error) {
|
||||
sess, err := session.NewSession(&aws.Config{
|
||||
Credentials: credentials.NewStaticCredentials(id, secret, ""),
|
||||
Region: ®ion,
|
||||
})
|
||||
conf := &aws.Config{
|
||||
Region: ®ion,
|
||||
}
|
||||
|
||||
// Only provide static credentials if we have them
|
||||
// otherwise use the default credentials provider chain
|
||||
if id != "" && secret != "" {
|
||||
conf.Credentials = credentials.NewStaticCredentials(id, secret, "")
|
||||
}
|
||||
|
||||
sess, err := session.NewSession(conf)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "create Firehose client")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue