from a10sdk.common.A10BaseClass import A10BaseClass


class Waf(A10BaseClass):
    
    """Class Description::
    WAF related commands.

    Class waf supports CRUD Operations and inherits from `common/A10BaseClass`.
    This class is the `"PARENT"` class for this module.`

    :param template_list: {"minItems": 1, "items": {"type": "template"}, "uniqueItems": true, "array": [{"required": ["name"], "properties": {"log-succ-reqs": {"default": 0, "optional": true, "type": "number", "description": "Log successful waf requests", "format": "flag"}, "keep-end": {"description": "Number of unmasked characters at the end (default: 0)", "format": "number", "type": "number", "maximum": 65535, "minimum": 0, "optional": true}, "max-cookie-len": {"description": "Max Cookie length allowed in request (default 4096) (Maximum length of cookie allowed (default 4096))", "format": "number", "default": 4096, "optional": true, "maximum": 65535, "minimum": 0, "type": "number"}, "deploy-mode": {"description": "'active': Deploy WAF in active (blocking) mode; 'passive': Deploy WAF in passive (log-only) mode; 'learning': Deploy WAF in learning mode; ", "format": "enum", "default": "active", "type": "string", "enum": ["active", "passive", "learning"], "optional": true}, "xml-format-check": {"default": 0, "optional": true, "type": "number", "description": "Check HTTP body for XML format compliance", "format": "flag"}, "max-string": {"description": "Maximum length of a string in a JSON request body (default 64) (Maximum length of a JSON string (default 64))", "format": "number", "default": 64, "optional": true, "maximum": 4096, "minimum": 0, "type": "number"}, "ccn-mask": {"default": 0, "optional": true, "type": "number", "description": "Mask credit card numbers in response", "format": "flag"}, "waf-blist-file": {"description": "Name of WAF policy list file", "format": "string", "minLength": 1, "optional": true, "maxLength": 128, "type": "string"}, "form-set-no-cache": {"default": 0, "optional": true, "type": "number", "description": "Disable caching of form-containing responses", "format": "flag"}, "http-redirect": {"description": "Send HTTP redirect response (302 Found) to specifed URL (URL to redirect to when denying request)", "format": "string-rlx", "minLength": 1, "not-list": ["http-resp-200", "reset-conn", "http-resp-403"], "optional": true, "maxLength": 255, "type": "string"}, "bot-check": {"default": 0, "optional": true, "type": "number", "description": "Check User-Agent for known bots", "format": "flag"}, "max-cookies-len": {"description": "Max Total Cookies length allowed in request (default 4096) (Maximum total length of cookies allowed (default 4096))", "format": "number", "default": 4096, "optional": true, "maximum": 65535, "minimum": 0, "type": "number"}, "url-check": {"default": 0, "optional": true, "type": "number", "description": "Check URL against list of previously learned URLs", "format": "flag"}, "max-parameter-value-len": {"description": "Max HTML parameter value length in an HTTP request (default 4096) (Maximum HTML parameter value in an HTTP request (default 4096))", "format": "number", "default": 4096, "optional": true, "maximum": 102400000, "minimum": 0, "type": "number"}, "max-entities": {"description": "Maximum number of MIME entities allowed in request (default 10)", "format": "number", "default": 10, "optional": true, "maximum": 63, "minimum": 0, "type": "number"}, "hide-resp-codes": {"default": 0, "optional": true, "type": "number", "description": "Hides response codes that are not allowed (default 4xx, 5xx)", "format": "flag"}, "max-depth": {"description": "Maximum recursion depth in a value in a JSON requesnt body (default 16) (Maximum recursion depth in a JSON value (default 16))", "format": "number", "default": 16, "optional": true, "maximum": 4096, "minimum": 0, "type": "number"}, "hide-resp-codes-file": {"description": "Name of WAF policy list file", "format": "string", "minLength": 1, "optional": true, "maxLength": 128, "type": "string"}, "max-elem-name-len": {"description": "Maximum length for an element name (default 128)", "format": "number", "default": 128, "optional": true, "maximum": 65535, "minimum": 0, "type": "number"}, "deny-password-autocomplete": {"default": 0, "optional": true, "type": "number", "description": "Check to protect against server-generated form which contain password fields that allow autocomplete", "format": "flag"}, "name": {"description": "WAF Template Name", "format": "string", "minLength": 1, "optional": false, "maxLength": 63, "type": "string"}, "http-resp-200": {"description": "Send HTTP response with status code 200 OK", "format": "flag", "default": 0, "optional": true, "not-list": ["http-redirect", "reset-conn", "http-resp-403"], "type": "number"}, "keep-start": {"description": "Number of unmasked characters at the beginning (default: 0)", "format": "number", "type": "number", "maximum": 65535, "minimum": 0, "optional": true}, "redirect-wlist": {"default": 0, "optional": true, "type": "number", "description": "Check Redirect URL against list of previously learned redirects", "format": "flag"}, "max-cookie-value-len": {"description": "Max Cookie Value length allowed in request (default 4096) (Maximum length of cookie value allowed (default 4096))", "format": "number", "default": 4096, "optional": true, "maximum": 65535, "minimum": 0, "type": "number"}, "max-cdata-len": {"description": "Maximum length of an CDATA section of an element (default 65535)", "format": "number", "default": 65535, "optional": true, "maximum": 65535, "minimum": 0, "type": "number"}, "max-hdr-value-len": {"description": "Max header value length allowed in request (default 4096) (Maximum length of header value allowed (default 4096))", "format": "number", "default": 4096, "optional": true, "maximum": 65535, "minimum": 0, "type": "number"}, "secret-encrypted": {"description": "Do NOT use this option manually. (This is an A10 reserved keyword.) (The ENCRYPTED secret string)", "format": "encrypted", "minLength": 1, "optional": true, "maxLength": 255, "type": "encrypted"}, "cookie-name": {"description": "Cookie name (simple string or PCRE pattern)", "format": "string-rlx", "minLength": 1, "optional": true, "maxLength": 63, "type": "string"}, "max-namespace-uri-len": {"description": "Maximum length of a namespace URI (default 256)", "format": "number", "default": 256, "optional": true, "maximum": 1024, "minimum": 0, "type": "number"}, "resp-url-403": {"description": "Response content to send client when denying request", "format": "string-rlx", "minLength": 1, "optional": true, "maxLength": 255, "type": "string"}, "csrf-check": {"default": 0, "optional": true, "type": "number", "description": "Tag the form to protect against Cross-site Request Forgery", "format": "flag"}, "referer-domain-list": {"description": "List of referer domains allowed", "format": "string-rlx", "minLength": 1, "optional": true, "maxLength": 255, "not": "referer-domain-list-only", "type": "string"}, "max-parameters": {"description": "Maximum number of HTML parameters allowed in request (default 64)", "format": "number", "default": 64, "optional": true, "maximum": 1024, "minimum": 0, "type": "number"}, "max-parameter-name-len": {"description": "Max HTML parameter name length in an HTTP request (default 256) (Maximum HTML parameter name length in an HTTP request (default 256))", "format": "number", "default": 256, "optional": true, "maximum": 1024, "minimum": 0, "type": "number"}, "deny-non-masked-passwords": {"default": 0, "optional": true, "type": "number", "description": "Denies forms that have a password field with a textual type, resulting in this field not being masked", "format": "flag"}, "max-hdr-name-len": {"description": "Max header name length allowed in request (default 63) (Maximum length of header name allowed (default 63))", "format": "number", "default": 63, "optional": true, "maximum": 63, "minimum": 0, "type": "number"}, "max-elem-depth": {"description": "Maximum recursion level for element definition (default 256)", "format": "number", "default": 256, "optional": true, "maximum": 4096, "minimum": 0, "type": "number"}, "form-consistency-check": {"default": 0, "optional": true, "type": "number", "description": "Form input consistency check", "format": "flag"}, "max-hdrs": {"description": "Maximum number of headers allowed in request (default 20)", "format": "number", "default": 20, "optional": true, "maximum": 255, "minimum": 0, "type": "number"}, "xml-xss-check": {"default": 0, "optional": true, "type": "number", "description": "Check XML data against XSS policy", "format": "flag"}, "referer-check": {"default": 0, "optional": true, "type": "number", "description": "Check referer to protect against CSRF attacks", "format": "flag"}, "wsdl-resp-val-file": {"description": "Specify name of WSDL file for verifying XML body contents", "format": "string", "minLength": 1, "optional": true, "maxLength": 63, "not": "wsdl-file", "type": "string"}, "logging": {"description": "Logging template (Logging Config name)", "format": "string", "minLength": 1, "optional": true, "maxLength": 128, "type": "string", "$ref": "/axapi/v3/slb/template/logging"}, "max-namespace": {"description": "Maximum number of namespace declarations (default 16)", "format": "number", "default": 16, "optional": true, "maximum": 256, "minimum": 0, "type": "number"}, "max-entity-exp": {"description": "Maximum number of entity expansions (default 1024)", "format": "number", "default": 1024, "optional": true, "maximum": 1024, "minimum": 0, "type": "number"}, "form-deny-non-post": {"default": 0, "optional": true, "type": "number", "description": "Deny request with forms if the method is not POST", "format": "flag"}, "cookie-encryption-secret": {"description": "Cookie encryption secret", "format": "password", "minLength": 1, "optional": true, "maxLength": 128, "type": "string"}, "decode-escaped-chars": {"default": 0, "optional": true, "type": "number", "description": "Decode escaped characters such as \\r \\n \\\" \\xXX \\u00YY in internal url", "format": "flag"}, "json-format-check": {"default": 0, "optional": true, "type": "number", "description": "Check HTTP body for JSON format compliance", "format": "flag"}, "bot-check-policy-file": {"description": "Name of WAF policy list file", "format": "string", "minLength": 1, "optional": true, "maxLength": 128, "type": "string"}, "xml-schema-resp-val-file": {"description": "Specify name of XML-Schema file for verifying XML body contents", "format": "string", "minLength": 1, "optional": true, "maxLength": 63, "not": "xml-schema-file", "type": "string"}, "allowed-http-methods": {"description": "List of allowed HTTP methods. Default is \"GET POST\". (List of HTTP methods allowed (default \"GET POST\"))", "format": "string-rlx", "default": "GET POST", "minLength": 1, "optional": true, "maxLength": 255, "type": "string"}, "remove-selfref": {"default": 0, "optional": true, "type": "number", "description": "Remove self-references such as /./ and /path/../ from internal url", "format": "flag"}, "max-elem-child": {"description": "Maximum number of children of an XML element (default 1024)", "format": "number", "default": 1024, "optional": true, "maximum": 4096, "minimum": 0, "type": "number"}, "max-entity-exp-depth": {"description": "Maximum nested depth of entity expansion (default 32)", "format": "number", "default": 32, "optional": true, "maximum": 32, "minimum": 0, "type": "number"}, "max-array-value-count": {"description": "Maximum number of values in an array in a JSON request body (default 256) (Maximum number of values in a JSON array (default 256))", "format": "number", "default": 256, "optional": true, "maximum": 4096, "minimum": 0, "type": "number"}, "max-elem": {"description": "Maximum number of XML elements (default 1024)", "format": "number", "default": 1024, "optional": true, "maximum": 8192, "minimum": 0, "type": "number"}, "sqlia-check": {"optional": true, "enum": ["reject", "sanitize"], "type": "string", "description": "'reject': Reject requests with SQLIA patterns; 'sanitize': Remove bad SQL from request; ", "format": "enum"}, "max-object-member-count": {"description": "Maximum number of members in an object in a JSON request body (default 256) (Maximum number of members in a JSON object (default 256))", "format": "number", "default": 256, "optional": true, "maximum": 4096, "minimum": 0, "type": "number"}, "http-resp-403": {"description": "Send HTTP response with status code 403 Forbidden (default)", "format": "flag", "default": 0, "optional": true, "not-list": ["http-redirect", "http-resp-200", "reset-conn"], "type": "number"}, "http-check": {"default": 0, "optional": true, "type": "number", "description": "Check request for HTTP protocol compliance", "format": "flag"}, "max-cookie-name-len": {"description": "Max Cookie Name length allowed in request (default 64) ( Maximum length of cookie name allowed (default 64))", "format": "number", "default": 64, "optional": true, "maximum": 65535, "minimum": 0, "type": "number"}, "remove-comments": {"default": 0, "optional": true, "type": "number", "description": "Remove comments from internal url", "format": "flag"}, "uri-wlist-check": {"default": 0, "optional": true, "type": "number", "description": "specify name of WAF policy list file to whitelist", "format": "flag"}, "form-deny-non-ssl": {"default": 0, "optional": true, "type": "number", "description": "Deny request with forms if the protocol is not SSL", "format": "flag"}, "xss-check": {"optional": true, "enum": ["reject", "sanitize"], "type": "string", "description": "'reject': Reject requests with bad cookies; 'sanitize': Remove bad cookies from request; ", "format": "enum"}, "reset-conn": {"description": "Reset the client connection", "format": "flag", "default": 0, "optional": true, "not-list": ["http-redirect", "http-resp-200", "http-resp-403"], "type": "number"}, "referer-safe-url": {"description": " Safe URL to redirect to if referer is missing", "format": "string-rlx", "minLength": 1, "optional": true, "maxLength": 255, "type": "string"}, "max-attr-name-len": {"description": "Maximum length of an attribute name (default 128)", "format": "number", "default": 128, "optional": true, "maximum": 2048, "minimum": 0, "type": "number"}, "uri-blist-check": {"default": 0, "optional": true, "type": "number", "description": "specify name of WAF policy list file to blacklist", "format": "flag"}, "max-url-len": {"description": "Max URL length allowed in request (default 1024) (Maximum length of URL allowed (default 1024))", "format": "number", "default": 1024, "optional": true, "maximum": 16127, "minimum": 0, "type": "number"}, "max-hdrs-len": {"description": "Max headers length allowed in request (default 4096) (Maximum length of headers allowed (default 4096))", "format": "number", "default": 4096, "optional": true, "maximum": 65535, "minimum": 0, "type": "number"}, "waf-wlist-file": {"description": "Name of WAF policy list file", "format": "string", "minLength": 1, "optional": true, "maxLength": 128, "type": "string"}, "remove-spaces": {"default": 0, "optional": true, "type": "number", "description": "Remove spaces from internal url", "format": "flag"}, "lifetime": {"description": "Session lifetime in minutes (default 10)", "format": "number", "type": "number", "maximum": 1440, "minimum": 1, "optional": true}, "max-attr": {"description": "Maximum number of attributes of an XML element (default 256)", "format": "number", "default": 256, "optional": true, "maximum": 256, "minimum": 0, "type": "number"}, "xss-check-policy-file": {"description": "Name of WAF policy list file", "format": "string", "minLength": 1, "optional": true, "maxLength": 128, "type": "string"}, "resp-url-200": {"description": "Response content to send client when denying request", "format": "string-rlx", "minLength": 1, "optional": true, "maxLength": 255, "type": "string"}, "max-post-size": {"description": "Max content length allowed in POST request (default 20480) (Maximum size allowed content in an HTTP POST request (default 20480))", "format": "number", "default": 20480, "optional": true, "maximum": 2147483647, "minimum": 0, "type": "number"}, "decode-hex-chars": {"default": 0, "optional": true, "type": "number", "description": "Decode hex chars such as \\%xx and \\%u00yy in internal url", "format": "flag"}, "max-line-len": {"description": "Max Line length allowed in request (default 1024) (Maximum length of Request line allowed (default 1024))", "format": "number", "default": 1024, "optional": true, "maximum": 16127, "minimum": 0, "type": "number"}, "max-query-len": {"description": "Max Query length allowed in request (default 1024) (Maximum length of Request query allowed (default 1024))", "format": "number", "default": 1024, "optional": true, "maximum": 16127, "minimum": 0, "type": "number"}, "sqlia-check-policy-file": {"description": "Name of WAF policy list file", "format": "string", "minLength": 1, "optional": true, "maxLength": 128, "type": "string"}, "deny-non-ssl-passwords": {"default": 0, "optional": true, "type": "number", "description": "Denies any form that has a password field if the form is not sent over an SSL connection", "format": "flag"}, "max-data-parse": {"description": "Max data parsed for Web Application Firewall (default 65536) (Maximum data parsed for Web Application Firewall (default 65536))", "format": "number", "default": 65536, "optional": true, "maximum": 1048575, "minimum": 0, "type": "number"}, "max-parameter-total-len": {"description": "Max HTML parameter tatal length in an HTTP request (default 4096) (Maximum HTML parameter total length in an HTTP request (default 4096))", "format": "number", "default": 4096, "optional": true, "maximum": 102400000, "minimum": 0, "type": "number"}, "wsdl-file": {"description": "Specify name of WSDL file for verifying XML body contents", "format": "string", "minLength": 1, "optional": true, "maxLength": 63, "not": "wsdl-resp-val-file", "type": "string"}, "session-check": {"default": 0, "optional": true, "type": "number", "description": "Enable session checking via session cookie", "format": "flag"}, "disable": {"default": 0, "optional": true, "type": "number", "description": "Disable buffer overflow protection", "format": "flag"}, "filter-resp-hdrs": {"default": 0, "optional": true, "type": "number", "description": "Removes web server's identifying headers", "format": "flag"}, "max-cookies": {"description": "Maximum number of cookies allowed in request (default 20)", "format": "number", "default": 20, "optional": true, "maximum": 63, "minimum": 0, "type": "number"}, "decode-entities": {"default": 0, "optional": true, "type": "number", "description": "Decode entities in internal url", "format": "flag"}, "mask": {"description": "Character to mask the matched pattern (default: X)", "format": "string", "minLength": 1, "optional": true, "maxLength": 1, "type": "string"}, "referer-domain-list-only": {"description": "List of referer domains allowed", "format": "string-rlx", "minLength": 1, "optional": true, "maxLength": 255, "not": "referer-domain-list", "type": "string"}, "max-attr-value-len": {"description": "Maximum length of an attribute text value (default 128)", "format": "number", "default": 128, "optional": true, "maximum": 4096, "minimum": 0, "type": "number"}, "pcre-mask": {"description": "Mask matched PCRE pattern in response", "format": "string-rlx", "minLength": 1, "optional": true, "maxLength": 63, "type": "string"}, "soap-format-check": {"default": 0, "optional": true, "type": "number", "description": "Check XML document for SOAP format compliance", "format": "flag"}, "xml-schema-file": {"description": "Specify name of XML-Schema file for verifying XML body contents", "format": "string", "minLength": 1, "optional": true, "maxLength": 63, "not": "xml-schema-resp-val-file", "type": "string"}, "ssn-mask": {"default": 0, "optional": true, "type": "number", "description": "Mask US Social Security numbers in response", "format": "flag"}, "xml-sqlia-check": {"default": 0, "optional": true, "type": "number", "description": "Check XML data against SQLIA policy", "format": "flag"}}}], "type": "array", "$ref": "/axapi/v3/waf/template/{name}"}
    :param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/device_proxy.py`

    

    URL for this object::
    `https://<Hostname|Ip address>//axapi/v3/waf`.

    

    
    """
    def __init__(self, **kwargs):
        self.ERROR_MSG = ""
        self.required=[]
        self.b_key = "waf"
        self.a10_url="/axapi/v3/waf"
        self.DeviceProxy = ""
        self.policy = {}
        self.wsdl = {}
        self.template_list = []
        self.xml_schema = {}

        for keys, value in kwargs.items():
            setattr(self,keys, value)


