-
-
Notifications
You must be signed in to change notification settings - Fork 354
/
s3_access_point_types.go
54 lines (43 loc) · 1.22 KB
/
s3_access_point_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
49
50
51
52
53
54
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/s3control"
"github.com/aws/aws-sdk-go/service/s3control/s3controliface"
"github.com/gruntwork-io/cloud-nuke/config"
"github.com/gruntwork-io/go-commons/errors"
)
type S3AccessPoint struct {
BaseAwsResource
Client s3controliface.S3ControlAPI
Region string
AccessPoints []string
AccountID *string
}
func (ap *S3AccessPoint) Init(session *session.Session) {
ap.Client = s3control.New(session)
}
func (ap *S3AccessPoint) ResourceName() string {
return "s3-ap"
}
func (ap *S3AccessPoint) ResourceIdentifiers() []string {
return ap.AccessPoints
}
func (ap *S3AccessPoint) MaxBatchSize() int {
return 5
}
func (ap *S3AccessPoint) GetAndSetIdentifiers(c context.Context, configObj config.Config) ([]string, error) {
identifiers, err := ap.getAll(c, configObj)
if err != nil {
return nil, err
}
ap.AccessPoints = awsgo.StringValueSlice(identifiers)
return ap.AccessPoints, nil
}
func (ap *S3AccessPoint) Nuke(identifiers []string) error {
if err := ap.nukeAll(awsgo.StringSlice(identifiers)); err != nil {
return errors.WithStackTrace(err)
}
return nil
}