<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type


ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = r'''
---
module: bigip_firewall_dos_profile
short_description: Manage AFM DoS profiles on a BIG-IP
description:
  - Manages AFM Denial of Service (DoS) profiles on a BIG-IP. To manage the vectors
    associated with a DoS profile, refer to the C(bigip_firewall_dos_vector) module.
version_added: 2.7
options:
  name:
    description:
      - Specifies the name of the profile.
    required: True
  description:
    description:
      - The description of the DoS profile.
  default_whitelist:
    description:
      - The default whitelist address list for the system to use to determine which
        IP addresses are legitimate.
      - The system does not examine traffic from the IP addresses in the list when
        performing DoS prevention.
      - To define a new whitelist, use the C(bigip_firewall_address_list) module.
  threshold_sensitivity:
    description:
      - Specifies the threshold sensitivity for the DoS profile.
      - Thresholds for detecting attacks are higher when sensitivity is C(low), and
        lower when sensitivity is C(high).
      - When creating a new profile, if this parameter is not specified, the default
        is C(medium).
    choices:
      - low
      - medium
      - high
  partition:
    description:
      - Device partition to manage resources on.
    default: Common
  state:
    description:
      - When C(present), ensures that the resource exists.
      - When C(absent), ensures the resource is removed.
    default: present
    choices:
      - present
      - absent
extends_documentation_fragment: f5
author:
  - <NAME> (@caphrim007)
'''

EXAMPLES = r'''
- name: Create a new DoS profile
  bigip_firewall_dos_profile:
    name: profile1
    description: DoS profile 1
    provider:
      password: <PASSWORD>
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Set vectors of DoS profile
  bigip_firewall_dos_profile_vector:
    name: "{{ item }}"
    rate_increase: 100
    rate_limit: infinite
    rate_threshold: 120000
    provider:
      password: <PASSWORD>
      server: lb.mydomain.com
      user: admin
  loop:
    - a
    - aaaa
    - any
    - axfr
    - cname
    - ixfr
    - mx
    - ns
    - other
    - ptr
    - soa
    - srv
    - txt
  delegate_to: localhost
'''

RETURN = r'''
threshold_sensitivity:
  description: The new threshold sensitivity of the profile.
  returned: changed
  type: string
  sample: low
default_whitelist:<commit_msg>Removes invalid example (#44778)<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type


ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = r'''
---
module: bigip_firewall_dos_profile
short_description: Manage AFM DoS profiles on a BIG-IP
description:
  - Manages AFM Denial of Service (DoS) profiles on a BIG-IP. To manage the vectors
    associated with a DoS profile, refer to the C(bigip_firewall_dos_vector) module.
version_added: 2.7
options:
  name:
    description:
      - Specifies the name of the profile.
    required: True
  description:
    description:
      - The description of the DoS profile.
  default_whitelist:
    description:
      - The default whitelist address list for the system to use to determine which
        IP addresses are legitimate.
      - The system does not examine traffic from the IP addresses in the list when
        performing DoS prevention.
      - To define a new whitelist, use the C(bigip_firewall_address_list) module.
  threshold_sensitivity:
    description:
      - Specifies the threshold sensitivity for the DoS profile.
      - Thresholds for detecting attacks are higher when sensitivity is C(low), and
        lower when sensitivity is C(high).
      - When creating a new profile, if this parameter is not specified, the default
        is C(medium).
    choices:
      - low
      - medium
      - high
  partition:
    description:
      - Device partition to manage resources on.
    default: Common
  state:
    description:
      - When C(present), ensures that the resource exists.
      - When C(absent), ensures the resource is removed.
    default: present
    choices:
      - present
      - absent
extends_documentation_fragment: f5
author:
  - <NAME> (@caphrim007)
'''

EXAMPLES = r'''
- name: Create a new DoS profile
  bigip_firewall_dos_profile:
    name: profile1
    description: DoS profile 1
    provider:
      password: <PASSWORD>
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
'''

RETURN = r'''
threshold_sensitivity:
  description: The new threshold sensitivity of the profile.
  returned: changed
  type: string
  sample: low
default_whitelist:
{'fraction_non_alphanumeric': 0.07869767441860465, 'fraction_numerical': 0.010046511627906977, 'mean_word_length': 2.7463414634146344, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6741901', 'n_tokens_mistral': 1626, 'n_tokens_neox': 1556, 'n_words': 558}