
    Vh6                         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mZmZ d	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functiona  
---
module: offense_info
short_description: Obtain information about one or many QRadar Offenses, with filter options
description:
  - This module allows to obtain information about one or many QRadar Offenses, with filter options
version_added: "1.0.0"
options:
  id:
    description:
      - Obtain only information of the Offense with provided ID
    required: false
    type: int
  name:
    description:
      - Obtain only information of the Offense that matches the provided name
    required: false
    type: str
  status:
    description:
      - Obtain only information of Offenses of a certain status
    required: false
    choices: [ "open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED" ]
    default: "open"
    type: str
  assigned_to:
    description:
      - Obtain only information of Offenses assigned to a certain user
    required: false
    type: str
  closing_reason:
    description:
      - Obtain only information of Offenses that were closed by a specific closing reason
    required: false
    type: str
  closing_reason_id:
    description:
      - Obtain only information of Offenses that were closed by a specific closing reason ID
    required: false
    type: int
  follow_up:
    description:
      - Obtain only information of Offenses that are marked with the follow up flag
    required: false
    type: bool
  protected:
    description:
      - Obtain only information of Offenses that are protected
    required: false
    type: bool
notes:
  - You may provide many filters and they will all be applied, except for C(id)
    as that will return only

author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
a  
offenses:
  description: Information
  returned: always
  type: list
  elements: dict
  contains:
    qradar_offenses:
      description: IBM QRadar Offenses found based on provided filters
      returned: always
      type: complex
      contains:
        source:
          description: Init system of the service. One of C(systemd), C(sysv), C(upstart).
          returned: always
          type: str
          sample: sysv
        state:
          description: State of the service. Either C(running), C(stopped), or C(unknown).
          returned: always
          type: str
          sample: running
        status:
          description: State of the service. Either C(enabled), C(disabled), or C(unknown).
          returned: systemd systems or RedHat/SUSE flavored sysvinit/upstart
          type: str
          sample: enabled
        name:
          description: Name of the service.
          returned: always
          type: str
          sample: arp-ethers.service
z
- name: Get list of all currently OPEN IBM QRadar Offenses
  ibm.qradar.offense_info:
    status: OPEN
  register: offense_list

- name: display offense information for debug purposes
  debug:
    var: offense_list
)to_text)AnsibleModule)quote)QRadarRequestfind_dict_in_listset_offense_valuesc                     t        t        dd      t        dd      t        dd      t        dd      t        dd      t        ddd       t        ddd       t        dg ddd	      
      } t        | dgd      }t        |      }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   6|j                  t        dj                  |j                  d                      |j                  d   6|j                  t        dj                  |j                  d                      |r3|j                  dj                  dj                  |                  \  }}n|j                  d      \  }}|j                  d   r!t        |d|j                  d         }|r|}ng }|j                  |d       y ) NFint)requiredtypestrbool)r   r   default)openOPENhiddenHIDDENclosedCLOSEDr   )r   choicesr   r   )idnameassigned_toclosing_reasonclosing_reason_id	follow_up	protectedstatus)r   r   T)argument_specmutually_exclusivesupports_check_moder   z/api/siem/offenses/{0}r!   z
status={0}r   zassigned_to={0}r   zclosing_reason_id={0}r   zfollow_up={0}r    zprotected={0}z/api/siem/offenses?filter={0}&z/api/siem/offensesr   description)offenseschanged)dictr   r	   r   paramsgetformatappendr   r   joinr
   	exit_json)argspecmoduleqradar_requestcoder'   
query_strsnamed_offenses          k/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ibm/qradar/plugins/modules/offense_info.pymainr7      s   U+5u-%e4U7E:FDAFDAL	
G  CD F #6*N v~.}}T'++$++FMM$,?@
h
 
=="l))'&--2I*JKL ==''..v}}]/KLM ==,-+22&9: ==%1o,,V]];-GHI ==%1o,,V]];-GHI +///66sxx
7KLND( ,//0DEND(== -f%M
 ((E:    __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
   r   r7   __name__ r8   r6   <module>rE      s\    A @ 7v 
F	 / 4 = V;r zF r8   