forked from kubernetes-sigs/aws-load-balancer-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
defaults.go
53 lines (51 loc) · 1.42 KB
/
defaults.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
package throttle
import (
"github.com/aws/aws-sdk-go/service/elbv2"
"github.com/aws/aws-sdk-go/service/wafregional"
"github.com/aws/aws-sdk-go/service/wafv2"
"golang.org/x/time/rate"
"regexp"
)
// NewDefaultServiceOperationsThrottleConfig returns a ServiceOperationsThrottleConfig with default settings.
func NewDefaultServiceOperationsThrottleConfig() *ServiceOperationsThrottleConfig {
return &ServiceOperationsThrottleConfig{
value: map[string][]throttleConfig{
wafregional.ServiceID: {
{
operationPtn: regexp.MustCompile("^AssociateWebACL|DisassociateWebACL"),
r: rate.Limit(0.5),
burst: 1,
},
{
operationPtn: regexp.MustCompile("^GetWebACLForResource|ListResourcesForWebACL"),
r: rate.Limit(1),
burst: 1,
},
},
wafv2.ServiceID: {
{
operationPtn: regexp.MustCompile("^AssociateWebACL|DisassociateWebACL"),
r: rate.Limit(0.5),
burst: 1,
},
{
operationPtn: regexp.MustCompile("^GetWebACLForResource|ListResourcesForWebACL"),
r: rate.Limit(1),
burst: 1,
},
},
elbv2.ServiceID: {
{
operationPtn: regexp.MustCompile("^RegisterTargets|^DeregisterTargets"),
r: rate.Limit(4),
burst: 20,
},
{
operationPtn: regexp.MustCompile(".*"),
r: rate.Limit(10),
burst: 40,
},
},
},
}
}