
    VhO                     x    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZ d dlmZ d dlmZ d	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functionac  
---
module: rule_info
short_description: Obtain information about one or many QRadar Rules, with filter options
description:
  - This module obtains information about one or many QRadar Rules, with filter options
version_added: "1.0.0"
deprecated:
  alternative: qradar_analytics_rules
  why: Newer and updated modules released with more functionality.
  removed_at_date: '2024-09-01'
options:
  id:
    description:
      - Obtain only information of the Rule with provided ID
    required: false
    type: int
  name:
    description:
      - Obtain only information of the Rule that matches the provided name
    required: false
    type: str
  type:
    description:
      - Obtain only information for the Rules of a certain type
    required: false
    choices: [ "EVENT", "FLOW", "COMMON", "USER"]
    type: str
  owner:
    description:
      - Obtain only information of Rules owned by a certain user
    required: false
    type: str
  origin:
    description:
      - Obtain only information of Rules that are of a certain origin
    required: false
    choices: ["SYSTEM", "OVERRIDE", "USER"]
    type: str
notes:
  - You may provide many filters and they will all be applied, except for C(id)
    as that will return only the Rule identified by the unique ID provided.

author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>"

a  
- name: Get information about the Rule named "Custom Company DDoS Rule"
  ibm.qradar.rule_info:
    name: "Custom Company DDoS Rule"
  register: custom_ddos_rule_info

- name: debugging output of the custom_ddos_rule_info registered variable
  debug:
    var: custom_ddos_rule_info
)to_text)AnsibleModule)quote)QRadarRequestc                  D   t        t        dd      t        dd      t        dd      t        dg dd      t        dg dd            } t        | d	
      }t        |      }|j                  d   r1|j	                  dj                  |j                  d               \  }}y g }|j                  d   r?|j                  t        dj                  t        |j                  d                            |j                  d   r6|j                  t        dj                  |j                  d                      |j                  d   r6|j                  t        dj                  |j                  d                      |j                  d   r6|j                  t        dj                  |j                  d                      |r3|j	                  dj                  dj                  |                  \  }}n|j	                  d      \  }}|j                  |d       y )NFint)requiredtypestr)EVENTFLOWCOMMONUSER)r   choicesr   )SYSTEMOVERRIDEr   )idnameownerr   originT)argument_specsupports_check_moder   z/api/analytics/rules/{0}r   z
name="{0}"r   z	owner={0}r   ztype={0}r   z
origin={0}z/api/analytics/rules?filter={0}&z/api/analytics/rules)ruleschanged)dictr   r
   paramsgetformatappendr	   r   join	exit_json)argspecmoduleqradar_requestcoder   
query_strss         h/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ibm/qradar/plugins/modules/rule_info.pymainr-   Q   s   U+5u-E.7

 2
G  dKF"6*N }}T$((&--fmmD.AB
e
 
== l))'&--2G*HIJ ==!k((w)?@A == eJ$5$5fmmF6K$LMN=="l))&--*ABC (,,188*9MNKD% ),,-CDKD%ue4    __main__N)
__future__r   r   r   r   __metaclass__DOCUMENTATIONRETURNEXAMPLESansible.module_utils._textr   ansible.module_utils.basicr   +ansible.module_utils.six.moves.urllib.parser	   :ansible_collections.ibm.qradar.plugins.module_utils.qradarr
   r-   __name__ r.   r,   <module>r;      sS    A @ ,`
	 / 4 = T:5z zF r.   