Skip to content

Commit bcda3ba

Browse files
author
eversC
committed
Add key status to Datadog metric message
Add `IncludeInactiveKeys` bool to config
1 parent 789c58a commit bcda3ba

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pkg/config/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
//Config type
1616
type Config struct {
1717
IncludeAwsUserKeys bool
18+
IncludeInactiveKeys bool
1819
Datadog Datadog
1920
DatadogAPIKey string
2021
RotationMode bool

pkg/rotate/rotatekeys.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func validateFlags(account, provider, project string) (err error) {
6363
//keysOfProviders returns keys from all the configured providers that have passed
6464
// through filtering
6565
func keysOfProviders(account, provider, project string, c config.Config) (accountKeys []keys.Key, err error) {
66-
if accountKeys, err = keys.Keys(keyProviders(provider, project, c), false); err != nil {
66+
if accountKeys, err = keys.Keys(keyProviders(provider, project, c), c.IncludeInactiveKeys); err != nil {
6767
return
6868
}
6969
logger.Infof("Found %d keys in total", len(accountKeys))
@@ -408,6 +408,7 @@ func postMetric(keys []keys.Key, apiKey string, datadog config.Datadog) (err err
408408
`"environment:` + datadog.MetricEnv + `",` +
409409
`"key:` + key.Name + `",` +
410410
`"provider:` + key.Provider.Provider + `",` +
411+
`"status:"` + key.Status + `","` +
411412
`"account:` + key.Account +
412413
`"]}]}`)
413414
var req *http.Request

0 commit comments

Comments
 (0)