-
-
Notifications
You must be signed in to change notification settings - Fork 354
/
guardduty_types.go
48 lines (38 loc) · 1.04 KB
/
guardduty_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package resources
import (
"context"
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/guardduty"
"github.com/aws/aws-sdk-go/service/guardduty/guarddutyiface"
"github.com/gruntwork-io/cloud-nuke/config"
)
type GuardDuty struct {
BaseAwsResource
Client guarddutyiface.GuardDutyAPI
Region string
detectorIds []string
}
func (gd *GuardDuty) Init(session *session.Session) {
gd.Client = guardduty.New(session)
}
func (gd *GuardDuty) ResourceName() string {
return "guardduty"
}
func (gd *GuardDuty) ResourceIdentifiers() []string {
return gd.detectorIds
}
func (gd *GuardDuty) MaxBatchSize() int {
return 10
}
func (gd *GuardDuty) GetAndSetIdentifiers(c context.Context, configObj config.Config) ([]string, error) {
identifiers, err := gd.getAll(c, configObj)
if err != nil {
return nil, err
}
gd.detectorIds = awsgo.StringValueSlice(identifiers)
return gd.detectorIds, nil
}
func (gd *GuardDuty) Nuke(detectorIds []string) error {
return gd.nukeAll(detectorIds)
}