# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 25.0.0


from . import AWSObject
from . import AWSProperty
from troposphere import Tags
from .validators import boolean
from .validators import integer


class SubnetMapping(AWSProperty):
    props = {
        'SubnetId': (basestring, True),
    }


class Firewall(AWSObject):
    resource_type = "AWS::NetworkFirewall::Firewall"

    props = {
        'DeleteProtection': (boolean, False),
        'Description': (basestring, False),
        'FirewallName': (basestring, True),
        'FirewallPolicyArn': (basestring, True),
        'FirewallPolicyChangeProtection': (boolean, False),
        'SubnetChangeProtection': (boolean, False),
        'SubnetMappings': ([SubnetMapping], True),
        'Tags': (Tags, False),
        'VpcId': (basestring, True),
    }


class Dimension(AWSProperty):
    props = {
        'Value': (basestring, True),
    }


class PublishMetricAction(AWSProperty):
    props = {
        'Dimensions': ([Dimension], True),
    }


class ActionDefinition(AWSProperty):
    props = {
        'PublishMetricAction': (PublishMetricAction, False),
    }


class CustomAction(AWSProperty):
    props = {
        'ActionDefinition': (ActionDefinition, True),
        'ActionName': (basestring, True),
    }


class StatefulRuleGroupReference(AWSProperty):
    props = {
        'ResourceArn': (basestring, True),
    }


class StatelessRuleGroupReference(AWSProperty):
    props = {
        'Priority': (integer, True),
        'ResourceArn': (basestring, True),
    }


class FirewallPolicy(AWSProperty):
    props = {
        'StatefulRuleGroupReferences':
            ([StatefulRuleGroupReference], False),
        'StatelessCustomActions': ([CustomAction], False),
        'StatelessDefaultActions': ([basestring], True),
        'StatelessFragmentDefaultActions': ([basestring], True),
        'StatelessRuleGroupReferences':
            ([StatelessRuleGroupReference], False),
    }


class LogDestinationConfig(AWSProperty):
    props = {
        'LogDestination': (dict, True),
        'LogDestinationType': (basestring, True),
        'LogType': (basestring, True),
    }


class LoggingConfiguration(AWSProperty):
    props = {
        'LogDestinationConfigs': ([LogDestinationConfig], True),
    }


class RuleVariables(AWSProperty):
    props = {
        'IPSets': (dict, False),
        'PortSets': (dict, False),
    }


class RulesSourceList(AWSProperty):
    props = {
        'GeneratedRulesType': (basestring, True),
        'TargetTypes': ([basestring], True),
        'Targets': ([basestring], True),
    }


class Header(AWSProperty):
    props = {
        'Destination': (basestring, True),
        'DestinationPort': (basestring, True),
        'Direction': (basestring, True),
        'Protocol': (basestring, True),
        'Source': (basestring, True),
        'SourcePort': (basestring, True),
    }


class RuleOption(AWSProperty):
    props = {
        'Keyword': (basestring, True),
        'Settings': ([basestring], False),
    }


class StatefulRule(AWSProperty):
    props = {
        'Action': (basestring, True),
        'Header': (Header, True),
        'RuleOptions': ([RuleOption], True),
    }


class Address(AWSProperty):
    props = {
        'AddressDefinition': (basestring, True),
    }


class PortRange(AWSProperty):
    props = {
        'FromPort': (integer, True),
        'ToPort': (integer, True),
    }


class TCPFlagField(AWSProperty):
    props = {
        'Flags': ([basestring], True),
        'Masks': ([basestring], False),
    }


class MatchAttributes(AWSProperty):
    props = {
        'DestinationPorts': ([PortRange], False),
        'Destinations': ([Address], False),
        'Protocols': ([integer], False),
        'SourcePorts': ([PortRange], False),
        'Sources': ([Address], False),
        'TCPFlags': ([TCPFlagField], False),
    }


class RuleDefinition(AWSProperty):
    props = {
        'Actions': ([basestring], True),
        'MatchAttributes': (MatchAttributes, True),
    }


class StatelessRule(AWSProperty):
    props = {
        'Priority': (integer, True),
        'RuleDefinition': (RuleDefinition, True),
    }


class StatelessRulesAndCustomActions(AWSProperty):
    props = {
        'CustomActions': ([CustomAction], False),
        'StatelessRules': ([StatelessRule], True),
    }


class RulesSource(AWSProperty):
    props = {
        'RulesSourceList': (RulesSourceList, False),
        'RulesString': (basestring, False),
        'StatefulRules': ([StatefulRule], False),
        'StatelessRulesAndCustomActions':
            (StatelessRulesAndCustomActions, False),
    }


class RuleGroup(AWSProperty):
    props = {
        'RuleVariables': (RuleVariables, False),
        'RulesSource': (RulesSource, True),
    }
