github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/providers/azure/network/network.go (about) 1 package network 2 3 import ( 4 defsecTypes "github.com/khulnasoft-lab/defsec/pkg/types" 5 ) 6 7 type Network struct { 8 SecurityGroups []SecurityGroup 9 NetworkWatcherFlowLogs []NetworkWatcherFlowLog 10 } 11 12 type SecurityGroup struct { 13 Metadata defsecTypes.Metadata 14 Rules []SecurityGroupRule 15 } 16 17 type SecurityGroupRule struct { 18 Metadata defsecTypes.Metadata 19 Outbound defsecTypes.BoolValue 20 Allow defsecTypes.BoolValue 21 SourceAddresses []defsecTypes.StringValue 22 SourcePorts []PortRange 23 DestinationAddresses []defsecTypes.StringValue 24 DestinationPorts []PortRange 25 Protocol defsecTypes.StringValue 26 } 27 28 type PortRange struct { 29 Metadata defsecTypes.Metadata 30 Start int 31 End int 32 } 33 34 func (r PortRange) Includes(port int) bool { 35 return port >= r.Start && port <= r.End 36 } 37 38 type NetworkWatcherFlowLog struct { 39 Metadata defsecTypes.Metadata 40 RetentionPolicy RetentionPolicy 41 } 42 43 type RetentionPolicy struct { 44 Metadata defsecTypes.Metadata 45 Enabled defsecTypes.BoolValue 46 Days defsecTypes.IntValue 47 }