-
Notifications
You must be signed in to change notification settings - Fork 1
/
perspective.go
44 lines (41 loc) · 1.68 KB
/
perspective.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
package aws
type perspective struct {
securityGroupRules func(sg SecurityGroup) []SecurityGroupRule
securityGroupRuleDirection securityGroupRuleDirection
networkACLRulesForForwardTraffic func(nacl NetworkACL) []NetworkACLRule
networkACLRuleDirectionForForwardTraffic networkACLRuleDirection
networkACLRulesForReturnTraffic func(nacl NetworkACL) []NetworkACLRule
networkACLRuleDirectionForReturnTraffic networkACLRuleDirection
}
func newPerspectiveSourceOriented() perspective {
return perspective{
securityGroupRules: func(sg SecurityGroup) []SecurityGroupRule {
return sg.OutboundRules
},
securityGroupRuleDirection: securityGroupRuleDirectionOutbound,
networkACLRulesForForwardTraffic: func(nacl NetworkACL) []NetworkACLRule {
return nacl.OutboundRules
},
networkACLRuleDirectionForForwardTraffic: networkACLRuleDirectionOutbound,
networkACLRulesForReturnTraffic: func(nacl NetworkACL) []NetworkACLRule {
return nacl.InboundRules
},
networkACLRuleDirectionForReturnTraffic: networkACLRuleDirectionInbound,
}
}
func newPerspectiveDestinationOriented() perspective {
return perspective{
securityGroupRules: func(sg SecurityGroup) []SecurityGroupRule {
return sg.InboundRules
},
securityGroupRuleDirection: securityGroupRuleDirectionInbound,
networkACLRulesForForwardTraffic: func(nacl NetworkACL) []NetworkACLRule {
return nacl.InboundRules
},
networkACLRuleDirectionForForwardTraffic: networkACLRuleDirectionInbound,
networkACLRulesForReturnTraffic: func(nacl NetworkACL) []NetworkACLRule {
return nacl.OutboundRules
},
networkACLRuleDirectionForReturnTraffic: networkACLRuleDirectionOutbound,
}
}