forked from gruntwork-io/cloud-nuke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelb_types.go
42 lines (33 loc) · 1003 Bytes
/
elb_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
package aws
import (
awsgo "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/gruntwork-io/gruntwork-cli/errors"
)
// LoadBalancers - represents all load balancers
type LoadBalancers struct {
Names []string
}
// ResourceName - the simple name of the aws resource
func (balancer LoadBalancers) ResourceName() string {
return "elb"
}
// ResourceIdentifiers - The names of the load balancers
func (balancer LoadBalancers) ResourceIdentifiers() []string {
return balancer.Names
}
func (balancer LoadBalancers) MaxBatchSize() int {
// Tentative batch size to ensure AWS doesn't throttle
return 200
}
// Nuke - nuke 'em all!!!
func (balancer LoadBalancers) Nuke(session *session.Session, identifiers []string) error {
if err := nukeAllElbInstances(session, awsgo.StringSlice(identifiers)); err != nil {
return errors.WithStackTrace(err)
}
return nil
}
type ElbDeleteError struct{}
func (e ElbDeleteError) Error() string {
return "ELB was not deleted"
}