-
Notifications
You must be signed in to change notification settings - Fork 80
/
nuker.go
executable file
·40 lines (34 loc) · 1.24 KB
/
nuker.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
package reset
import (
"github.com/rebuy-de/aws-nuke/cmd"
"github.com/rebuy-de/aws-nuke/pkg/awsutil"
"github.com/rebuy-de/aws-nuke/pkg/config"
)
// Nuker interface requires methods that are necessary to set up and
// execute a Nuke in an AWS Account.
type Nuker interface {
NewAccount(awsutil.Credentials) (*awsutil.Account, error)
Load(string) (*config.Nuke, error)
Run(*cmd.Nuke) error
}
// Nuke implements the NukeService interface using rebuy-de/aws-nuke
// https://github.com/rebuy-de/aws-nuke
type Nuke struct {
}
// NewAccount returns an aws-nuke Account that is created from the provided
// aws-nuke Credentials. This will provide the account information needed for
// aws-nuke to access an account to nuke.
func (nuke Nuke) NewAccount(creds awsutil.Credentials) (*awsutil.Account,
error) {
return awsutil.NewAccount(creds, config.CustomEndpoints{})
}
// Load returns an aws-nuke Nuke configuration with the provided configuration
// file. This will provide the information needed to know what can be nuked by
// aws-nuke.
func (nuke Nuke) Load(configPath string) (*config.Nuke, error) {
return config.Load(configPath)
}
// Run executes and returns the result of the aws-nuke nuke.
func (nuke Nuke) Run(cmd *cmd.Nuke) error {
return cmd.Run()
}