summaryrefslogtreecommitdiffstats
path: root/ansible_collections/ibm/qradar
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/ibm/qradar')
-rw-r--r--ansible_collections/ibm/qradar/.github/workflows/test.yml41
-rw-r--r--ansible_collections/ibm/qradar/.gitignore111
-rw-r--r--ansible_collections/ibm/qradar/.pre-commit-config.yaml21
-rw-r--r--ansible_collections/ibm/qradar/.yamllint15
-rw-r--r--ansible_collections/ibm/qradar/CHANGELOG.rst67
-rw-r--r--ansible_collections/ibm/qradar/FILES.json922
-rw-r--r--ansible_collections/ibm/qradar/LICENSE674
-rw-r--r--ansible_collections/ibm/qradar/MANIFEST.json35
-rw-r--r--ansible_collections/ibm/qradar/README.md212
-rw-r--r--ansible_collections/ibm/qradar/bindep.txt8
-rw-r--r--ansible_collections/ibm/qradar/changelogs/changelog.yaml69
-rw-r--r--ansible_collections/ibm/qradar/changelogs/config.yaml30
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.deploy_module.rst86
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.log_source_management_module.rst195
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.offense_action_module.rst182
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.offense_info_module.rst333
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.offense_note_module.rst94
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_analytics_rules_module.rst451
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_httpapi.rst43
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_log_sources_management_module.rst922
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.rule_info_module.rst169
-rw-r--r--ansible_collections/ibm/qradar/docs/ibm.qradar.rule_module.rst139
-rw-r--r--ansible_collections/ibm/qradar/meta/runtime.yml34
-rw-r--r--ansible_collections/ibm/qradar/plugins/action/__init__.py0
-rw-r--r--ansible_collections/ibm/qradar/plugins/action/qradar_analytics_rules.py226
-rw-r--r--ansible_collections/ibm/qradar/plugins/action/qradar_log_sources_management.py306
-rw-r--r--ansible_collections/ibm/qradar/plugins/httpapi/qradar.py76
-rw-r--r--ansible_collections/ibm/qradar/plugins/module_utils/qradar.py254
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/deploy.py89
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/log_source_management.py263
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/offense_action.py201
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/offense_info.py216
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/offense_note.py189
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_analytics_rules.py279
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_deploy.py89
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_log_source_management.py263
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_log_sources_management.py522
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_offense_action.py201
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_offense_info.py216
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_offense_note.py189
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_rule.py262
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/qradar_rule_info.py143
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/rule.py262
-rw-r--r--ansible_collections/ibm/qradar/plugins/modules/rule_info.py143
-rw-r--r--ansible_collections/ibm/qradar/pyproject.toml11
-rw-r--r--ansible_collections/ibm/qradar/requirements.txt0
-rw-r--r--ansible_collections/ibm/qradar/test-requirements.txt8
-rw-r--r--ansible_collections/ibm/qradar/tests/.keep0
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/target-prefixes.network1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml0
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml60
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml19
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml2
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/meta/main.yaml2
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml18
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml7
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml6
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml14
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml7
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml38
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml27
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml69
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml45
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml62
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml136
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases1
-rw-r--r--ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml55
-rw-r--r--ansible_collections/ibm/qradar/tests/sanity/ignore-2.9.txt6
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/__init__.py0
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/compat/__init__.py0
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/compat/builtins.py34
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/compat/mock.py128
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/compat/unittest.py39
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/__init__.py0
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/loader.py116
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/path.py12
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/procenv.py94
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py42
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py167
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/plugins/action/__init__.py0
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py165
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/plugins/modules/__init__.py0
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py40
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py51
-rw-r--r--ansible_collections/ibm/qradar/tests/unit/requirements.txt42
-rw-r--r--ansible_collections/ibm/qradar/tox.ini33
93 files changed, 10806 insertions, 0 deletions
diff --git a/ansible_collections/ibm/qradar/.github/workflows/test.yml b/ansible_collections/ibm/qradar/.github/workflows/test.yml
new file mode 100644
index 000000000..e2a19e00a
--- /dev/null
+++ b/ansible_collections/ibm/qradar/.github/workflows/test.yml
@@ -0,0 +1,41 @@
+---
+name: Test collection
+
+concurrency:
+ group: ${{ github.head_ref }}
+ cancel-in-progress: true
+
+on: # yamllint disable-line rule:truthy
+ pull_request:
+ branches: [main]
+ workflow_dispatch:
+
+jobs:
+ changelog:
+ uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
+ sanity:
+ uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
+ unit-galaxy:
+ uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main
+ unit-source:
+ uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
+ with:
+ collection_pre_install: >-
+ git+https://github.com/ansible-collections/ansible.utils.git
+ git+https://github.com/ansible-collections/ansible.netcommon.git
+ all_green:
+ if: ${{ always() }}
+ needs:
+ - changelog
+ - sanity
+ - unit-galaxy
+ - unit-source
+ runs-on: ubuntu-latest
+ steps:
+ - run: >-
+ python -c "assert set([
+ '${{ needs.changelog.result }}',
+ '${{ needs.sanity.result }}',
+ '${{ needs.unit-galaxy.result }}',
+ '${{ needs.unit-source.result }}'
+ ]) == {'success'}" \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/.gitignore b/ansible_collections/ibm/qradar/.gitignore
new file mode 100644
index 000000000..651a7bc91
--- /dev/null
+++ b/ansible_collections/ibm/qradar/.gitignore
@@ -0,0 +1,111 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+
+# mazer / ansible collections
+releases/
+
+*.tar.gz
+
+tests/output*
diff --git a/ansible_collections/ibm/qradar/.pre-commit-config.yaml b/ansible_collections/ibm/qradar/.pre-commit-config.yaml
new file mode 100644
index 000000000..7d4355f70
--- /dev/null
+++ b/ansible_collections/ibm/qradar/.pre-commit-config.yaml
@@ -0,0 +1,21 @@
+---
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.2.0
+ hooks:
+ - id: check-merge-conflict
+ - id: check-symlinks
+ - id: debug-statements
+ - id: end-of-file-fixer
+ - id: no-commit-to-branch
+ args: [--branch, main]
+ - id: trailing-whitespace
+ - repo: https://github.com/psf/black
+ rev: 22.3.0
+ hooks:
+ - id: black
+ args: [-l, "100"]
+ - repo: https://github.com/ansible-network/collection_prep
+ rev: 1.0.0
+ hooks:
+ - id: update-docs
diff --git a/ansible_collections/ibm/qradar/.yamllint b/ansible_collections/ibm/qradar/.yamllint
new file mode 100644
index 000000000..3adaf90cf
--- /dev/null
+++ b/ansible_collections/ibm/qradar/.yamllint
@@ -0,0 +1,15 @@
+---
+extends: default
+
+ignore: |
+ .tox
+ changelogs/*
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
diff --git a/ansible_collections/ibm/qradar/CHANGELOG.rst b/ansible_collections/ibm/qradar/CHANGELOG.rst
new file mode 100644
index 000000000..f937e8e9f
--- /dev/null
+++ b/ansible_collections/ibm/qradar/CHANGELOG.rst
@@ -0,0 +1,67 @@
+===================================
+IBM Qradar Collection Release Notes
+===================================
+
+.. contents:: Topics
+
+v2.1.0
+======
+
+Minor Changes
+-------------
+
+- Add Qradar Analytics rules resource module.
+- Add Qradar Log Sources Management resource module.
+
+New Modules
+-----------
+
+- qradar_analytics_rules - Qradar Analytics Rules Management resource module
+- qradar_log_sources_management - Qradar Log Sources Management resource module
+
+v2.0.0
+======
+
+Major Changes
+-------------
+
+- Minimum required ansible.netcommon version is 2.5.1.
+- Updated base plugin references to ansible.netcommon.
+
+v1.0.3
+======
+
+Release Summary
+---------------
+
+- Re-releasing the 1.0.2 with updated galaxy file
+
+v1.0.2
+======
+
+Release Summary
+---------------
+
+- Releasing 1.0.2 with updated changelog.
+
+v1.0.1
+======
+
+Release Summary
+---------------
+
+- Releasing 1.0.2 with updated Readme file after removing tech preview description
+
+v1.0.0
+======
+
+New Modules
+-----------
+
+- ibm.qradar.deploy - Trigger a qradar configuration deployment
+- ibm.qradar.log_source_management - Manage Log Sources in QRadar
+- ibm.qradar.offense_action - Take action on a QRadar Offense
+- ibm.qradar.offense_info - Obtain information about one or many QRadar Offenses, with filter options
+- ibm.qradar.offense_note - Create or update a QRadar Offense Note
+- ibm.qradar.rule - Manage state of QRadar Rules, with filter options
+- ibm.qradar.rule_info - Obtain information about one or many QRadar Rules, with filter options
diff --git a/ansible_collections/ibm/qradar/FILES.json b/ansible_collections/ibm/qradar/FILES.json
new file mode 100644
index 000000000..84a0f1790
--- /dev/null
+++ b/ansible_collections/ibm/qradar/FILES.json
@@ -0,0 +1,922 @@
+{
+ "files": [
+ {
+ "name": ".",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/workflows",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/test.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "abbe2f2b782e28e478a011667782bcd93a86c21f1554f5eaa772305af4d37640",
+ "format": 1
+ },
+ {
+ "name": "changelogs",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "changelogs/changelog.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c675ed616cbec4e8e3343eb024182ca9c7d6dbc1e72e3b8f3598da67349ff5bc",
+ "format": 1
+ },
+ {
+ "name": "changelogs/config.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d2c4dcbe8870d9e338d757b61e3f3cc08ab7f4535795d67a3df7b5f15e4fd6c8",
+ "format": 1
+ },
+ {
+ "name": "docs",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.deploy_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "905ea7071de3986d5fec78b1314b7901838add60f05418861c47667c11762605",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.log_source_management_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "967f8c4a1fffeab83b6d2b0a8a0a55098f8ed89cd5a5e947d88fe7c3860e508f",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.offense_action_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "499aa85776594aa101b48286715c4f50980807f3aeb057e05c983c2b853ae1f3",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.offense_info_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "147d44b8ed4d5fd6cf7fb4df19b370625e9064455e76f5ccad4139a979ba29c2",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.offense_note_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "20b656a582532cb4f46af1840c6d9e6bfb7e75299ce84b30a2aaa1f9bf9db15c",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.qradar_analytics_rules_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "eaeff500aa899570ba58be93ecd66808c4959df923243b2373f07b43e4d18d43",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.qradar_httpapi.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d9bff624389781d9d2b517ccf2fb797811a98007aa3e0d6a999d3b0d462a2956",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.qradar_log_sources_management_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "58f7e256f3556620aaf73fc4ef793713d3f021fa1ef4424b063ced7494d4752d",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.rule_info_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "607c6f296c8106aa22a070d4c6513c663ab3ae2fcc93e22f9b462d27b41fda53",
+ "format": 1
+ },
+ {
+ "name": "docs/ibm.qradar.rule_module.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "86039262bfcc0df113911178cc1fc5a8bae0e92b6a20d4bd0b79e7f76f337620",
+ "format": 1
+ },
+ {
+ "name": "meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "meta/runtime.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "414e97f033acc6afc08f9bb522bbf5db1b4f359a820c01f82be4bc50f1e55352",
+ "format": 1
+ },
+ {
+ "name": "plugins",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/action",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/action/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "plugins/action/qradar_analytics_rules.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "69740224f09fe0f6dff44597fa30c5707fd77c0e6429e479fdc5feffaa50843e",
+ "format": 1
+ },
+ {
+ "name": "plugins/action/qradar_log_sources_management.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "24ffae07d93bae8d3850f0bba2c50c7b10c7d124a57542f24542b9ac112faa91",
+ "format": 1
+ },
+ {
+ "name": "plugins/httpapi",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/httpapi/qradar.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ba3b495f9dfdff81318a594c4b1874548239b916f3a9a30b6e9775a35761c5d3",
+ "format": 1
+ },
+ {
+ "name": "plugins/module_utils",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/module_utils/qradar.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ae62dfc3637bfb6eae56ae40e922b35087b550fc7554ab47bbf94b53d43de1a4",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_deploy.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e061cdb5af3a9c2f2c7f14ca300feb52a2cd41e3669f7814311cfcedaeec08f7",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_log_source_management.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b8f915dec02b41d29af6680823bf538dd2f648d1142124cf54565ad7ba260e49",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_offense_action.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2f25e23ff4bba3332a877fb5cf6f2c2f28e7a776cacdfdb08648d5d9527d00db",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_offense_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "de02f673e3ff3653ca8f9e8a43e980ef7811fc0e4b8ede36c10cb495c2ce44d7",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_offense_note.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "511912ef4baaafb001439ee96559843a2ac2054d77e7e4e4f97fef79b7261f94",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_rule.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ed52d8c0cfc0e1860240cf2b913eeba6f7263c6b0029aac8468410b8aae8e141",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_rule_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5a68a767a121239541d4685d65022b48b4b990c12a679406d232c089a686b456",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/deploy.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e061cdb5af3a9c2f2c7f14ca300feb52a2cd41e3669f7814311cfcedaeec08f7",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/log_source_management.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b8f915dec02b41d29af6680823bf538dd2f648d1142124cf54565ad7ba260e49",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/offense_action.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2f25e23ff4bba3332a877fb5cf6f2c2f28e7a776cacdfdb08648d5d9527d00db",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/offense_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "de02f673e3ff3653ca8f9e8a43e980ef7811fc0e4b8ede36c10cb495c2ce44d7",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/offense_note.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "511912ef4baaafb001439ee96559843a2ac2054d77e7e4e4f97fef79b7261f94",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_analytics_rules.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "20a9edb860d5e98e1bb08f4320bcbd13726e0b52cbfa23f55875e10c00212472",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/qradar_log_sources_management.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f5fa473f263ccc2ebd15724c2722b20891f6a818729b0d966d2f00a35fc6acc2",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/rule.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ed52d8c0cfc0e1860240cf2b913eeba6f7263c6b0029aac8468410b8aae8e141",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/rule_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5a68a767a121239541d4685d65022b48b4b990c12a679406d232c089a686b456",
+ "format": 1
+ },
+ {
+ "name": "tests",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/deploy",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/deploy/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/deploy/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/deploy/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/log_source_management",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/log_source_management/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/log_source_management/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6821a3548927a93503e37fd42e276c8ebc829bc72ae55dc47b8f3c20e32f11d8",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/log_source_management/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/offense",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/offense/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/offense/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "985949c5779a18b1d13a05230a565e24d4edc5b8e9d87ae16ea47c07a44e3a75",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/offense/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_deploy",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_deploy/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_source_management",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_source_management/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/defaults",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/defaults/main.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/meta/main.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "79c2820b2b63ca8b1b4025dfdac534f3296e24d72ad688c06d33268cfafff497",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tasks/main.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e7d7f58a1d24f52718c31cc560ba27eaf69da2df9e8b0d26516560b547d1d9da",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5b071a65a98718e6fbc859cf577103adc6dd5700bc7263877936d391639e61f3",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests/cli",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d216d1ab07e6220f2d5dcd22f84c70849db6945d9a3680d4190a92e4198c24b7",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f817d766182cdf2e099e8d96f468bf1e7db3159091394578b72097767ec5fceb",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "18f5096b5f3e533da91e48f0659696f616adb83d3f48a940b2711a1c34f48af3",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "69e7f5c3460b00653d155a4e71b882125ca7c183429e951ddd069965afbe9c3e",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "304640c1a0e6ee8436f147745e62b44cb536b176a8cecb50441e0ca2c7c11e8a",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "038a9601139d83cec40b40f711bc6eca1602bae2d988fde4bcdd84b6be18c6a4",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4cb3f0ad53ddd35f3d47cef6262bb97af8b045b625ed5bcf9310950604ffaf84",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/vars",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_log_sources_management/vars/main.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "a7ce38445031d76134d0cd52780f5905abb1cffce74718fe61fefa1c8fbf2f9f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_offense",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_offense/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_rule",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/qradar_rule/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/rule",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/rule/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/rule/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1d47767a0f7a9e41ac6cfe46ae8f0184a05fa4f81f5ef7b64c0387fce1a163c1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/rule/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/target-prefixes.network",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f4d2f34d7884174dabd0e91e1f2ae1a22499f44e634261344ad065a167f5f862",
+ "format": 1
+ },
+ {
+ "name": "tests/sanity",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/sanity/ignore-2.9.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "9246dc0a460b34f99c668d253511798595dc611dfda1fb828bdb9d13672fdfed",
+ "format": 1
+ },
+ {
+ "name": "tests/unit",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/builtins.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ba13a350ade8ef804336f888d5883b8e54f8bddfb9d0fadc10277a8ca6540f4e",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/mock.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "52ecd54195edca933104eb3e937547c7395ff604ada2694a8b184c2c1466dbf1",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/unittest.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3ed698b1faec43d87a2c1ebcb15a2aae48b09ff355bb9a598e5f5a1c928dbb30",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/mock",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/mock/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/mock/loader.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "99243cafb4042ee1354d81e3f21647b18bba2b81e1bcd0d77d5487d6069740b9",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/mock/path.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "77760b066115f34f1ecce2387f8194ba254f3dc44ed89f439f3e6adfd258cdf1",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/mock/procenv.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d7f9e134ebd607e1b2910d62cd8997535c8a2cced4473a2bf5cdaae2233e3049",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/mock/vault_helper.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "feae23166b6eb502f7d9b77c314970516c9a99aaad7de01295b4dfdad53c5c09",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/mock/yaml_helper.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "94e2f3c867d2582c9f7a0e99e544718e355025c4a51c9925e70158fa89b3609e",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/action",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/action/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/action/test_qradar_analytics_rules.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "82ca5c7c9be3c8ad8c86dccba1b7f48e2deea8be67efd24689fdfab994136ea9",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/conftest.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2af4846e50d461a131ad3edfb609fbb39a9eb1796048c62e4ead8234bcf5c6a1",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/utils.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ecb4e4c4a3a490b49d33d043d246bea11580cfe5460e70630a793c2ffd0ff450",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/requirements.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "49ba996dc4735c3463e9af561344346dfae14bcc1a68096ce78364b377f0df1f",
+ "format": 1
+ },
+ {
+ "name": "tests/.keep",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": ".gitignore",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "63e02bf68769e25aba8db3f3cf2c1cd8b1e92e71ce3ef2d13e949b994e424b75",
+ "format": 1
+ },
+ {
+ "name": ".pre-commit-config.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6aabafd87ba32cf5d946aedd801dd41ee6fa90c7699a54f7d52c02b9c6576e14",
+ "format": 1
+ },
+ {
+ "name": ".yamllint",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "827ef9e031ecdcaf137be239d33ef93fcbbc3611cbb6b30b0e507d0e03373d0e",
+ "format": 1
+ },
+ {
+ "name": "CHANGELOG.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d7387333cff83fd516f8ec5f3808dabcf3e7bff7da05f76ab1793e6fbd6836db",
+ "format": 1
+ },
+ {
+ "name": "LICENSE",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
+ "format": 1
+ },
+ {
+ "name": "README.md",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1e50ccabd2166f551342cba98c6747604ed6d7df8fdda10fcfedbf89837df04d",
+ "format": 1
+ },
+ {
+ "name": "bindep.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f20e24c3b24e3738a72623924e20848bb3bab9ea951099b7d2fcce091b9673a8",
+ "format": 1
+ },
+ {
+ "name": "pyproject.toml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "39dc64b0a646edff79e3a08ae4d3bae8fe707149df149814149d45ce07c30937",
+ "format": 1
+ },
+ {
+ "name": "requirements.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "test-requirements.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "eaa5e13a5ebe3344585b2e5ac61a6974a6d5b132f13a815d3a0f68c36ecfe8ad",
+ "format": 1
+ },
+ {
+ "name": "tox.ini",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "fa849abc071b00742c00b96e3df480355a2af2c60e4c920f085a9ac5616d8d4b",
+ "format": 1
+ }
+ ],
+ "format": 1
+} \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/LICENSE b/ansible_collections/ibm/qradar/LICENSE
new file mode 100644
index 000000000..f288702d2
--- /dev/null
+++ b/ansible_collections/ibm/qradar/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/ansible_collections/ibm/qradar/MANIFEST.json b/ansible_collections/ibm/qradar/MANIFEST.json
new file mode 100644
index 000000000..abcace9e9
--- /dev/null
+++ b/ansible_collections/ibm/qradar/MANIFEST.json
@@ -0,0 +1,35 @@
+{
+ "collection_info": {
+ "namespace": "ibm",
+ "name": "qradar",
+ "version": "2.1.0",
+ "authors": [
+ "Ansible Security Team (https://github.com/ansible-security)"
+ ],
+ "readme": "README.md",
+ "tags": [
+ "security",
+ "qradar"
+ ],
+ "description": "Ansible Security Collection for IBM Qradar SIEM",
+ "license": [
+ "GPL-3.0-or-later"
+ ],
+ "license_file": null,
+ "dependencies": {
+ "ansible.netcommon": ">=2.5.1"
+ },
+ "repository": "https://github.com/ansible-collections/ibm.qradar",
+ "documentation": "https://github.com/ansible-collections/ibm.qradar",
+ "homepage": "https://github.com/ansible-collections/ibm.qradar",
+ "issues": "https://github.com/ansible-collections/ibm.qradar/issues"
+ },
+ "file_manifest_file": {
+ "name": "FILES.json",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6ba5743d2a4af148e4e25deb85d86aa62e1b5ba35f8f0c1ef23a52b863b2b2a4",
+ "format": 1
+ },
+ "format": 1
+} \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/README.md b/ansible_collections/ibm/qradar/README.md
new file mode 100644
index 000000000..dc0cb7f3a
--- /dev/null
+++ b/ansible_collections/ibm/qradar/README.md
@@ -0,0 +1,212 @@
+# IBM QRadar Ansible Collection
+
+[![CI](https://zuul-ci.org/gated.svg)](https://dashboard.zuul.ansible.com/t/ansible/project/github.com/ansible-collections/ibm.qradar) <!--[![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/ibm.qradar)](https://codecov.io/gh/ansible-collections/ibm.qradar)-->
+
+This is the [Ansible
+Collection](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html)
+provided by the [Ansible Security Automation
+Team](https://github.com/ansible-security) for automating actions in [IBM
+QRadar SIEM](https://www.ibm.com/us-en/marketplace/ibm-qradar-siem).
+
+This Collection is meant for distribution through
+[Ansible Galaxy](https://galaxy.ansible.com/) as is available for all
+[Ansible](https://github.com/ansible/ansible) users to utilize, contribute to,
+and provide feedback about.
+
+<!--start requires_ansible-->
+## Ansible version compatibility
+
+This collection has been tested against following Ansible versions: **>=2.9.10**.
+
+Plugins and modules within a collection may be tested with only specific Ansible versions.
+A collection may contain metadata that identifies these versions.
+PEP440 is the schema used to describe the versions of Ansible.
+<!--end requires_ansible-->
+
+## Collection Content
+<!--start collection content-->
+### Httpapi plugins
+Name | Description
+--- | ---
+[ibm.qradar.qradar](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.qradar_httpapi.rst)|HttpApi Plugin for IBM QRadar
+
+### Modules
+Name | Description
+--- | ---
+[ibm.qradar.deploy](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.deploy_module.rst)|Trigger a qradar configuration deployment
+[ibm.qradar.log_source_management](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.log_source_management_module.rst)|Manage Log Sources in QRadar
+[ibm.qradar.offense_action](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.offense_action_module.rst)|Take action on a QRadar Offense
+[ibm.qradar.offense_info](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.offense_info_module.rst)|Obtain information about one or many QRadar Offenses, with filter options
+[ibm.qradar.offense_note](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.offense_note_module.rst)|Create or update a QRadar Offense Note
+[ibm.qradar.qradar_analytics_rules](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.qradar_analytics_rules_module.rst)|Qradar Analytics Rules Management resource module
+[ibm.qradar.qradar_log_sources_management](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.qradar_log_sources_management_module.rst)|Qradar Log Sources Management resource module
+[ibm.qradar.rule](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.rule_module.rst)|Manage state of QRadar Rules, with filter options
+[ibm.qradar.rule_info](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.rule_info_module.rst)|Obtain information about one or many QRadar Rules, with filter options
+
+<!--end collection content-->
+
+## Installing this collection
+
+You can install the IBM qradar collection with the Ansible Galaxy CLI:
+
+ ansible-galaxy collection install ibm.qradar
+
+You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format:
+
+```yaml
+---
+collections:
+ - name: ibm.qradar
+```
+
+## Using the IBM QRadar Ansible Collection
+
+An example for using this collection to manage a log source with [IBM QRadar](https://www.ibm.com/security/security-intelligence/qradar) is as follows.
+
+`inventory.ini` (Note the password should be managed by a [Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html) for a production environment.
+```
+[qradar]
+qradar.example.com
+
+[qradar:vars]
+ansible_network_os=ibm.qradar.qradar
+ansible_user=admin
+ansible_httpapi_pass=SuperSekretPassword
+ansible_httpapi_use_ssl=yes
+ansible_httpapi_validate_certs=yes
+ansible_connection=httpapi
+```
+
+**NOTE**: For Ansible 2.9, you may not see deprecation warnings when you run your playbooks with this collection. Use this documentation to track when a module is deprecated.
+
+### Using the modules with Fully Qualified Collection Name (FQCN)
+
+With [Ansible
+Collections](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html)
+there are various ways to utilize them either by calling specific Content from
+the Collection, such as a module, by its Fully Qualified Collection Name (FQCN)
+as we'll show in this example or by defining a Collection Search Path as the
+examples below will display.
+
+I should be noted that the FQCN method is the recommended method but the
+shorthand options listed below exist for convenience.
+
+`qradar_with_collections_example.yml`
+```
+---
+- name: Testing URI manipulation of QRadar with FQCN
+ hosts: qradar
+ gather_facts: false
+ tasks:
+ - name: create log source
+ ibm.qradar.log_source_management:
+ name: "Ansible Collections Example Log Source"
+ type_name: "Linux OS"
+ state: present
+ description: "Ansible Collections Example Log Source Description"
+```
+
+### Define your collection search path at the Play level
+
+Below we specify our collection at the
+[Play](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html)
+level which allows us to use the `log_source_management` module without
+the need for the FQCN for each task.
+
+`qradar_with_collections_example.yml`
+```
+---
+- name: Testing URI manipulation of QRadar
+ hosts: qradar
+ gather_facts: false
+ collections:
+ - ibm.qradar
+ tasks:
+ - name: create log source
+ log_source_management:
+ name: "Ansible Collections Example Log Source"
+ type_name: "Linux OS"
+ state: present
+ description: "Ansible Collections Example Log Source Description"
+```
+
+### Define your collection search path at the Block level
+
+Another option for Collection use is below. Here we use the
+[`block`](https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html)
+level keyword instead of [Play](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html)
+level as with the previous example. In this scenario we are able to use the
+`log_source_management` module without the need for the FQCN for each
+task but with an optionally more specific scope of Collection Search Path than
+specifying at the Play level.
+
+`qradar_with_collections_block_example.yml`
+```
+---
+- name: Testing URI manipulation of QRadar
+ hosts: qradar
+ gather_facts: false
+ tasks:
+ - name: collection namespace block
+ block:
+ - name: create log source
+ log_source_management:
+ name: "Ansible Collections Example Log Source"
+ type_name: "Linux OS"
+ state: present
+ description: "Ansible Collections Example Log Source Description"
+ collections:
+ - ibm.qradar
+```
+
+### Directory Structure
+
+* `docs/`: local documentation for the collection
+* `license.txt`: optional copy of license(s) for this collection
+* `galaxy.yml`: source data for the MANIFEST.json that will be part of the collection package
+* `playbooks/`: playbooks reside here
+ * `tasks/`: this holds 'task list files' for `include_tasks`/`import_tasks` usage
+* `plugins/`: all ansible plugins and modules go here, each in its own subdir
+ * `modules/`: ansible modules
+ * `lookups/`: lookup plugins
+ * `filters/`: Jinja2 filter plugins
+ * ... rest of plugins
+* `README.md`: information file (this file)
+* `roles/`: directory for ansible roles
+* `tests/`: tests for the collection's content
+
+## Contributing to this collection
+
+We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [IBM QRadar collection repository](https://github.com/ansible-collections/ibm.qradar). See [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for complete details.
+
+You can also join us on:
+
+- IRC - the ``#ansible-community`` [irc.libera.chat](https://libera.chat/) channel
+
+See the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) for details on contributing to Ansible.
+
+### Code of Conduct
+This collection follows the Ansible project's
+[Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html).
+Please read and familiarize yourself with this document.
+
+## Release notes
+
+Release notes are available [here](https://github.com/ansible-collections/ibm.qradar/blob/main/changelogs/CHANGELOG.rst).
+
+## Roadmap
+
+<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. -->
+
+## More information
+
+- [Ansible Collection overview](https://github.com/ansible-collections/overview)
+- [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html)
+- [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html)
+- [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html)
+
+## Licensing
+
+GNU General Public License v3.0 or later.
+
+See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text.
diff --git a/ansible_collections/ibm/qradar/bindep.txt b/ansible_collections/ibm/qradar/bindep.txt
new file mode 100644
index 000000000..1eeaeb4de
--- /dev/null
+++ b/ansible_collections/ibm/qradar/bindep.txt
@@ -0,0 +1,8 @@
+# This is a cross-platform list tracking distribution packages needed by tests;
+# see https://docs.openstack.org/infra/bindep/ for additional information.
+
+gcc-c++ [doc test platform:rpm]
+python3-devel [test platform:rpm]
+python3 [test platform:rpm]
+libssh-devel [test platform:rpm]
+libssh-dev [test platform:dpkg] \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/changelogs/changelog.yaml b/ansible_collections/ibm/qradar/changelogs/changelog.yaml
new file mode 100644
index 000000000..35d420526
--- /dev/null
+++ b/ansible_collections/ibm/qradar/changelogs/changelog.yaml
@@ -0,0 +1,69 @@
+ancestor: null
+releases:
+ 1.0.0:
+ modules:
+ - description: Trigger a qradar configuration deployment
+ name: ibm.qradar.deploy
+ namespace: ''
+ - description: Manage Log Sources in QRadar
+ name: ibm.qradar.log_source_management
+ namespace: ''
+ - description: Take action on a QRadar Offense
+ name: ibm.qradar.offense_action
+ namespace: ''
+ - description: Obtain information about one or many QRadar Offenses, with filter
+ options
+ name: ibm.qradar.offense_info
+ namespace: ''
+ - description: Create or update a QRadar Offense Note
+ name: ibm.qradar.offense_note
+ namespace: ''
+ - description: Manage state of QRadar Rules, with filter options
+ name: ibm.qradar.rule
+ namespace: ''
+ - description: Obtain information about one or many QRadar Rules, with filter
+ options
+ name: ibm.qradar.rule_info
+ namespace: ''
+ release_date: '2020-06-22'
+ 1.0.1:
+ changes:
+ release_summary: Removed tech preview from collection Readme file.
+ release_date: '2020-06-23'
+ 1.0.2:
+ changes:
+ release_summary: Releasing 1.0.2 with updated changelog.
+ release_date: '2020-08-27'
+ 1.0.3:
+ changes:
+ release_summary: Re-releasing 1.0.2 with updated galaxy file.
+ release_date: '2020-09-1'
+ 2.0.0:
+ changes:
+ major_changes:
+ - Minimum required ansible.netcommon version is 2.5.1.
+ - Updated base plugin references to ansible.netcommon.
+ fragments:
+ - netcommon_ref_update.yaml
+ - update_tests_unit_black_requirements.yaml
+ release_date: '2022-04-29'
+ 2.1.0:
+ changes:
+ minor_changes:
+ - Add Qradar Analytics rules resource module.
+ - Add Qradar Log Sources Management resource module.
+ fragments:
+ - add_qradar_analytics_rules_module.yaml
+ - add_qradar_log_sources_management_module.yaml
+ - doc_update_for_deprecation.yaml
+ - fix_doc_for_sanity_failures.yaml
+ - doc_update_with_correct_version.yaml
+ - undo_changelog_override.yaml
+ modules:
+ - description: Qradar Analytics Rules Management resource module
+ name: qradar_analytics_rules
+ namespace: private.var.folders._0.m716s5gx1g3d5j1dw_s2w1ph0000gn.T.antsibull-changelog9yvlq4ax.collections.ansible_collections.ibm.qradar.plugins.modules
+ - description: Qradar Log Sources Management resource module
+ name: qradar_log_sources_management
+ namespace: private.var.folders._0.m716s5gx1g3d5j1dw_s2w1ph0000gn.T.antsibull-changelog9yvlq4ax.collections.ansible_collections.ibm.qradar.plugins.modules
+ release_date: '2022-09-07'
diff --git a/ansible_collections/ibm/qradar/changelogs/config.yaml b/ansible_collections/ibm/qradar/changelogs/config.yaml
new file mode 100644
index 000000000..c0c71629b
--- /dev/null
+++ b/ansible_collections/ibm/qradar/changelogs/config.yaml
@@ -0,0 +1,30 @@
+changelog_filename_template: CHANGELOG.rst
+changelog_filename_version_depth: 0
+changes_file: changelog.yaml
+changes_format: combined
+keep_fragments: false
+mention_ancestor: true
+new_plugins_after_name: removed_features
+notesdir: fragments
+prelude_section_name: release_summary
+prelude_section_title: Release Summary
+flatmap: true
+sections:
+- - major_changes
+ - Major Changes
+- - minor_changes
+ - Minor Changes
+- - breaking_changes
+ - Breaking Changes / Porting Guide
+- - deprecated_features
+ - Deprecated Features
+- - removed_features
+ - Removed Features (previously deprecated)
+- - security_fixes
+ - Security Fixes
+- - bugfixes
+ - Bugfixes
+- - known_issues
+ - Known Issues
+title: IBM Qradar Collection
+trivial_section_name: trivial
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.deploy_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.deploy_module.rst
new file mode 100644
index 000000000..10e8cf568
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.deploy_module.rst
@@ -0,0 +1,86 @@
+.. _ibm.qradar.deploy_module:
+
+
+*****************
+ibm.qradar.deploy
+*****************
+
+**Trigger a qradar configuration deployment**
+
+
+Version added: 1.0.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+Synopsis
+--------
+- This module allows for INCREMENTAL or FULL deployments
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>type</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li><div style="color: blue"><b>INCREMENTAL</b>&nbsp;&larr;</div></li>
+ <li>FULL</li>
+ </ul>
+ </td>
+ <td>
+ <div>Type of deployment</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+Notes
+-----
+
+.. note::
+ - This module does not support check mode because the QRadar REST API does not offer stateful inspection of configuration deployments
+
+
+
+Examples
+--------
+
+.. code-block:: yaml
+
+ - name: run an incremental deploy
+ ibm.qradar.deploy:
+ type: INCREMENTAL
+
+
+
+
+Status
+------
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.log_source_management_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.log_source_management_module.rst
new file mode 100644
index 000000000..8e23256f2
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.log_source_management_module.rst
@@ -0,0 +1,195 @@
+.. _ibm.qradar.log_source_management_module:
+
+
+********************************
+ibm.qradar.log_source_management
+********************************
+
+**Manage Log Sources in QRadar**
+
+
+Version added: 1.0.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+DEPRECATED
+----------
+:Removed in collection release after 2024-09-01
+:Why: Newer and updated modules released with more functionality.
+:Alternative: qradar_log_sources_management
+
+
+
+Synopsis
+--------
+- This module allows for addition, deletion, or modification of Log Sources in QRadar
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>description</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ / <span style="color: red">required</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Description of log source</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>identifier</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ / <span style="color: red">required</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Log Source Identifier (Typically IP Address or Hostname of log source)</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ / <span style="color: red">required</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Name of Log Source</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>protocol_type_id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Type of protocol by id, as defined in QRadar Log Source Types Documentation</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>state</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ / <span style="color: red">required</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>present</li>
+ <li>absent</li>
+ </ul>
+ </td>
+ <td>
+ <div>Add or remove a log source.</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>type_id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Type of resource by id, as defined in QRadar Log Source Types Documentation</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>type_name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Type of resource by name</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+Notes
+-----
+
+.. note::
+ - Either ``type`` or ``type_id`` is required
+
+
+
+Examples
+--------
+
+.. code-block:: yaml
+
+ - name: Add a snort log source to IBM QRadar
+ ibm.qradar.log_source_management:
+ name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ state: present
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.168.1.101"
+
+
+
+
+Status
+------
+
+
+- This module will be removed in a release after 2024-09-01. *[deprecated]*
+- For more information see `DEPRECATED`_.
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_action_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_action_module.rst
new file mode 100644
index 000000000..2fde5b4ee
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_action_module.rst
@@ -0,0 +1,182 @@
+.. _ibm.qradar.offense_action_module:
+
+
+*************************
+ibm.qradar.offense_action
+*************************
+
+**Take action on a QRadar Offense**
+
+
+Version added: 1.0.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+Synopsis
+--------
+- This module allows to assign, protect, follow up, set status, and assign closing reason to QRadar Offenses
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>assigned_to</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Assign to an user, the QRadar username should be provided</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>closing_reason</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Assign a predefined closing reason here, by name.</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>closing_reason_id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Assign a predefined closing reason here, by id.</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>follow_up</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>Set or unset the flag to follow up on a QRadar Offense</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ / <span style="color: red">required</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>ID of Offense</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>protected</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>Set or unset the flag to protect a QRadar Offense</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>status</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>open</li>
+ <li>OPEN</li>
+ <li>hidden</li>
+ <li>HIDDEN</li>
+ <li>closed</li>
+ <li>CLOSED</li>
+ </ul>
+ </td>
+ <td>
+ <div>One of &quot;open&quot;, &quot;hidden&quot; or &quot;closed&quot;. (Either all lower case or all caps)</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+Notes
+-----
+
+.. note::
+ - Requires one of ``name`` or ``id`` be provided
+ - Only one of ``closing_reason`` or ``closing_reason_id`` can be provided
+
+
+
+
+
+
+
+Status
+------
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_info_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_info_module.rst
new file mode 100644
index 000000000..ddf7a8eab
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_info_module.rst
@@ -0,0 +1,333 @@
+.. _ibm.qradar.offense_info_module:
+
+
+***********************
+ibm.qradar.offense_info
+***********************
+
+**Obtain information about one or many QRadar Offenses, with filter options**
+
+
+Version added: 1.0.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+Synopsis
+--------
+- This module allows to obtain information about one or many QRadar Offenses, with filter options
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>assigned_to</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Obtain only information of Offenses assigned to a certain user</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>closing_reason</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Obtain only information of Offenses that were closed by a specific closing reason</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>closing_reason_id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Obtain only information of Offenses that were closed by a specific closing reason ID</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>follow_up</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>Obtain only information of Offenses that are marked with the follow up flag</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Obtain only information of the Offense with provided ID</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Obtain only information of the Offense that matches the provided name</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>protected</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>Obtain only information of Offenses that are protected</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>status</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li><div style="color: blue"><b>open</b>&nbsp;&larr;</div></li>
+ <li>OPEN</li>
+ <li>hidden</li>
+ <li>HIDDEN</li>
+ <li>closed</li>
+ <li>CLOSED</li>
+ </ul>
+ </td>
+ <td>
+ <div>Obtain only information of Offenses of a certain status</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+Notes
+-----
+
+.. note::
+ - You may provide many filters and they will all be applied, except for ``id`` as that will return only
+
+
+
+Examples
+--------
+
+.. code-block:: yaml
+
+ - 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
+
+
+
+Return Values
+-------------
+Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="3">Key</th>
+ <th>Returned</th>
+ <th width="100%">Description</th>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>offenses</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">list</span>
+ / <span style="color: purple">elements=dictionary</span>
+ </div>
+ </td>
+ <td>always</td>
+ <td>
+ <div>Information</div>
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>qradar_offenses</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">complex</span>
+ </div>
+ </td>
+ <td>always</td>
+ <td>
+ <div>IBM QRadar Offenses found based on provided filters</div>
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>name</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>always</td>
+ <td>
+ <div>Name of the service.</div>
+ <br/>
+ <div style="font-size: smaller"><b>Sample:</b></div>
+ <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">arp-ethers.service</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>source</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>always</td>
+ <td>
+ <div>Init system of the service. One of <code>systemd</code>, <code>sysv</code>, <code>upstart</code>.</div>
+ <br/>
+ <div style="font-size: smaller"><b>Sample:</b></div>
+ <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">sysv</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>state</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>always</td>
+ <td>
+ <div>State of the service. Either <code>running</code>, <code>stopped</code>, or <code>unknown</code>.</div>
+ <br/>
+ <div style="font-size: smaller"><b>Sample:</b></div>
+ <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">running</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td class="elbow-placeholder">&nbsp;</td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>status</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>systemd systems or RedHat/SUSE flavored sysvinit/upstart</td>
+ <td>
+ <div>State of the service. Either <code>enabled</code>, <code>disabled</code>, or <code>unknown</code>.</div>
+ <br/>
+ <div style="font-size: smaller"><b>Sample:</b></div>
+ <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">enabled</div>
+ </td>
+ </tr>
+
+
+ </table>
+ <br/><br/>
+
+
+Status
+------
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_note_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_note_module.rst
new file mode 100644
index 000000000..a41e51cae
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_note_module.rst
@@ -0,0 +1,94 @@
+.. _ibm.qradar.offense_note_module:
+
+
+***********************
+ibm.qradar.offense_note
+***********************
+
+**Create or update a QRadar Offense Note**
+
+
+Version added: 1.0.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+Synopsis
+--------
+- This module allows to create a QRadar Offense note
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ / <span style="color: red">required</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Offense ID to operate on</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>note_text</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ / <span style="color: red">required</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The note&#x27;s text contents</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+
+
+Examples
+--------
+
+.. code-block:: yaml
+
+ - name: Add a note to QRadar Offense ID 1
+ ibm.qradar.offense_note:
+ id: 1
+ note_text: This an example note entry that should be made on offense id 1
+
+
+
+
+Status
+------
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_analytics_rules_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_analytics_rules_module.rst
new file mode 100644
index 000000000..bc657fd5b
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_analytics_rules_module.rst
@@ -0,0 +1,451 @@
+.. _ibm.qradar.qradar_analytics_rules_module:
+
+
+*********************************
+ibm.qradar.qradar_analytics_rules
+*********************************
+
+**Qradar Analytics Rules Management resource module**
+
+
+Version added: 2.1.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+Synopsis
+--------
+- This module allows for modification, deletion, and checking of Analytics Rules in QRadar
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="2">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>config</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">dictionary</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>A dictionary of Qradar Analytics Rules options</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>enabled</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>Check if the rule is enabled</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>fields</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">list</span>
+ / <span style="color: purple">elements=string</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>average_capacity</li>
+ <li>base_capacity</li>
+ <li>base_host_id</li>
+ <li>capacity_timestamp</li>
+ <li>creation_date</li>
+ <li>enabled</li>
+ <li>id</li>
+ <li>identifier</li>
+ <li>linked_rule_identifier</li>
+ <li>modification_date</li>
+ <li>name</li>
+ <li>origin</li>
+ <li>owner</li>
+ <li>type</li>
+ </ul>
+ </td>
+ <td>
+ <div>List of params filtered from the Rule config</div>
+ <div>NOTE, this param is valid only via state GATHERED.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The sequence ID of the rule.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The name of the rule.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>owner</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Manage ownership of a QRadar Rule</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>range</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Parameter to restrict the number of elements that are returned in the list to a specified range.</div>
+ <div>NOTE, this param is valid only via state GATHERED.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>state</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>merged</li>
+ <li>gathered</li>
+ <li>deleted</li>
+ </ul>
+ </td>
+ <td>
+ <div>The state the configuration should be left in</div>
+ <div>The state <em>gathered</em> will get the module API configuration from the device and transform it into structured data in the format as per the module argspec and the value is returned in the <em>gathered</em> key within the result.</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+
+
+Examples
+--------
+
+.. code-block:: yaml
+
+ # Using MERGED state
+ # -------------------
+
+ - name: DISABLE Rule 'Ansible Example DDoS Rule'
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ name: 'Ansible Example DDOS Rule'
+ enabled: false
+ state: merged
+
+ # RUN output:
+ # -----------
+
+ # qradar_analytics_rules:
+ # after:
+ # average_capacity: null
+ # base_capacity: null
+ # base_host_id: null
+ # capacity_timestamp: null
+ # creation_date: 1658929682568
+ # enabled: false
+ # id: 100443
+ # identifier: ae5a1268-02a0-4976-84c5-dbcbcf854b9c
+ # linked_rule_identifier: null
+ # modification_date: 1658929682567
+ # name: Ansible Example DDOS Rule
+ # origin: USER
+ # owner: admin
+ # type: EVENT
+ # before:
+ # average_capacity: null
+ # base_capacity: null
+ # base_host_id: null
+ # capacity_timestamp: null
+ # creation_date: 1658929682568
+ # enabled: true
+ # id: 100443
+ # identifier: ae5a1268-02a0-4976-84c5-dbcbcf854b9c
+ # linked_rule_identifier: null
+ # modification_date: 1658929682567
+ # name: Ansible Example DDOS Rule
+ # origin: USER
+ # owner: admin
+ # type: EVENT
+
+
+ # Using GATHERED state
+ # --------------------
+
+ - name: Get information about the Rule named "Ansible Example DDOS Rule"
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ name: "Ansible Example DDOS Rule"
+ state: gathered
+
+ # RUN output:
+ # -----------
+
+ # gathered:
+ # average_capacity: null
+ # base_capacity: null
+ # base_host_id: null
+ # capacity_timestamp: null
+ # creation_date: 1658918848694
+ # enabled: true
+ # id: 100443
+ # identifier: d6d37942-ba28-438f-b909-120df643a992
+ # linked_rule_identifier: null
+ # modification_date: 1658918848692
+ # name: Ansible Example DDOS Rule
+ # origin: USER
+ # owner: admin
+ # type: EVENT
+
+ - name: Get information about the Rule with ID 100443
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ id: 100443
+ state: gathered
+
+ # RUN output:
+ # -----------
+
+ # gathered:
+ # average_capacity: null
+ # base_capacity: null
+ # base_host_id: null
+ # capacity_timestamp: null
+ # creation_date: 1658918848694
+ # enabled: true
+ # id: 100443
+ # identifier: d6d37942-ba28-438f-b909-120df643a992
+ # linked_rule_identifier: null
+ # modification_date: 1658918848692
+ # name: Ansible Example DDOS Rule
+ # origin: USER
+ # owner: admin
+ # type: EVENT
+
+ - name: TO Get information about the Rule ID with a range
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ range: 100300-100500
+ fields:
+ - name
+ - origin
+ - owner
+ state: gathered
+
+ # RUN output:
+ # -----------
+
+ # gathered:
+ # - name: Devices with High Event Rates
+ # origin: SYSTEM
+ # owner: admin
+ # - name: Excessive Database Connections
+ # origin: SYSTEM
+ # owner: admin
+ # - name: 'Anomaly: Excessive Firewall Accepts Across Multiple Hosts'
+ # origin: SYSTEM
+ # owner: admin
+ # - name: Excessive Firewall Denies from Single Source
+ # origin: SYSTEM
+ # owner: admin
+ # - name: 'AssetExclusion: Exclude DNS Name By IP'
+ # origin: SYSTEM
+ # owner: admin
+ # - name: 'AssetExclusion: Exclude DNS Name By MAC Address'
+ # origin: SYSTEM
+ # owner: admin
+
+ - name: Delete custom Rule by NAME
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ name: 'Ansible Example DDOS Rule'
+ state: deleted
+
+ # RUN output:
+ # -----------
+
+ # qradar_analytics_rules:
+ # after: {}
+ # before:
+ # average_capacity: null
+ # base_capacity: null
+ # base_host_id: null
+ # capacity_timestamp: null
+ # creation_date: 1658929431239
+ # enabled: true
+ # id: 100444
+ # identifier: 3c2cbd9d-d141-49fc-b5d5-29009a9b5308
+ # linked_rule_identifier: null
+ # modification_date: 1658929431238
+ # name: Ansible Example DDOS Rule
+ # origin: USER
+ # owner: admin
+ # type: EVENT
+
+ # Using DELETED state
+ # -------------------
+
+ - name: Delete custom Rule by ID
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ id: 100443
+ state: deleted
+
+ # RUN output:
+ # -----------
+
+ # qradar_analytics_rules:
+ # after: {}
+ # before:
+ # average_capacity: null
+ # base_capacity: null
+ # base_host_id: null
+ # capacity_timestamp: null
+ # creation_date: 1658929431239
+ # enabled: true
+ # id: 100443
+ # identifier: 3c2cbd9d-d141-49fc-b5d5-29009a9b5308
+ # linked_rule_identifier: null
+ # modification_date: 1658929431238
+ # name: Ansible Example DDOS Rule
+ # origin: USER
+ # owner: admin
+ # type: EVENT
+
+
+
+Return Values
+-------------
+Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Key</th>
+ <th>Returned</th>
+ <th width="100%">Description</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>after</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">dictionary</span>
+ </div>
+ </td>
+ <td>when changed</td>
+ <td>
+ <div>The configuration as structured data after module completion.</div>
+ <br/>
+ <div style="font-size: smaller"><b>Sample:</b></div>
+ <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>before</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">dictionary</span>
+ </div>
+ </td>
+ <td>always</td>
+ <td>
+ <div>The configuration as structured data prior to module invocation.</div>
+ <br/>
+ <div style="font-size: smaller"><b>Sample:</b></div>
+ <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div>
+ </td>
+ </tr>
+ </table>
+ <br/><br/>
+
+
+Status
+------
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@justjais) <https://github.com/ansible-security>
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_httpapi.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_httpapi.rst
new file mode 100644
index 000000000..bd0729fc5
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_httpapi.rst
@@ -0,0 +1,43 @@
+.. _ibm.qradar.qradar_httpapi:
+
+
+*****************
+ibm.qradar.qradar
+*****************
+
+**HttpApi Plugin for IBM QRadar**
+
+
+Version added: 1.0.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+Synopsis
+--------
+- This HttpApi plugin provides methods to connect to IBM QRadar over a HTTP(S)-based api.
+
+
+
+
+
+
+
+
+
+
+
+Status
+------
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Team (@ansible-security)
+
+
+.. hint::
+ Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_log_sources_management_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_log_sources_management_module.rst
new file mode 100644
index 000000000..f8611f8dd
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_log_sources_management_module.rst
@@ -0,0 +1,922 @@
+.. _ibm.qradar.qradar_log_sources_management_module:
+
+
+****************************************
+ibm.qradar.qradar_log_sources_management
+****************************************
+
+**Qradar Log Sources Management resource module**
+
+
+Version added: 2.1.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+Synopsis
+--------
+- This module allows for addition, deletion, or modification of Log Sources in QRadar
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="3">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>config</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">list</span>
+ / <span style="color: purple">elements=dictionary</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>A dictionary of Qradar Log Sources options</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>average_eps</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The average events per second (EPS) rate of the log source over the last 60 seconds.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>coalesce_events</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>If events collected by this log source are coalesced based on common properties, the condition is set to &#x27;true&#x27;. If each individual event is stored, then the condition is set to &#x27;false&#x27;.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>description</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Description of log source</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>enabled</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>If the log source is enabled, the condition is set to &#x27;true&#x27;; otherwise, the condition is set to &#x27;false&#x27;.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>gateway</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>If the log source is configured as a gateway, the condition is set to &#x27;true&#x27;; otherwise, the condition is set to &#x27;false&#x27;. A gateway log source is a stand-alone protocol configuration. The log source receives no events itself, and serves as a host for a protocol configuration that retrieves event data to feed other log sources. It acts as a &quot;gateway&quot; for events from multiple systems to enter the event pipeline.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>group_ids</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">list</span>
+ / <span style="color: purple">elements=string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The set of log source group IDs this log source is a member of. Each ID must correspond to an existing log source group.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>identifier</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Log Source Identifier (Typically IP Address or Hostname of log source)</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>internal</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>If the log source is internal (when the log source type is defined as internal), the condition is set to &#x27;true&#x27;.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>language_id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The language of the events that are being processed by this log source. Must correspond to an existing log source language. Individual log source types can support only a subset of all available log source languages, as indicated by the supported_language_ids field of the log source type structure</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Name of Log Source</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>protocol_parameters</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">list</span>
+ / <span style="color: purple">elements=dictionary</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The set of protocol parameters</div>
+ <div>If not provided module will set the protocol parameters by itself</div>
+ <div>Note, parameter will come to use mostly in case when facts are gathered and fired with some modifications to params or in case of round trip scenarios.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The ID of the protocol type.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The unique name of the protocol type.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>value</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The allowed protocol value.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>protocol_type_id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Type of protocol by id, as defined in QRadar Log Source Types Documentation</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>requires_deploy</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>Set to &#x27;true&#x27; if you need to deploy changes to enable the log source for use; otherwise, set to &#x27;false&#x27; if the log source is already active.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>status</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">dictionary</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The status of the log source.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>last_updated</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>last_updated</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>messages</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>last_updated</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td class="elbow-placeholder"></td>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>status</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>last_updated</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>store_event_payload</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">boolean</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>no</li>
+ <li>yes</li>
+ </ul>
+ </td>
+ <td>
+ <div>If the payloads of events that are collected by this log source are stored, the condition is set to &#x27;true&#x27;. If only the normalized event records are stored, then the condition is set to &#x27;false&#x27;.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>target_event_collector_id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The ID of the event collector where the log source sends its data. The ID must correspond to an existing event collector.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>type_id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>The type of the log source. Must correspond to an existing log source type.</div>
+ </td>
+ </tr>
+ <tr>
+ <td class="elbow-placeholder"></td>
+ <td colspan="2">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>type_name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Type of resource by name</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="3">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>state</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>merged</li>
+ <li>replaced</li>
+ <li>gathered</li>
+ <li>deleted</li>
+ </ul>
+ </td>
+ <td>
+ <div>The state the configuration should be left in</div>
+ <div>The state <em>gathered</em> will get the module API configuration from the device and transform it into structured data in the format as per the module argspec and the value is returned in the <em>gathered</em> key within the result.</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+
+
+Examples
+--------
+
+.. code-block:: yaml
+
+ # Using MERGED state
+ # -------------------
+
+ - name: Add Snort n Apache log sources to IBM QRadar
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.0.2.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "Apache HTTP Server remote logs from rsyslog"
+ identifier: "198.51.100.1"
+ state: merged
+
+ # RUN output:
+ # -----------
+
+ # qradar_log_sources_management:
+ # after:
+ # - auto_discovered: false
+ # average_eps: 0
+ # coalesce_events: true
+ # creation_date: 1654727311444
+ # credibility: 5
+ # description: Snort IDS remote logs from rsyslog
+ # enabled: true
+ # gateway: false
+ # group_ids:
+ # - 0
+ # id: 181
+ # internal: false
+ # language_id: 1
+ # last_event_time: 0
+ # log_source_extension_id: null
+ # modified_date: 1654727311444
+ # name: Snort logs
+ # protocol_parameters:
+ # - id: 1
+ # name: incomingPayloadEncoding
+ # value: UTF-8
+ # - id: 0
+ # name: identifier
+ # value: 192.0.2.1
+ # protocol_type_id: 0
+ # requires_deploy: true
+ # status:
+ # last_updated: 0
+ # messages: null
+ # status: NA
+ # store_event_payload: true
+ # target_event_collector_id: 7
+ # type_id: 2
+ # wincollect_external_destination_ids: null
+ # wincollect_internal_destination_id: null
+ # - auto_discovered: false
+ # average_eps: 0
+ # coalesce_events: true
+ # creation_date: 1654727311462
+ # credibility: 5
+ # description: Apache HTTP Server remote logs from rsyslog
+ # enabled: true
+ # gateway: false
+ # group_ids:
+ # - 0
+ # id: 182
+ # internal: false
+ # language_id: 1
+ # last_event_time: 0
+ # log_source_extension_id: null
+ # modified_date: 1654727311462
+ # name: Apache HTTP Server logs
+ # protocol_parameters:
+ # - id: 1
+ # name: incomingPayloadEncoding
+ # value: UTF-8
+ # - id: 0
+ # name: identifier
+ # value: 198.51.100.1
+ # protocol_type_id: 0
+ # requires_deploy: true
+ # status:
+ # last_updated: 0
+ # messages: null
+ # status: NA
+ # store_event_payload: true
+ # target_event_collector_id: 7
+ # type_id: 10
+ # wincollect_external_destination_ids: null
+ # wincollect_internal_destination_id: null
+ # before: []
+
+ # Using REPLACED state
+ # --------------------
+
+ - name: Replace existing Log sources to IBM QRadar
+ ibm.qradar.qradar_log_sources_management:
+ state: replaced
+ config:
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "REPLACED Apache HTTP Server remote logs from rsyslog"
+ identifier: "192.0.2.1"
+
+ # RUN output:
+ # -----------
+
+ # qradar_log_sources_management:
+ # after:
+ # - auto_discovered: false
+ # average_eps: 0
+ # coalesce_events: true
+ # creation_date: 1654727944017
+ # credibility: 5
+ # description: REPLACED Apache HTTP Server remote logs from rsyslog
+ # enabled: true
+ # gateway: false
+ # group_ids:
+ # - 0
+ # id: 183
+ # internal: false
+ # language_id: 1
+ # last_event_time: 0
+ # log_source_extension_id: null
+ # modified_date: 1654727944017
+ # name: Apache HTTP Server logs
+ # protocol_parameters:
+ # - id: 1
+ # name: incomingPayloadEncoding
+ # value: UTF-8
+ # - id: 0
+ # name: identifier
+ # value: 192.0.2.1
+ # protocol_type_id: 0
+ # requires_deploy: true
+ # status:
+ # last_updated: 0
+ # messages: null
+ # status: NA
+ # store_event_payload: true
+ # target_event_collector_id: 7
+ # type_id: 10
+ # wincollect_external_destination_ids: null
+ # wincollect_internal_destination_id: null
+ # before:
+ # - auto_discovered: false
+ # average_eps: 0
+ # coalesce_events: true
+ # creation_date: 1654727311462
+ # credibility: 5
+ # description: Apache HTTP Server remote logs from rsyslog
+ # enabled: true
+ # gateway: false
+ # group_ids:
+ # - 0
+ # id: 182
+ # internal: false
+ # language_id: 1
+ # last_event_time: 0
+ # log_source_extension_id: null
+ # modified_date: 1654727311462
+ # name: Apache HTTP Server logs
+ # protocol_parameters:
+ # - name: identifier
+ # value: 198.51.100.1
+ # - name: incomingPayloadEncoding
+ # value: UTF-8
+ # protocol_type_id: 0
+ # requires_deploy: true
+ # status:
+ # last_updated: 0
+ # messages: null
+ # status: NA
+ # store_event_payload: true
+ # target_event_collector_id: 7
+ # type_id: 10
+ # wincollect_external_destination_ids: null
+ # wincollect_internal_destination_id: null
+
+ # Using GATHERED state
+ # --------------------
+
+ - name: Gather Snort n Apache log source from IBM QRadar
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: gathered
+
+ # RUN output:
+ # -----------
+
+ # gathered:
+ # - auto_discovered: false
+ # average_eps: 0
+ # coalesce_events: true
+ # creation_date: 1654727311444
+ # credibility: 5
+ # description: Snort IDS remote logs from rsyslog
+ # enabled: true
+ # gateway: false
+ # group_ids:
+ # - 0
+ # id: 181
+ # internal: false
+ # language_id: 1
+ # last_event_time: 0
+ # log_source_extension_id: null
+ # modified_date: 1654728103340
+ # name: Snort logs
+ # protocol_parameters:
+ # - id: 0
+ # name: identifier
+ # value: 192.0.2.1
+ # - id: 1
+ # name: incomingPayloadEncoding
+ # value: UTF-8
+ # protocol_type_id: 0
+ # requires_deploy: true
+ # status:
+ # last_updated: 0
+ # messages: null
+ # status: NA
+ # store_event_payload: true
+ # target_event_collector_id: 7
+ # type_id: 2
+ # wincollect_external_destination_ids: null
+ # wincollect_internal_destination_id: null
+ # - auto_discovered: false
+ # average_eps: 0
+ # coalesce_events: true
+ # creation_date: 1654727944017
+ # credibility: 5
+ # description: Apache HTTP Server remote logs from rsyslog
+ # enabled: true
+ # gateway: false
+ # group_ids:
+ # - 0
+ # id: 183
+ # internal: false
+ # language_id: 1
+ # last_event_time: 0
+ # log_source_extension_id: null
+ # modified_date: 1654728103353
+ # name: Apache HTTP Server logs
+ # protocol_parameters:
+ # - id: 0
+ # name: identifier
+ # value: 192.0.2.1
+ # - id: 1
+ # name: incomingPayloadEncoding
+ # value: UTF-8
+ # protocol_type_id: 0
+ # requires_deploy: true
+ # status:
+ # last_updated: 0
+ # messages: null
+ # status: NA
+ # store_event_payload: true
+ # target_event_collector_id: 7
+ # type_id: 10
+ # wincollect_external_destination_ids: null
+ # wincollect_internal_destination_id: null
+
+ - name: TO Gather ALL log sources from IBM QRadar
+ tags: gather_log_all
+ ibm.qradar.qradar_log_sources_management:
+ state: gathered
+
+ # Using DELETED state
+ # -------------------
+
+ - name: Delete Snort n Apache log source from IBM QRadar
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: deleted
+
+ # RUN output:
+ # -----------
+
+ # qradar_log_sources_management:
+ # after: []
+ # before:
+ # - auto_discovered: false
+ # average_eps: 0
+ # coalesce_events: true
+ # creation_date: 1654727311444
+ # credibility: 5
+ # description: Snort IDS remote logs from rsyslog
+ # enabled: true
+ # gateway: false
+ # group_ids:
+ # - 0
+ # id: 181
+ # internal: false
+ # language_id: 1
+ # last_event_time: 0
+ # log_source_extension_id: null
+ # modified_date: 1654728103340
+ # name: Snort logs
+ # protocol_parameters:
+ # - id: 0
+ # name: identifier
+ # value: 192.0.2.1
+ # - id: 1
+ # name: incomingPayloadEncoding
+ # value: UTF-8
+ # protocol_type_id: 0
+ # requires_deploy: true
+ # status:
+ # last_updated: 0
+ # messages: null
+ # status: NA
+ # store_event_payload: true
+ # target_event_collector_id: 7
+ # type_id: 2
+ # wincollect_external_destination_ids: null
+ # wincollect_internal_destination_id: null
+ # - auto_discovered: false
+ # average_eps: 0
+ # coalesce_events: true
+ # creation_date: 1654727944017
+ # credibility: 5
+ # description: Apache HTTP Server remote logs from rsyslog
+ # enabled: true
+ # gateway: false
+ # group_ids:
+ # - 0
+ # id: 183
+ # internal: false
+ # language_id: 1
+ # last_event_time: 0
+ # log_source_extension_id: null
+ # modified_date: 1654728103353
+ # name: Apache HTTP Server logs
+ # protocol_parameters:
+ # - id: 0
+ # name: identifier
+ # value: 192.0.2.1
+ # - id: 1
+ # name: incomingPayloadEncoding
+ # value: UTF-8
+ # protocol_type_id: 0
+ # requires_deploy: true
+ # status:
+ # last_updated: 0
+ # messages: null
+ # status: NA
+ # store_event_payload: true
+ # target_event_collector_id: 7
+ # type_id: 10
+ # wincollect_external_destination_ids: null
+ # wincollect_internal_destination_id: null
+
+
+
+Return Values
+-------------
+Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Key</th>
+ <th>Returned</th>
+ <th width="100%">Description</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>after</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">list</span>
+ </div>
+ </td>
+ <td>when changed</td>
+ <td>
+ <div>The configuration as structured data after module completion.</div>
+ <br/>
+ <div style="font-size: smaller"><b>Sample:</b></div>
+ <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="return-"></div>
+ <b>before</b>
+ <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
+ <div style="font-size: small">
+ <span style="color: purple">list</span>
+ </div>
+ </td>
+ <td>always</td>
+ <td>
+ <div>The configuration as structured data prior to module invocation.</div>
+ <br/>
+ <div style="font-size: smaller"><b>Sample:</b></div>
+ <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div>
+ </td>
+ </tr>
+ </table>
+ <br/><br/>
+
+
+Status
+------
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@justjais) <https://github.com/ansible-security>
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_info_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_info_module.rst
new file mode 100644
index 000000000..ec4d9fc88
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_info_module.rst
@@ -0,0 +1,169 @@
+.. _ibm.qradar.rule_info_module:
+
+
+********************
+ibm.qradar.rule_info
+********************
+
+**Obtain information about one or many QRadar Rules, with filter options**
+
+
+Version added: 1.0.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+DEPRECATED
+----------
+:Removed in collection release after 2024-09-01
+:Why: Newer and updated modules released with more functionality.
+:Alternative: qradar_analytics_rules
+
+
+
+Synopsis
+--------
+- This module obtains information about one or many QRadar Rules, with filter options
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Obtain only information of the Rule with provided ID</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Obtain only information of the Rule that matches the provided name</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>origin</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>SYSTEM</li>
+ <li>OVERRIDE</li>
+ <li>USER</li>
+ </ul>
+ </td>
+ <td>
+ <div>Obtain only information of Rules that are of a certain origin</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>owner</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Obtain only information of Rules owned by a certain user</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>type</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>EVENT</li>
+ <li>FLOW</li>
+ <li>COMMON</li>
+ <li>USER</li>
+ </ul>
+ </td>
+ <td>
+ <div>Obtain only information for the Rules of a certain type</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+Notes
+-----
+
+.. note::
+ - You may provide many filters and they will all be applied, except for ``id`` as that will return only the Rule identified by the unique ID provided.
+
+
+
+Examples
+--------
+
+.. code-block:: yaml
+
+ - 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
+
+
+
+
+Status
+------
+
+
+- This module will be removed in a release after 2024-09-01. *[deprecated]*
+- For more information see `DEPRECATED`_.
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>"
diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_module.rst
new file mode 100644
index 000000000..d6dae97c5
--- /dev/null
+++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_module.rst
@@ -0,0 +1,139 @@
+.. _ibm.qradar.rule_module:
+
+
+***************
+ibm.qradar.rule
+***************
+
+**Manage state of QRadar Rules, with filter options**
+
+
+Version added: 1.0.0
+
+.. contents::
+ :local:
+ :depth: 1
+
+DEPRECATED
+----------
+:Removed in collection release after 2024-09-01
+:Why: Newer and updated modules released with more functionality.
+:Alternative: qradar_analytics_rules
+
+
+
+Synopsis
+--------
+- Manage state of QRadar Rules, with filter options
+
+
+
+
+Parameters
+----------
+
+.. raw:: html
+
+ <table border=0 cellpadding=0 class="documentation-table">
+ <tr>
+ <th colspan="1">Parameter</th>
+ <th>Choices/<font color="blue">Defaults</font></th>
+ <th width="100%">Comments</th>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>id</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">integer</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Manage state of a QRadar Rule by ID</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>name</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Manage state of a QRadar Rule by name</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>owner</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ </div>
+ </td>
+ <td>
+ </td>
+ <td>
+ <div>Manage ownership of a QRadar Rule</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="1">
+ <div class="ansibleOptionAnchor" id="parameter-"></div>
+ <b>state</b>
+ <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
+ <div style="font-size: small">
+ <span style="color: purple">string</span>
+ / <span style="color: red">required</span>
+ </div>
+ </td>
+ <td>
+ <ul style="margin: 0; padding: 0"><b>Choices:</b>
+ <li>enabled</li>
+ <li>disabled</li>
+ <li>absent</li>
+ </ul>
+ </td>
+ <td>
+ <div>Manage state of a QRadar Rule</div>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+
+
+
+Examples
+--------
+
+.. code-block:: yaml
+
+ - name: Enable Rule 'Ansible Example DDoS Rule'
+ qradar_rule:
+ name: 'Ansible Example DDOS Rule'
+ state: enabled
+
+
+
+
+Status
+------
+
+
+- This module will be removed in a release after 2024-09-01. *[deprecated]*
+- For more information see `DEPRECATED`_.
+
+
+Authors
+~~~~~~~
+
+- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
diff --git a/ansible_collections/ibm/qradar/meta/runtime.yml b/ansible_collections/ibm/qradar/meta/runtime.yml
new file mode 100644
index 000000000..157f6c130
--- /dev/null
+++ b/ansible_collections/ibm/qradar/meta/runtime.yml
@@ -0,0 +1,34 @@
+---
+plugin_routing:
+ action:
+ rule:
+ redirect: ibm.qradar.qradar
+ rule_info:
+ redirect: ibm.qradar.qradar
+ log_source_management:
+ redirect: ibm.qradar.qradar
+ qradar_analytics_rules:
+ redirect: ibm.qradar.qradar
+ qradar_log_sources_management:
+ redirect: ibm.qradar.qradar
+ modules:
+ rule:
+ deprecation:
+ removal_date: "2024-09-01"
+ warning_text: See the plugin documentation for more details
+ redirect: ibm.qradar.qradar_rule
+ rule_info:
+ deprecation:
+ removal_date: "2024-09-01"
+ warning_text: See the plugin documentation for more details
+ redirect: ibm.qradar.qradar_rule_info
+ analytics_rules:
+ redirect: ibm.qradar.qradar_analytics_rules
+ log_source_management:
+ deprecation:
+ removal_date: "2024-09-01"
+ warning_text: See the plugin documentation for more details
+ redirect: ibm.qradar.qradar_log_source_management
+ log_sources_management:
+ redirect: ibm.qradar.qradar_log_sources_management
+requires_ansible: '>=2.9.10'
diff --git a/ansible_collections/ibm/qradar/plugins/action/__init__.py b/ansible_collections/ibm/qradar/plugins/action/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/action/__init__.py
diff --git a/ansible_collections/ibm/qradar/plugins/action/qradar_analytics_rules.py b/ansible_collections/ibm/qradar/plugins/action/qradar_analytics_rules.py
new file mode 100644
index 000000000..906cbc9e5
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/action/qradar_analytics_rules.py
@@ -0,0 +1,226 @@
+#
+# Copyright 2022 Red Hat Inc.
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+#
+
+"""
+The module file for qradar_analytics_rules
+"""
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+import json
+from ansible.plugins.action import ActionBase
+from ansible.module_utils.connection import Connection
+from ansible.module_utils._text import to_text
+from ansible.module_utils.six.moves.urllib.parse import quote
+
+from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import (
+ utils,
+)
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+ remove_unsupported_keys_from_payload_dict,
+)
+from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import (
+ AnsibleArgSpecValidator,
+)
+from ansible_collections.ibm.qradar.plugins.modules.qradar_analytics_rules import (
+ DOCUMENTATION,
+)
+
+
+class ActionModule(ActionBase):
+ """action module"""
+
+ def __init__(self, *args, **kwargs):
+ super(ActionModule, self).__init__(*args, **kwargs)
+ self._supports_async = True
+ self._result = None
+ self.api_object = "/api/analytics/rules"
+ self.api_return = "rules_management"
+ self.module_return = "qradar_analytics_rules"
+ self.supported_params = [
+ "id",
+ "name",
+ "enabled",
+ "owner",
+ "fields",
+ "range",
+ ]
+
+ def _check_argspec(self):
+ aav = AnsibleArgSpecValidator(
+ data=self._task.args,
+ schema=DOCUMENTATION,
+ schema_format="doc",
+ name=self._task.action,
+ )
+ valid, errors, self._task.args = aav.validate()
+ if not valid:
+ self._result["failed"] = True
+ self._result["msg"] = errors
+
+ def search_for_resource(self, qradar_request, search_for_resource=None):
+ """The fn TC of GATHER operation
+ :param qradar_request: Qradar connection request
+ :param search_for_resource: Module input config with either ID, NAME, or RANGE with field input
+ :rtype: A dict
+ :returns: dict with module prams transformed having API expected params
+ """
+ if search_for_resource.get("id"):
+ api_obj_url = self.api_object + "/{0}".format(
+ search_for_resource["id"]
+ )
+ elif search_for_resource.get("name"):
+ api_obj_url = self.api_object + "?filter={0}".format(
+ quote(
+ 'name="{0}"'.format(to_text(search_for_resource["name"]))
+ )
+ )
+ elif search_for_resource.get("range"):
+ api_obj_url = self.api_object
+ if search_for_resource.get("fields"):
+ fields = ",".join(search_for_resource["fields"])
+ fields_url = "?fields={0}".format(quote("{0}".format(fields)))
+ api_obj_url += fields_url
+ code, rule_source_exists = qradar_request.get(api_obj_url)
+ if (
+ rule_source_exists
+ and len(rule_source_exists) == 1
+ and (
+ search_for_resource.get("name")
+ and not search_for_resource.get("id")
+ )
+ ):
+ rule_source_exists = rule_source_exists[0]
+ return rule_source_exists
+
+ def delete_module_api_config(self, qradar_request, module_config_params):
+ """The fn TC of DELETE operation
+ :param qradar_request: Qradar connection request
+ :param module_config_params: Module input config
+ :rtype: A dict
+ :returns: Delete output with before and after dict
+ """
+ config = {}
+ before = {}
+ after = {}
+ changed = False
+ rule_exists = self.search_for_resource(
+ qradar_request, module_config_params
+ )
+ if rule_exists:
+ changed = True
+ before = rule_exists
+ code, qradar_return_data = qradar_request.delete(
+ self.api_object + "/{0}".format(rule_exists["id"])
+ )
+ config.update({"before": before, "after": after})
+ else:
+ config.update({"before": before})
+ return config, changed
+
+ def configure_module_api(self, qradar_request, module_config_params):
+ """The fn TC of MERGE operation
+ :param qradar_request: Qradar connection request
+ :param module_config_params: Module input config
+ :rtype: A dict
+ :returns: Merge output with before and after dict
+ """
+ config = {}
+ before = {}
+ changed = False
+
+ rule_exists = self.search_for_resource(
+ qradar_request, module_config_params
+ )
+ if rule_exists:
+ if isinstance(rule_exists, list):
+ for each in rule_exists:
+ if each.get("origin") == "OVERRIDE":
+ rule_exists = each
+ break
+ before = rule_exists
+ module_config_params = utils.remove_empties(module_config_params)
+ diff = utils.dict_diff(rule_exists, module_config_params)
+ if diff:
+ changed = True
+ qradar_return_data = qradar_request.post_by_path(
+ self.api_object + "/{0}".format(rule_exists["id"]),
+ data=json.dumps(diff),
+ )
+ if qradar_return_data[0] >= 200:
+ config.update(
+ {"before": before, "after": qradar_return_data[1]}
+ )
+ else:
+ config.update({"before": before})
+ return config, changed
+
+ def run(self, tmp=None, task_vars=None):
+ self._supports_check_mode = True
+ self._result = super(ActionModule, self).run(tmp, task_vars)
+ headers = None
+ if self._task.args.get("config"):
+ self._task.args[
+ "config"
+ ] = remove_unsupported_keys_from_payload_dict(
+ self._task.args["config"], self.supported_params
+ )
+ self._check_argspec()
+ if self._result.get("failed"):
+ return self._result
+ if self._task.args["config"].get("range"):
+ headers = {
+ "Content-Type": "application/json",
+ "Range": "items={0}".format(
+ self._task.args["config"]["range"]
+ ),
+ }
+ conn = Connection(self._connection.socket_path)
+ if headers:
+ conn_request = QRadarRequest(
+ connection=conn, headers=headers, task_vars=task_vars
+ )
+ else:
+ conn_request = QRadarRequest(connection=conn, task_vars=task_vars)
+ if self._task.args["state"] == "gathered":
+ if self._task.args.get("config"):
+ self._result["gathered"] = self.search_for_resource(
+ conn_request, self._task.args["config"]
+ )
+ elif self._task.args["state"] == "merged":
+ if self._task.args.get("config"):
+ (
+ self._result[self.module_return],
+ self._result["changed"],
+ ) = self.configure_module_api(
+ conn_request, self._task.args["config"]
+ )
+ elif self._task.args["state"] == "deleted":
+ if self._task.args.get("config"):
+ (
+ self._result[self.module_return],
+ self._result["changed"],
+ ) = self.delete_module_api_config(
+ conn_request, self._task.args["config"]
+ )
+
+ return self._result
diff --git a/ansible_collections/ibm/qradar/plugins/action/qradar_log_sources_management.py b/ansible_collections/ibm/qradar/plugins/action/qradar_log_sources_management.py
new file mode 100644
index 000000000..5d5efcd5e
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/action/qradar_log_sources_management.py
@@ -0,0 +1,306 @@
+#
+# Copyright 2022 Red Hat Inc.
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+#
+
+"""
+The module file for qradar_log_sources_management
+"""
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+from copy import copy
+import json
+from ansible.plugins.action import ActionBase
+from ansible.errors import AnsibleActionFail
+from ansible.module_utils.connection import Connection
+from ansible.module_utils.six.moves.urllib.parse import quote
+
+from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import (
+ utils,
+)
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+ find_dict_in_list,
+ list_to_dict,
+ remove_unsupported_keys_from_payload_dict,
+)
+from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import (
+ AnsibleArgSpecValidator,
+)
+from ansible_collections.ibm.qradar.plugins.modules.qradar_log_sources_management import (
+ DOCUMENTATION,
+)
+
+
+class ActionModule(ActionBase):
+ """action module"""
+
+ def __init__(self, *args, **kwargs):
+ super(ActionModule, self).__init__(*args, **kwargs)
+ self._result = None
+ self.api_object = (
+ "/api/config/event_sources/log_source_management/log_sources"
+ )
+ self.api_object_types = "/api/config/event_sources/log_source_management/log_source_types?filter="
+ self.api_object_search = "/api/config/event_sources/log_source_management/log_sources?filter="
+ self.api_return = "log_sources_management"
+ self.module_return = "qradar_log_sources_management"
+ self.supported_params = [
+ "name",
+ "description",
+ "type_name",
+ "type_id",
+ "identifier",
+ "protocol_type_id",
+ "enabled",
+ "gateway",
+ "internal",
+ "target_event_collector_id",
+ "coalesce_events",
+ "store_event_payload",
+ "language_id",
+ "group_ids",
+ "requires_deploy",
+ "status",
+ "average_eps",
+ "protocol_parameters",
+ ]
+
+ def _check_argspec(self):
+ aav = AnsibleArgSpecValidator(
+ data=self._task.args,
+ schema=DOCUMENTATION,
+ schema_format="doc",
+ name=self._task.action,
+ )
+ valid, errors, self._task.args = aav.validate()
+ if not valid:
+ self._result["failed"] = True
+ self._result["msg"] = errors
+
+ def set_log_source_values(self, qradar_request, config_params):
+ # find log source types details
+ if config_params.get("type_name"):
+
+ api_object = self.api_object_types + "{0}".format(
+ quote('name="{0}"'.format(config_params["type_name"]))
+ )
+ code, log_source_type_found = qradar_request.get(api_object)
+ if config_params.get("type_id"):
+ log_source_type_found = []
+ if config_params.get("group_ids"):
+ del config_params["group_ids"]
+ elif log_source_type_found and not config_params.get("type_id"):
+ config_params["type_id"] = log_source_type_found[0]["id"]
+ config_params.pop("type_name")
+ else:
+ raise AnsibleActionFail(
+ "Incompatible type provided, please consult QRadar Documentation for Log Source Types!"
+ )
+
+ if log_source_type_found:
+ if config_params.get("protocol_type_id"):
+ found_dict_in_list, _fdil_index = find_dict_in_list(
+ log_source_type_found[0]["protocol_types"],
+ "protocol_id",
+ config_params["protocol_type_id"],
+ )
+ if not found_dict_in_list:
+ config_params.fail_json(
+ msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types"
+ )
+ elif log_source_type_found[0].get("protocol_types"):
+ # Set it to the default as provided by the QRadar Instance
+ protocol_type_id = 0
+ for each in log_source_type_found[0]["protocol_types"]:
+ if each.get("protocol_id") == 0 and each.get("documented"):
+ protocol_type_id = 0
+ break
+ elif each.get("documented"):
+ protocol_type_id = each["protocol_id"]
+ config_params["protocol_type_id"] = protocol_type_id
+
+ config_params["protocol_parameters"] = [
+ {
+ "id": config_params["protocol_type_id"],
+ "name": "identifier",
+ "value": config_params["identifier"],
+ }
+ ]
+ config_params.pop("identifier")
+ return config_params
+
+ def search_for_resource_name(
+ self, qradar_request, search_resource_by_names=None
+ ):
+ search_result = []
+ if isinstance(search_resource_by_names, list):
+ for each in search_resource_by_names:
+ each = utils.remove_empties(each)
+ query_api_object = self.api_object_search + "{0}".format(
+ quote('name="{0}"'.format(each["name"]))
+ )
+ code, log_source_exists = qradar_request.get(query_api_object)
+ if log_source_exists and (code >= 200 and code < 300):
+ search_result.append(log_source_exists[0])
+ elif isinstance(search_resource_by_names, str):
+ query_api_object = self.api_object_search + "{0}".format(
+ quote('name="{0}"'.format(search_resource_by_names))
+ )
+ code, log_source_exists = qradar_request.get(query_api_object)
+ if log_source_exists and (code >= 200 and code < 300):
+ search_result.append(log_source_exists[0])
+ return search_result[0]
+ else:
+ code, log_source_exists = qradar_request.get(self.api_object)
+ if log_source_exists and (code >= 200 and code < 300):
+ search_result = log_source_exists
+ return search_result
+
+ def delete_module_api_config(self, qradar_request, module_config_params):
+ config = {}
+ before = []
+ after = []
+ changed = False
+ for each in module_config_params:
+ each = utils.remove_empties(each)
+ log_source_exists = self.search_for_resource_name(
+ qradar_request, each["name"]
+ )
+ if log_source_exists:
+ before.append(log_source_exists)
+ query_object = self.api_object + "/{0}".format(
+ log_source_exists["id"]
+ )
+ code, qradar_return_data = qradar_request.delete(query_object)
+ if code >= 200 and code < 300:
+ changed = True
+ config.update({"before": before, "after": after})
+ else:
+ config.update({"before": before})
+ return config, changed
+
+ def configure_module_api(self, conn_request, module_config_params):
+ config = {}
+ before = []
+ after = []
+ changed = False
+ temp_request_param = []
+ for each in module_config_params:
+ each = utils.remove_empties(each)
+ each = self.set_log_source_values(conn_request, each)
+ search_result = self.search_for_resource_name(
+ conn_request, each["name"]
+ )
+ if search_result:
+ if search_result["name"] == each["name"]:
+ temp_each = copy(each)
+ temp_search_result = copy(search_result)
+ list_to_dict(temp_each)
+ list_to_dict(temp_search_result)
+ diff = utils.dict_diff(temp_search_result, temp_each)
+ if diff:
+ if self._task.args["state"] == "merged":
+ each = utils.remove_empties(
+ utils.dict_merge(search_result, each)
+ )
+ temp_request_param.append(each)
+ elif self._task.args["state"] == "replaced":
+ query_object = self.api_object + "/{0}".format(
+ search_result["id"]
+ )
+ code, qradar_return_data = conn_request.delete(
+ query_object
+ )
+ temp_request_param.append(each)
+ else:
+ after.append(search_result)
+ before.append(search_result)
+ else:
+ each = utils.remove_empties(each)
+ temp_request_param.append(each)
+ if temp_request_param:
+ code, response = conn_request.create_update(
+ self.api_object,
+ data=json.dumps(temp_request_param),
+ )
+ if code >= 200 and code < 300:
+ changed = True
+ search_result = self.search_for_resource_name(conn_request)
+ for each in temp_request_param:
+ for every in search_result:
+ if each["name"] == every["name"]:
+ after.append(every)
+ break
+ elif code >= 400:
+ raise AnsibleActionFail(
+ "Failed with http_response: {0} and message: {1}".format(
+ response["http_response"]["message"],
+ response["message"],
+ )
+ )
+ config.update({"before": before, "after": after})
+ else:
+ config.update({"before": before})
+
+ return config, changed
+
+ def run(self, tmp=None, task_vars=None):
+ self._supports_check_mode = True
+ self._result = super(ActionModule, self).run(tmp, task_vars)
+ if self._task.args.get("config"):
+ self._task.args[
+ "config"
+ ] = remove_unsupported_keys_from_payload_dict(
+ self._task.args["config"], self.supported_params
+ )
+ self._check_argspec()
+ if self._result.get("failed"):
+ return self._result
+ conn = Connection(self._connection.socket_path)
+ conn_request = QRadarRequest(connection=conn, task_vars=task_vars)
+ if self._task.args["state"] == "gathered":
+ if self._task.args.get("config"):
+ self._result["gathered"] = self.search_for_resource_name(
+ conn_request, self._task.args["config"]
+ )
+ else:
+ self._result["gathered"] = conn_request.get(self.api_object)
+ elif (
+ self._task.args["state"] == "merged"
+ or self._task.args["state"] == "replaced"
+ ):
+ if self._task.args.get("config"):
+ (
+ self._result[self.module_return],
+ self._result["changed"],
+ ) = self.configure_module_api(
+ conn_request, self._task.args["config"]
+ )
+ elif self._task.args["state"] == "deleted":
+ if self._task.args.get("config"):
+ (
+ self._result[self.module_return],
+ self._result["changed"],
+ ) = self.delete_module_api_config(
+ conn_request, self._task.args["config"]
+ )
+
+ return self._result
diff --git a/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py b/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py
new file mode 100644
index 000000000..004c7815e
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py
@@ -0,0 +1,76 @@
+# (c) 2019 Red Hat 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
+
+DOCUMENTATION = """
+---
+author: Ansible Security Team (@ansible-security)
+name: qradar
+short_description: HttpApi Plugin for IBM QRadar
+description:
+ - This HttpApi plugin provides methods to connect to IBM QRadar over a
+ HTTP(S)-based api.
+version_added: "1.0.0"
+"""
+
+import json
+
+from ansible.module_utils.basic import to_text
+from ansible.module_utils.six.moves.urllib.error import HTTPError
+from ansible_collections.ansible.netcommon.plugins.plugin_utils.httpapi_base import (
+ HttpApiBase,
+)
+from ansible.module_utils.connection import ConnectionError
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ BASE_HEADERS,
+)
+
+
+class HttpApi(HttpApiBase):
+ def send_request(self, request_method, path, payload=None, headers=None):
+ headers = headers if headers else BASE_HEADERS
+
+ try:
+ self._display_request(request_method)
+ response, response_data = self.connection.send(
+ path, payload, method=request_method, headers=headers
+ )
+ value = self._get_response_value(response_data)
+
+ return response.getcode(), self._response_to_json(value)
+ except HTTPError as e:
+ error = json.loads(e.read())
+ return e.code, error
+
+ def _display_request(self, request_method):
+ self.connection.queue_message(
+ "vvvv",
+ "Web Services: %s %s" % (request_method, self.connection._url),
+ )
+
+ def _get_response_value(self, response_data):
+ return to_text(response_data.getvalue())
+
+ def _response_to_json(self, response_text):
+ try:
+ return json.loads(response_text) if response_text else {}
+ # JSONDecodeError only available on Python 3.5+
+ except ValueError:
+ raise ConnectionError("Invalid JSON response: %s" % response_text)
+
+ def update_auth(self, response, response_text):
+ cookie = response.info().get("Set-Cookie")
+ # Set the 'SEC' header
+ if "SEC" in cookie:
+ return {"SEC": cookie.split(";")[0].split("=")[-1]}
+
+ return None
+
+ def logout(self):
+ self.send_request("POST", "/auth/logout")
+
+ # Clean up tokens
+ self.connection._auth = None
diff --git a/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py b/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py
new file mode 100644
index 000000000..e1569863f
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py
@@ -0,0 +1,254 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+from ansible.module_utils.urls import CertificateError
+from ansible.module_utils.six.moves.urllib.parse import quote_plus
+from ansible.module_utils.connection import ConnectionError
+from ansible.module_utils.connection import Connection
+from ansible.module_utils._text import to_text
+from ansible.module_utils.six import iteritems
+from copy import copy
+import json
+
+
+BASE_HEADERS = {"Content-Type": "application/json", "Version": "9.1"}
+
+
+def find_dict_in_list(some_list, key, value):
+ text_type = False
+ try:
+ to_text(value)
+ text_type = True
+ except TypeError:
+ pass
+ for some_dict in some_list:
+ if key in some_dict:
+ if text_type:
+ if to_text(some_dict[key]).strip() == to_text(value).strip():
+ return some_dict, some_list.index(some_dict)
+ else:
+ if some_dict[key] == value:
+ return some_dict, some_list.index(some_dict)
+ return None
+
+
+def set_offense_values(module, qradar_request):
+ if module.params["closing_reason"]:
+ found_closing_reason = qradar_request.get_by_path(
+ "api/siem/offense_closing_reasons?filter={0}".format(
+ quote_plus(
+ 'text="{0}"'.format(module.params["closing_reason"])
+ )
+ )
+ )
+ if found_closing_reason:
+ module.params["closing_reason_id"] = found_closing_reason[0]["id"]
+ else:
+ module.fail_json(
+ "Unable to find closing_reason text: {0}".format(
+ module.params["closing_reason"]
+ )
+ )
+
+ if module.params["status"]:
+ module.params["status"] = module.params["status"].upper()
+
+
+def remove_unsupported_keys_from_payload_dict(payload, supported_key_list):
+ """The fn to remove the unsupported keys from payload
+ :param payload: Payload from response
+ :param supported_key_list: Module supported params
+ :rtype: A dict
+ :returns: payload with only supported and module expected params
+ """
+ temp_payload = []
+ for each in payload:
+ temp_dict = copy(each)
+ if isinstance(each, dict):
+ for every_key in each.keys():
+ if every_key not in supported_key_list:
+ temp_dict.pop(every_key)
+ temp_payload.append(temp_dict)
+ if temp_payload:
+ return temp_payload
+ return payload
+
+
+def list_to_dict(input_dict):
+ """The fn to convert list of dict to dict
+ :param input_dict: input list having list of dict
+ :rtype: A dict
+ :returns: dict with converted all list to dict type
+ """
+ if isinstance(input_dict, dict):
+ for k, v in iteritems(input_dict):
+ if isinstance(v, dict):
+ list_to_dict(v)
+ elif isinstance(v, list):
+ temp_dict = {}
+ for each in v:
+ if isinstance(each, dict):
+ if each.get("id") or each.get("id") == 0:
+ each.pop("id")
+ each_key_values = "_".join(
+ [str(x) for x in each.values()]
+ )
+ temp_dict.update({each_key_values: each})
+ input_dict[k] = temp_dict
+
+
+class QRadarRequest(object):
+ def __init__(
+ self,
+ module=None,
+ connection=None,
+ headers=None,
+ not_rest_data_keys=None,
+ task_vars=None,
+ ):
+ self.module = module
+ if module:
+ # This will be removed, once all of the available modules
+ # are moved to use action plugin design, as otherwise test
+ # would start to complain without the implementation.
+ self.connection = Connection(self.module._socket_path)
+ elif connection:
+ self.connection = connection
+ try:
+ self.connection.load_platform_plugins("ibm.qradar.qradar")
+ self.connection.set_options(var_options=task_vars)
+ except ConnectionError:
+ raise
+ # This allows us to exclude specific argspec keys from being included by
+ # the rest data that don't follow the qradar_* naming convention
+ if not_rest_data_keys:
+ self.not_rest_data_keys = not_rest_data_keys
+ else:
+ self.not_rest_data_keys = []
+ self.not_rest_data_keys.append("validate_certs")
+ self.headers = headers if headers else BASE_HEADERS
+
+ def _httpapi_error_handle(self, method, uri, payload=None):
+ # FIXME - make use of handle_httperror(self, exception) where applicable
+ # https://docs.ansible.com/ansible/latest/network/dev_guide/developing_plugins_network.html#developing-plugins-httpapi
+ code = 99999
+ response = {}
+ try:
+ code, response = self.connection.send_request(
+ method, uri, payload=payload, headers=self.headers
+ )
+ except ConnectionError as e:
+ self.module.fail_json(
+ msg="connection error occurred: {0}".format(e)
+ )
+ except CertificateError as e:
+ self.module.fail_json(
+ msg="certificate error occurred: {0}".format(e)
+ )
+ except ValueError as e:
+ try:
+ self.module.fail_json(
+ msg="certificate not found: {0}".format(e)
+ )
+ except AttributeError:
+ pass
+
+ if code == 404:
+ if (
+ to_text("Object not found") in to_text(response)
+ or to_text("Could not find object") in to_text(response)
+ or to_text("No offense was found") in to_text(response)
+ ):
+ return {}
+ if to_text("The rule does not exist.") in to_text(
+ response["description"]
+ ):
+ return code, {}
+
+ if code == 409:
+ if "code" in response:
+ if response["code"] in [1002, 1004]:
+ # https://www.ibm.com/support/knowledgecenter/SS42VS_7.3.1/com.ibm.qradar.doc/9.2--staged_config-deploy_status-POST.html
+ # Documentation says we should get 1002, but I'm getting 1004 from QRadar
+ return response
+ else:
+ self.module.fail_json(
+ msg="qradar httpapi returned error {0} with message {1}".format(
+ code, response
+ )
+ )
+ elif not (code >= 200 and code < 300):
+ try:
+ self.module.fail_json(
+ msg="qradar httpapi returned error {0} with message {1}".format(
+ code, response
+ )
+ )
+ except AttributeError:
+ pass
+
+ return code, response
+
+ def get(self, url, **kwargs):
+ return self._httpapi_error_handle("GET", url, **kwargs)
+
+ def put(self, url, **kwargs):
+ return self._httpapi_error_handle("PUT", url, **kwargs)
+
+ def post(self, url, **kwargs):
+ return self._httpapi_error_handle("POST", url, **kwargs)
+
+ def patch(self, url, **kwargs):
+ return self._httpapi_error_handle("PATCH", url, **kwargs)
+
+ def delete(self, url, **kwargs):
+ return self._httpapi_error_handle("DELETE", url, **kwargs)
+
+ def get_data(self):
+ """
+ Get the valid fields that should be passed to the REST API as urlencoded
+ data so long as the argument specification to the module follows the
+ convention:
+ - the key to the argspec item does not start with qradar_
+ - the key does not exist in the not_data_keys list
+ """
+ try:
+ qradar_data = {}
+ for param in self.module.params:
+ if (self.module.params[param]) is not None and (
+ param not in self.not_rest_data_keys
+ ):
+ qradar_data[param] = self.module.params[param]
+ return qradar_data
+
+ except TypeError as e:
+ self.module.fail_json(
+ msg="invalid data type provided: {0}".format(e)
+ )
+
+ def post_by_path(self, rest_path, data=None):
+ """
+ POST with data to path
+ """
+ if data is None:
+ data = json.dumps(self.get_data())
+ elif data is False:
+ # Because for some reason some QRadar REST API endpoint use the
+ # query string to modify state
+ return self.post("/{0}".format(rest_path))
+ return self.post("/{0}".format(rest_path), payload=data)
+
+ def create_update(self, rest_path, data=None):
+ """
+ Create or Update a file/directory monitor data input in qradar
+ """
+ if data is None:
+ data = json.dumps(self.get_data())
+ # return self.post("/{0}".format(rest_path), payload=data)
+ return self.patch("/{0}".format(rest_path), payload=data) # PATCH
diff --git a/ansible_collections/ibm/qradar/plugins/modules/deploy.py b/ansible_collections/ibm/qradar/plugins/modules/deploy.py
new file mode 100644
index 000000000..dc41acd99
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/deploy.py
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: deploy
+short_description: Trigger a qradar configuration deployment
+description:
+ - This module allows for INCREMENTAL or FULL deployments
+version_added: "1.0.0"
+options:
+ type:
+ description:
+ - Type of deployment
+ required: false
+ type: str
+ choices:
+ - "INCREMENTAL"
+ - "FULL"
+ default: "INCREMENTAL"
+notes:
+ - This module does not support check mode because the QRadar REST API does not offer stateful inspection of configuration deployments
+
+author: "Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>"
+"""
+
+EXAMPLES = """
+- name: run an incremental deploy
+ ibm.qradar.deploy:
+ type: INCREMENTAL
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+)
+
+
+def main():
+
+ argspec = dict(
+ type=dict(
+ choices=["INCREMENTAL", "FULL"],
+ required=False,
+ default="INCREMENTAL",
+ )
+ )
+
+ module = AnsibleModule(argument_spec=argspec, supports_check_mode=False)
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["state", "type_name", "identifier"],
+ )
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/staged_config/deploy_status"
+ )
+
+ if "message" in qradar_return_data and (
+ to_text("No changes to deploy")
+ in to_text(qradar_return_data["message"])
+ ):
+ module.exit_json(
+ msg="No changes to deploy",
+ qradar_return_data=qradar_return_data,
+ changed=False,
+ )
+ else:
+ module.exit_json(
+ msg="Successfully initiated {0} deployment.".format(
+ module.params["type"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py b/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py
new file mode 100644
index 000000000..fa793a596
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py
@@ -0,0 +1,263 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: log_source_management
+short_description: Manage Log Sources in QRadar
+description:
+ - This module allows for addition, deletion, or modification of Log Sources in QRadar
+version_added: "1.0.0"
+deprecated:
+ alternative: qradar_log_sources_management
+ why: Newer and updated modules released with more functionality.
+ removed_at_date: '2024-09-01'
+options:
+ name:
+ description:
+ - Name of Log Source
+ required: true
+ type: str
+ state:
+ description:
+ - Add or remove a log source.
+ required: true
+ choices: [ "present", "absent" ]
+ type: str
+ type_name:
+ description:
+ - Type of resource by name
+ required: false
+ type: str
+ type_id:
+ description:
+ - Type of resource by id, as defined in QRadar Log Source Types Documentation
+ required: false
+ type: int
+ protocol_type_id:
+ description:
+ - Type of protocol by id, as defined in QRadar Log Source Types Documentation
+ required: false
+ type: int
+ identifier:
+ description:
+ - Log Source Identifier (Typically IP Address or Hostname of log source)
+ required: true
+ type: str
+ description:
+ description:
+ - Description of log source
+ required: true
+ type: str
+
+notes:
+ - Either C(type) or C(type_id) is required
+
+author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
+"""
+
+EXAMPLES = """
+- name: Add a snort log source to IBM QRadar
+ ibm.qradar.log_source_management:
+ name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ state: present
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.168.1.101"
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+ find_dict_in_list,
+)
+
+import json
+
+
+def set_log_source_values(module, qradar_request):
+ if module.params["type_name"]:
+ code, query_response = qradar_request.get(
+ "/api/config/event_sources/log_source_management/log_source_types?filter={0}".format(
+ quote('name="{0}"'.format(module.params["type_name"]))
+ )
+ )
+ log_source_type_found = query_response[0]
+ if module.params["type_id"]:
+ code, query_response = qradar_request.get(
+ "/api/config/event_sources/log_source_management/log_source_types?filter={0}".format(
+ quote('name="{0}"'.format(module.params["type_name"]))
+ )
+ )
+ code, log_source_type_found = query_response[0]
+ if log_source_type_found:
+ if not module.params["type_id"]:
+ module.params["type_id"] = log_source_type_found["id"]
+ else:
+ module.fail_json(
+ msg="Incompatible type provided, please consult QRadar Documentation for Log Source Types"
+ )
+
+ if module.params["protocol_type_id"]:
+ found_dict_in_list, _fdil_index = find_dict_in_list(
+ log_source_type_found["protocol_types"],
+ "protocol_id",
+ module.params["protocol_type_id"],
+ )
+ if not found_dict_in_list:
+ module.fail_json(
+ msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types"
+ )
+ else:
+ # Set it to the default as provided by the QRadar Instance
+ module.params["protocol_type_id"] = log_source_type_found[
+ "protocol_types"
+ ][0]["protocol_id"]
+
+ module.params["protocol_parameters"] = [
+ {
+ "id": module.params["protocol_type_id"],
+ "name": "identifier",
+ "value": module.params["identifier"],
+ }
+ ]
+
+
+def main():
+
+ argspec = dict(
+ name=dict(required=True, type="str"),
+ state=dict(choices=["present", "absent"], required=True),
+ type_name=dict(required=False, type="str"),
+ type_id=dict(required=False, type="int"),
+ identifier=dict(required=True, type="str"),
+ protocol_type_id=dict(required=False, type="int"),
+ description=dict(required=True, type="str"),
+ )
+
+ module = AnsibleModule(
+ argument_spec=argspec,
+ required_one_of=[("type_name", "type_id")],
+ mutually_exclusive=[("type_name", "type_id")],
+ supports_check_mode=True,
+ )
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["state", "type_name", "identifier"],
+ )
+
+ code, log_source_exists = qradar_request.get(
+ "/api/config/event_sources/log_source_management/log_sources?filter={0}".format(
+ quote('name="{0}"'.format(module.params["name"]))
+ )
+ )
+
+ if log_source_exists:
+
+ if module.params["state"] == "present":
+ (
+ existing_log_source_protocol_identifier,
+ _elspi_index,
+ ) = find_dict_in_list(
+ log_source_exists[0]["protocol_parameters"],
+ "name",
+ "identifier",
+ )
+
+ set_log_source_values(module, qradar_request)
+
+ comparison_map = [
+ existing_log_source_protocol_identifier["value"]
+ == module.params["identifier"],
+ log_source_exists[0]["name"] == module.params["name"],
+ log_source_exists[0]["type_id"] == module.params["type_id"],
+ to_text(log_source_exists[0]["description"])
+ == to_text(module.params["description"]),
+ ]
+
+ if all(comparison_map):
+ module.exit_json(changed=False, msg="Nothing to do.")
+ else:
+ log_source_exists[0]["protocol_parameters"][
+ _elspi_index
+ ] = module.params["protocol_parameters"][0]
+ log_source_exists[0]["name"] = module.params["name"]
+ log_source_exists[0]["type_id"] = module.params["type_id"]
+ log_source_exists[0]["description"] = module.params[
+ "description"
+ ]
+ if module.check_mode:
+ qradar_return_data = {
+ "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE"
+ }
+ else:
+ code, qradar_return_data = qradar_request.create_update(
+ "api/config/event_sources/log_source_management/log_sources",
+ data=json.dumps(log_source_exists),
+ )
+
+ module.exit_json(
+ msg="Successfully updated log source: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+
+ if module.params["state"] == "absent":
+ if module.check_mode:
+ qradar_return_data = {
+ "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE"
+ }
+ else:
+ code, qradar_return_data = qradar_request.delete(
+ "/api/config/event_sources/log_source_management/log_sources/{0}".format(
+ log_source_exists[0]["id"]
+ )
+ )
+
+ module.exit_json(
+ msg="Successfully deleted log source: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ if module.params["state"] == "present":
+ set_log_source_values(module, qradar_request)
+ if module.check_mode:
+ qradar_return_data = {
+ "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE"
+ }
+ else:
+ code, qradar_return_data = qradar_request.create_update(
+ "api/config/event_sources/log_source_management/log_sources",
+ data=json.dumps([qradar_request.get_data()]),
+ )
+
+ module.exit_json(
+ msg="Successfully created log source: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+
+ if module.params["state"] == "absent":
+ module.exit_json(changed=False, msg="Nothing to do.")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/offense_action.py b/ansible_collections/ibm/qradar/plugins/modules/offense_action.py
new file mode 100644
index 000000000..784f1e7b1
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/offense_action.py
@@ -0,0 +1,201 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: offense_action
+short_description: Take action on a QRadar Offense
+description:
+ - This module allows to assign, protect, follow up, set status, and assign closing reason to QRadar Offenses
+version_added: "1.0.0"
+options:
+ id:
+ description:
+ - ID of Offense
+ required: true
+ type: int
+ status:
+ description:
+ - One of "open", "hidden" or "closed". (Either all lower case or all caps)
+ required: false
+ choices: [ "open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED" ]
+ type: str
+ assigned_to:
+ description:
+ - Assign to an user, the QRadar username should be provided
+ required: false
+ type: str
+ closing_reason:
+ description:
+ - Assign a predefined closing reason here, by name.
+ required: false
+ type: str
+ closing_reason_id:
+ description:
+ - Assign a predefined closing reason here, by id.
+ required: false
+ type: int
+ follow_up:
+ description:
+ - Set or unset the flag to follow up on a QRadar Offense
+ required: false
+ type: bool
+ protected:
+ description:
+ - Set or unset the flag to protect a QRadar Offense
+ required: false
+ type: bool
+
+notes:
+ - Requires one of C(name) or C(id) be provided
+ - Only one of C(closing_reason) or C(closing_reason_id) can be provided
+
+author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
+"""
+
+"""
+# FIXME - WOULD LIKE TO QUERY BY NAME BUT HOW TO ACCOMPLISH THAT IS NON-OBVIOUS
+# name:
+# description:
+# - Name of Offense
+# required: true
+# type: str
+"""
+
+EXAMPLES = """
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+ set_offense_values,
+)
+
+
+def main():
+
+ argspec = dict(
+ # name=dict(required=False, type='str'),
+ # id=dict(required=False, type='str'),
+ id=dict(required=True, type="int"),
+ assigned_to=dict(required=False, type="str"),
+ closing_reason=dict(required=False, type="str"),
+ closing_reason_id=dict(required=False, type="int"),
+ follow_up=dict(required=False, type="bool"),
+ protected=dict(required=False, type="bool"),
+ status=dict(
+ required=False,
+ choices=["open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED"],
+ type="str",
+ ),
+ )
+
+ module = AnsibleModule(
+ argument_spec=argspec,
+ # required_one_of=[
+ # ('name', 'id',),
+ # ],
+ mutually_exclusive=[("closing_reason", "closing_reason_id")],
+ supports_check_mode=True,
+ )
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["name", "id", "assigned_to", "closing_reason"],
+ )
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME
+ # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name']))
+
+ code, found_offense = qradar_request.get(
+ "/api/siem/offenses/{0}".format(module.params["id"])
+ )
+
+ if found_offense:
+ set_offense_values(module, qradar_request)
+
+ post_strs = []
+
+ if module.params["status"] and (
+ to_text(found_offense["status"])
+ != to_text(module.params["status"])
+ ):
+ post_strs.append(
+ "status={0}".format(to_text(module.params["status"]))
+ )
+
+ if module.params["assigned_to"] and (
+ to_text(found_offense["assigned_to"])
+ != to_text(module.params["assigned_to"])
+ ):
+ post_strs.append(
+ "assigned_to={0}".format(module.params["assigned_to"])
+ )
+
+ if module.params["closing_reason_id"] and (
+ found_offense["closing_reason_id"]
+ != module.params["closing_reason_id"]
+ ):
+ post_strs.append(
+ "closing_reason_id={0}".format(
+ module.params["closing_reason_id"]
+ )
+ )
+
+ if module.params["follow_up"] and (
+ found_offense["follow_up"] != module.params["follow_up"]
+ ):
+ post_strs.append(
+ "follow_up={0}".format(module.params["follow_up"])
+ )
+
+ if module.params["protected"] and (
+ found_offense["protected"] != module.params["protected"]
+ ):
+ post_strs.append(
+ "protected={0}".format(module.params["protected"])
+ )
+
+ if post_strs:
+ if module.check_mode:
+ module.exit_json(
+ msg="A change would have been made but was not because of Check Mode.",
+ changed=True,
+ )
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/siem/offenses/{0}?{1}".format(
+ module.params["id"], "&".join(post_strs)
+ )
+ )
+ # FIXME - handle the scenario in which we can search by name and this isn't a required param anymore
+ module.exit_json(
+ msg="Successfully updated Offense ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ module.exit_json(
+ msg="No changes necessary. Nothing to do.", changed=False
+ )
+ else:
+ # FIXME - handle the scenario in which we can search by name and this isn't a required param anymore
+ module.fail_json(
+ msg="Unable to find Offense ID: {0}".format(module.params["id"])
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/offense_info.py b/ansible_collections/ibm/qradar/plugins/modules/offense_info.py
new file mode 100644
index 000000000..1ead8a1ae
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/offense_info.py
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+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>
+"""
+
+
+# FIXME - provide correct example here
+RETURN = """
+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
+"""
+
+
+EXAMPLES = """
+- 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
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+ find_dict_in_list,
+ set_offense_values,
+)
+
+
+def main():
+
+ argspec = dict(
+ id=dict(required=False, type="int"),
+ name=dict(required=False, type="str"),
+ assigned_to=dict(required=False, type="str"),
+ closing_reason=dict(required=False, type="str"),
+ closing_reason_id=dict(required=False, type="int"),
+ follow_up=dict(required=False, type="bool", default=None),
+ protected=dict(required=False, type="bool", default=None),
+ status=dict(
+ required=False,
+ choices=["open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED"],
+ default="open",
+ type="str",
+ ),
+ )
+
+ module = AnsibleModule(
+ argument_spec=argspec,
+ mutually_exclusive=[("closing_reason", "closing_reason_id")],
+ supports_check_mode=True,
+ )
+
+ qradar_request = QRadarRequest(module)
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET)
+ # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name']))
+
+ set_offense_values(module, qradar_request)
+
+ if module.params["id"]:
+ code, offenses = qradar_request.get(
+ "/api/siem/offenses/{0}".format(module.params["id"])
+ )
+
+ else:
+ query_strs = []
+
+ if module.params["status"]:
+ query_strs.append(
+ quote("status={0}".format(to_text(module.params["status"])))
+ )
+
+ if module.params["assigned_to"]:
+ query_strs.append(
+ quote("assigned_to={0}".format(module.params["assigned_to"]))
+ )
+
+ if module.params["closing_reason_id"]:
+ query_strs.append(
+ quote(
+ "closing_reason_id={0}".format(
+ module.params["closing_reason_id"]
+ )
+ )
+ )
+
+ if module.params["follow_up"] is not None:
+ query_strs.append(
+ quote("follow_up={0}".format(module.params["follow_up"]))
+ )
+
+ if module.params["protected"] is not None:
+ query_strs.append(
+ quote("protected={0}".format(module.params["protected"]))
+ )
+
+ if query_strs:
+ code, offenses = qradar_request.get(
+ "/api/siem/offenses?filter={0}".format("&".join(query_strs))
+ )
+ else:
+ code, offenses = qradar_request.get("/api/siem/offenses")
+
+ if module.params["name"]:
+ named_offense = find_dict_in_list(
+ offenses, "description", module.params["name"]
+ )
+ if named_offense:
+ offenses = named_offense
+ else:
+ offenses = []
+
+ module.exit_json(offenses=offenses, changed=False)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/offense_note.py b/ansible_collections/ibm/qradar/plugins/modules/offense_note.py
new file mode 100644
index 000000000..53b6ec95c
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/offense_note.py
@@ -0,0 +1,189 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: offense_note
+short_description: Create or update a QRadar Offense Note
+description:
+ - This module allows to create a QRadar Offense note
+version_added: "1.0.0"
+options:
+ id:
+ description:
+ - Offense ID to operate on
+ required: true
+ type: int
+ note_text:
+ description: The note's text contents
+ required: true
+ type: str
+
+author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
+"""
+
+"""
+# FIXME - WOULD LIKE TO QUERY BY NAME BUT HOW TO ACCOMPLISH THAT IS NON-OBVIOUS
+# offense_name:
+# description:
+# - Name of Offense
+# required: true
+# type: str
+
+# FIXME - WOULD LIKE TO MANAGE STATE
+# state:
+# description: Define state of the note: present or absent
+# required: false
+# choices: ["present", "absent"]
+# default: "present"
+"""
+
+EXAMPLES = """
+- name: Add a note to QRadar Offense ID 1
+ ibm.qradar.offense_note:
+ id: 1
+ note_text: This an example note entry that should be made on offense id 1
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+)
+
+
+def set_offense_values(module, qradar_request):
+ if module.params["closing_reason"]:
+ code, found_closing_reason = qradar_request.get(
+ "/api/siem/offense_closing_reasons?filter={0}".format(
+ quote('text="{0}"'.format(module.params["closing_reason"]))
+ )
+ )
+ if found_closing_reason:
+ module.params["closing_reason_id"] = found_closing_reason[0]["id"]
+ else:
+ module.fail_json(
+ "Unable to find closing_reason text: {0}".format(
+ module.params["closing_reason"]
+ )
+ )
+
+ if module.params["status"]:
+ module.params["status"] = module.params["status"].upper()
+
+
+def main():
+
+ argspec = dict(
+ # state=dict(required=False, choices=["present", "absent"], type='str', default="present"),
+ id=dict(required=True, type="int"),
+ note_text=dict(required=True, type="str"),
+ )
+
+ module = AnsibleModule(argument_spec=argspec, supports_check_mode=True)
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["state", "id"],
+ )
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME
+ # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name']))
+ # FIXME - once this is sorted, add it to module_utils
+
+ code, found_notes = qradar_request.get(
+ "/api/siem/offenses/{0}/notes?filter={1}".format(
+ module.params["id"],
+ quote('note_text="{0}"'.format(module.params["note_text"])),
+ )
+ )
+
+ # if module.params['state'] == 'present':
+
+ if found_notes:
+ # The note we want exists either by ID or by text name, verify
+
+ note = found_notes[0]
+ if note["note_text"] == module.params["note_text"]:
+ module.exit_json(
+ msg="No changes necessary. Nothing to do.", changed=False
+ )
+ else:
+ if module.check_mode:
+ module.exit_json(
+ msg="A change would have occured but did not because Check Mode",
+ changed=True,
+ )
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/siem/offenses/{0}/notes?note_text={1}".format(
+ module.params["id"],
+ quote("{0}".format(module.params["note_text"])),
+ ),
+ data=False,
+ )
+ module.exit_json(
+ msg="Successfully created Offense Note ID: {0}".format(
+ qradar_return_data["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=False,
+ )
+
+ else:
+ if module.check_mode:
+ module.exit_json(
+ msg="A change would have occured but did not because Check Mode",
+ changed=True,
+ )
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/siem/offenses/{0}/notes?note_text={1}".format(
+ module.params["id"],
+ quote("{0}".format(module.params["note_text"])),
+ ),
+ data=False,
+ )
+ module.exit_json(
+ msg="Successfully created Offense Note ID: {0}".format(
+ qradar_return_data["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+
+ module.exit_json(msg="No changes necessary. Nothing to do.", changed=False)
+
+ # FIXME FIXME FIXME - can we actually delete these via the REST API?
+ # if module.params['state'] == 'absent':
+ # if not found_notes:
+ # module.exit_json(msg="No changes necessary. Nothing to do.", changed=False)
+ # else:
+ # if module.check_mode:
+ # module.exit_json(msg="A change would have occured but did not because Check Mode", changed=True)
+ # # FIXME: fix the POST here to actually delete
+ # qradar_return_data = qradar_request.post_by_path(
+ # 'api/siem/offenses/{0}/notes?note_text={1}'.format(
+ # module.params['id'],
+ # quote("{0}".format(module.params['note_text'])),
+ # ),
+ # data=False
+ # )
+ # module.exit_json(
+ # msg="Successfully created Offense Note ID: {0}".format(qradar_return_data['id']),
+ # qradar_return_data=qradar_return_data,
+ # changed=True
+ # )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_analytics_rules.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_analytics_rules.py
new file mode 100644
index 000000000..8f65069f5
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_analytics_rules.py
@@ -0,0 +1,279 @@
+#!/usr/bin/python
+# Copyright: Ansible Project
+# 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
+
+DOCUMENTATION = """
+---
+module: qradar_analytics_rules
+short_description: Qradar Analytics Rules Management resource module
+description:
+ - This module allows for modification, deletion, and checking of Analytics Rules in QRadar
+version_added: "2.1.0"
+options:
+ config:
+ description: A dictionary of Qradar Analytics Rules options
+ type: dict
+ suboptions:
+ id:
+ description: The sequence ID of the rule.
+ type: int
+ name:
+ description: The name of the rule.
+ type: str
+ enabled:
+ description: Check if the rule is enabled
+ type: bool
+ owner:
+ description: Manage ownership of a QRadar Rule
+ type: str
+ fields:
+ description:
+ - List of params filtered from the Rule config
+ - NOTE, this param is valid only via state GATHERED.
+ type: list
+ elements: str
+ choices:
+ - average_capacity
+ - base_capacity
+ - base_host_id
+ - capacity_timestamp
+ - creation_date
+ - enabled
+ - id
+ - identifier
+ - linked_rule_identifier
+ - modification_date
+ - name
+ - origin
+ - owner
+ - type
+ range:
+ description:
+ - Parameter to restrict the number of elements that
+ are returned in the list to a specified range.
+ - NOTE, this param is valid only via state GATHERED.
+ type: str
+ state:
+ description:
+ - The state the configuration should be left in
+ - The state I(gathered) will get the module API configuration from the device
+ and transform it into structured data in the format as per the module argspec
+ and the value is returned in the I(gathered) key within the result.
+ type: str
+ choices:
+ - merged
+ - gathered
+ - deleted
+
+author: Ansible Security Automation Team (@justjais) <https://github.com/ansible-security>
+"""
+
+EXAMPLES = """
+
+# Using MERGED state
+# -------------------
+
+- name: DISABLE Rule 'Ansible Example DDoS Rule'
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ name: 'Ansible Example DDOS Rule'
+ enabled: false
+ state: merged
+
+# RUN output:
+# -----------
+
+# qradar_analytics_rules:
+# after:
+# average_capacity: null
+# base_capacity: null
+# base_host_id: null
+# capacity_timestamp: null
+# creation_date: 1658929682568
+# enabled: false
+# id: 100443
+# identifier: ae5a1268-02a0-4976-84c5-dbcbcf854b9c
+# linked_rule_identifier: null
+# modification_date: 1658929682567
+# name: Ansible Example DDOS Rule
+# origin: USER
+# owner: admin
+# type: EVENT
+# before:
+# average_capacity: null
+# base_capacity: null
+# base_host_id: null
+# capacity_timestamp: null
+# creation_date: 1658929682568
+# enabled: true
+# id: 100443
+# identifier: ae5a1268-02a0-4976-84c5-dbcbcf854b9c
+# linked_rule_identifier: null
+# modification_date: 1658929682567
+# name: Ansible Example DDOS Rule
+# origin: USER
+# owner: admin
+# type: EVENT
+
+
+# Using GATHERED state
+# --------------------
+
+- name: Get information about the Rule named "Ansible Example DDOS Rule"
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ name: "Ansible Example DDOS Rule"
+ state: gathered
+
+# RUN output:
+# -----------
+
+# gathered:
+# average_capacity: null
+# base_capacity: null
+# base_host_id: null
+# capacity_timestamp: null
+# creation_date: 1658918848694
+# enabled: true
+# id: 100443
+# identifier: d6d37942-ba28-438f-b909-120df643a992
+# linked_rule_identifier: null
+# modification_date: 1658918848692
+# name: Ansible Example DDOS Rule
+# origin: USER
+# owner: admin
+# type: EVENT
+
+- name: Get information about the Rule with ID 100443
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ id: 100443
+ state: gathered
+
+# RUN output:
+# -----------
+
+# gathered:
+# average_capacity: null
+# base_capacity: null
+# base_host_id: null
+# capacity_timestamp: null
+# creation_date: 1658918848694
+# enabled: true
+# id: 100443
+# identifier: d6d37942-ba28-438f-b909-120df643a992
+# linked_rule_identifier: null
+# modification_date: 1658918848692
+# name: Ansible Example DDOS Rule
+# origin: USER
+# owner: admin
+# type: EVENT
+
+- name: TO Get information about the Rule ID with a range
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ range: 100300-100500
+ fields:
+ - name
+ - origin
+ - owner
+ state: gathered
+
+# RUN output:
+# -----------
+
+# gathered:
+# - name: Devices with High Event Rates
+# origin: SYSTEM
+# owner: admin
+# - name: Excessive Database Connections
+# origin: SYSTEM
+# owner: admin
+# - name: 'Anomaly: Excessive Firewall Accepts Across Multiple Hosts'
+# origin: SYSTEM
+# owner: admin
+# - name: Excessive Firewall Denies from Single Source
+# origin: SYSTEM
+# owner: admin
+# - name: 'AssetExclusion: Exclude DNS Name By IP'
+# origin: SYSTEM
+# owner: admin
+# - name: 'AssetExclusion: Exclude DNS Name By MAC Address'
+# origin: SYSTEM
+# owner: admin
+
+- name: Delete custom Rule by NAME
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ name: 'Ansible Example DDOS Rule'
+ state: deleted
+
+# RUN output:
+# -----------
+
+# qradar_analytics_rules:
+# after: {}
+# before:
+# average_capacity: null
+# base_capacity: null
+# base_host_id: null
+# capacity_timestamp: null
+# creation_date: 1658929431239
+# enabled: true
+# id: 100444
+# identifier: 3c2cbd9d-d141-49fc-b5d5-29009a9b5308
+# linked_rule_identifier: null
+# modification_date: 1658929431238
+# name: Ansible Example DDOS Rule
+# origin: USER
+# owner: admin
+# type: EVENT
+
+# Using DELETED state
+# -------------------
+
+- name: Delete custom Rule by ID
+ ibm.qradar.qradar_analytics_rules:
+ config:
+ id: 100443
+ state: deleted
+
+# RUN output:
+# -----------
+
+# qradar_analytics_rules:
+# after: {}
+# before:
+# average_capacity: null
+# base_capacity: null
+# base_host_id: null
+# capacity_timestamp: null
+# creation_date: 1658929431239
+# enabled: true
+# id: 100443
+# identifier: 3c2cbd9d-d141-49fc-b5d5-29009a9b5308
+# linked_rule_identifier: null
+# modification_date: 1658929431238
+# name: Ansible Example DDOS Rule
+# origin: USER
+# owner: admin
+# type: EVENT
+
+"""
+
+RETURN = """
+before:
+ description: The configuration as structured data prior to module invocation.
+ returned: always
+ type: dict
+ sample: The configuration returned will always be in the same format of the parameters above.
+after:
+ description: The configuration as structured data after module completion.
+ returned: when changed
+ type: dict
+ sample: The configuration returned will always be in the same format of the parameters above.
+"""
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_deploy.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_deploy.py
new file mode 100644
index 000000000..dc41acd99
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_deploy.py
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: deploy
+short_description: Trigger a qradar configuration deployment
+description:
+ - This module allows for INCREMENTAL or FULL deployments
+version_added: "1.0.0"
+options:
+ type:
+ description:
+ - Type of deployment
+ required: false
+ type: str
+ choices:
+ - "INCREMENTAL"
+ - "FULL"
+ default: "INCREMENTAL"
+notes:
+ - This module does not support check mode because the QRadar REST API does not offer stateful inspection of configuration deployments
+
+author: "Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>"
+"""
+
+EXAMPLES = """
+- name: run an incremental deploy
+ ibm.qradar.deploy:
+ type: INCREMENTAL
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+)
+
+
+def main():
+
+ argspec = dict(
+ type=dict(
+ choices=["INCREMENTAL", "FULL"],
+ required=False,
+ default="INCREMENTAL",
+ )
+ )
+
+ module = AnsibleModule(argument_spec=argspec, supports_check_mode=False)
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["state", "type_name", "identifier"],
+ )
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/staged_config/deploy_status"
+ )
+
+ if "message" in qradar_return_data and (
+ to_text("No changes to deploy")
+ in to_text(qradar_return_data["message"])
+ ):
+ module.exit_json(
+ msg="No changes to deploy",
+ qradar_return_data=qradar_return_data,
+ changed=False,
+ )
+ else:
+ module.exit_json(
+ msg="Successfully initiated {0} deployment.".format(
+ module.params["type"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_log_source_management.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_log_source_management.py
new file mode 100644
index 000000000..fa793a596
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_log_source_management.py
@@ -0,0 +1,263 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: log_source_management
+short_description: Manage Log Sources in QRadar
+description:
+ - This module allows for addition, deletion, or modification of Log Sources in QRadar
+version_added: "1.0.0"
+deprecated:
+ alternative: qradar_log_sources_management
+ why: Newer and updated modules released with more functionality.
+ removed_at_date: '2024-09-01'
+options:
+ name:
+ description:
+ - Name of Log Source
+ required: true
+ type: str
+ state:
+ description:
+ - Add or remove a log source.
+ required: true
+ choices: [ "present", "absent" ]
+ type: str
+ type_name:
+ description:
+ - Type of resource by name
+ required: false
+ type: str
+ type_id:
+ description:
+ - Type of resource by id, as defined in QRadar Log Source Types Documentation
+ required: false
+ type: int
+ protocol_type_id:
+ description:
+ - Type of protocol by id, as defined in QRadar Log Source Types Documentation
+ required: false
+ type: int
+ identifier:
+ description:
+ - Log Source Identifier (Typically IP Address or Hostname of log source)
+ required: true
+ type: str
+ description:
+ description:
+ - Description of log source
+ required: true
+ type: str
+
+notes:
+ - Either C(type) or C(type_id) is required
+
+author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
+"""
+
+EXAMPLES = """
+- name: Add a snort log source to IBM QRadar
+ ibm.qradar.log_source_management:
+ name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ state: present
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.168.1.101"
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+ find_dict_in_list,
+)
+
+import json
+
+
+def set_log_source_values(module, qradar_request):
+ if module.params["type_name"]:
+ code, query_response = qradar_request.get(
+ "/api/config/event_sources/log_source_management/log_source_types?filter={0}".format(
+ quote('name="{0}"'.format(module.params["type_name"]))
+ )
+ )
+ log_source_type_found = query_response[0]
+ if module.params["type_id"]:
+ code, query_response = qradar_request.get(
+ "/api/config/event_sources/log_source_management/log_source_types?filter={0}".format(
+ quote('name="{0}"'.format(module.params["type_name"]))
+ )
+ )
+ code, log_source_type_found = query_response[0]
+ if log_source_type_found:
+ if not module.params["type_id"]:
+ module.params["type_id"] = log_source_type_found["id"]
+ else:
+ module.fail_json(
+ msg="Incompatible type provided, please consult QRadar Documentation for Log Source Types"
+ )
+
+ if module.params["protocol_type_id"]:
+ found_dict_in_list, _fdil_index = find_dict_in_list(
+ log_source_type_found["protocol_types"],
+ "protocol_id",
+ module.params["protocol_type_id"],
+ )
+ if not found_dict_in_list:
+ module.fail_json(
+ msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types"
+ )
+ else:
+ # Set it to the default as provided by the QRadar Instance
+ module.params["protocol_type_id"] = log_source_type_found[
+ "protocol_types"
+ ][0]["protocol_id"]
+
+ module.params["protocol_parameters"] = [
+ {
+ "id": module.params["protocol_type_id"],
+ "name": "identifier",
+ "value": module.params["identifier"],
+ }
+ ]
+
+
+def main():
+
+ argspec = dict(
+ name=dict(required=True, type="str"),
+ state=dict(choices=["present", "absent"], required=True),
+ type_name=dict(required=False, type="str"),
+ type_id=dict(required=False, type="int"),
+ identifier=dict(required=True, type="str"),
+ protocol_type_id=dict(required=False, type="int"),
+ description=dict(required=True, type="str"),
+ )
+
+ module = AnsibleModule(
+ argument_spec=argspec,
+ required_one_of=[("type_name", "type_id")],
+ mutually_exclusive=[("type_name", "type_id")],
+ supports_check_mode=True,
+ )
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["state", "type_name", "identifier"],
+ )
+
+ code, log_source_exists = qradar_request.get(
+ "/api/config/event_sources/log_source_management/log_sources?filter={0}".format(
+ quote('name="{0}"'.format(module.params["name"]))
+ )
+ )
+
+ if log_source_exists:
+
+ if module.params["state"] == "present":
+ (
+ existing_log_source_protocol_identifier,
+ _elspi_index,
+ ) = find_dict_in_list(
+ log_source_exists[0]["protocol_parameters"],
+ "name",
+ "identifier",
+ )
+
+ set_log_source_values(module, qradar_request)
+
+ comparison_map = [
+ existing_log_source_protocol_identifier["value"]
+ == module.params["identifier"],
+ log_source_exists[0]["name"] == module.params["name"],
+ log_source_exists[0]["type_id"] == module.params["type_id"],
+ to_text(log_source_exists[0]["description"])
+ == to_text(module.params["description"]),
+ ]
+
+ if all(comparison_map):
+ module.exit_json(changed=False, msg="Nothing to do.")
+ else:
+ log_source_exists[0]["protocol_parameters"][
+ _elspi_index
+ ] = module.params["protocol_parameters"][0]
+ log_source_exists[0]["name"] = module.params["name"]
+ log_source_exists[0]["type_id"] = module.params["type_id"]
+ log_source_exists[0]["description"] = module.params[
+ "description"
+ ]
+ if module.check_mode:
+ qradar_return_data = {
+ "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE"
+ }
+ else:
+ code, qradar_return_data = qradar_request.create_update(
+ "api/config/event_sources/log_source_management/log_sources",
+ data=json.dumps(log_source_exists),
+ )
+
+ module.exit_json(
+ msg="Successfully updated log source: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+
+ if module.params["state"] == "absent":
+ if module.check_mode:
+ qradar_return_data = {
+ "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE"
+ }
+ else:
+ code, qradar_return_data = qradar_request.delete(
+ "/api/config/event_sources/log_source_management/log_sources/{0}".format(
+ log_source_exists[0]["id"]
+ )
+ )
+
+ module.exit_json(
+ msg="Successfully deleted log source: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ if module.params["state"] == "present":
+ set_log_source_values(module, qradar_request)
+ if module.check_mode:
+ qradar_return_data = {
+ "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE"
+ }
+ else:
+ code, qradar_return_data = qradar_request.create_update(
+ "api/config/event_sources/log_source_management/log_sources",
+ data=json.dumps([qradar_request.get_data()]),
+ )
+
+ module.exit_json(
+ msg="Successfully created log source: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+
+ if module.params["state"] == "absent":
+ module.exit_json(changed=False, msg="Nothing to do.")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_log_sources_management.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_log_sources_management.py
new file mode 100644
index 000000000..e5ba46a0b
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_log_sources_management.py
@@ -0,0 +1,522 @@
+#!/usr/bin/python
+# Copyright: Ansible Project
+# 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
+
+DOCUMENTATION = """
+---
+module: qradar_log_sources_management
+short_description: Qradar Log Sources Management resource module
+description:
+ - This module allows for addition, deletion, or modification of Log Sources in QRadar
+version_added: "2.1.0"
+options:
+ config:
+ description: A dictionary of Qradar Log Sources options
+ type: list
+ elements: dict
+ suboptions:
+ name:
+ description:
+ - Name of Log Source
+ type: str
+ description:
+ description:
+ - Description of log source
+ type: str
+ type_name:
+ description:
+ - Type of resource by name
+ type: str
+ type_id:
+ description:
+ - The type of the log source. Must correspond to an existing log source type.
+ type: int
+ identifier:
+ description:
+ - Log Source Identifier (Typically IP Address or Hostname of log source)
+ type: str
+ protocol_type_id:
+ description:
+ - Type of protocol by id, as defined in QRadar Log Source Types Documentation
+ type: int
+ enabled:
+ description:
+ - If the log source is enabled, the condition is set to 'true'; otherwise,
+ the condition is set to 'false'.
+ type: bool
+ gateway:
+ description:
+ - If the log source is configured as a gateway, the condition is set to 'true';
+ otherwise, the condition is set to 'false'. A gateway log source is a stand-alone
+ protocol configuration. The log source receives no events itself, and serves as a
+ host for a protocol configuration that retrieves event data to feed other log sources.
+ It acts as a "gateway" for events from multiple systems to enter the event pipeline.
+ type: bool
+ internal:
+ description:
+ - If the log source is internal (when the log source type is defined as internal),
+ the condition is set to 'true'.
+ type: bool
+ target_event_collector_id:
+ description:
+ - The ID of the event collector where the log source sends its data.
+ The ID must correspond to an existing event collector.
+ type: int
+ coalesce_events:
+ description:
+ - If events collected by this log source are coalesced based on common properties,
+ the condition is set to 'true'. If each individual event is stored,
+ then the condition is set to 'false'.
+ type: bool
+ store_event_payload:
+ description:
+ - If the payloads of events that are collected by this log source are stored,
+ the condition is set to 'true'. If only the normalized event records are stored,
+ then the condition is set to 'false'.
+ type: bool
+ language_id:
+ description:
+ - The language of the events that are being processed by this log source.
+ Must correspond to an existing log source language. Individual log source types
+ can support only a subset of all available log source languages,
+ as indicated by the supported_language_ids field of the log source type structure
+ type: int
+ group_ids:
+ description:
+ - The set of log source group IDs this log source is a member of.
+ Each ID must correspond to an existing log source group.
+ type: list
+ elements: str
+ requires_deploy:
+ description:
+ - Set to 'true' if you need to deploy changes to enable the log source for use;
+ otherwise, set to 'false' if the log source is already active.
+ type: bool
+ status:
+ description:
+ - The status of the log source.
+ type: dict
+ suboptions:
+ last_updated:
+ description: last_updated
+ type: int
+ messages:
+ description: last_updated
+ type: str
+ status:
+ description: last_updated
+ type: str
+ average_eps:
+ description:
+ - The average events per second (EPS) rate of the log source over the last 60 seconds.
+ type: int
+ protocol_parameters:
+ description:
+ - The set of protocol parameters
+ - If not provided module will set the protocol parameters by itself
+ - Note, parameter will come to use mostly in case when facts are gathered and fired
+ with some modifications to params or in case of round trip scenarios.
+ type: list
+ elements: dict
+ suboptions:
+ id:
+ description: The ID of the protocol type.
+ type: int
+ name:
+ description: The unique name of the protocol type.
+ type: str
+ value:
+ description: The allowed protocol value.
+ type: str
+ state:
+ description:
+ - The state the configuration should be left in
+ - The state I(gathered) will get the module API configuration from the device
+ and transform it into structured data in the format as per the module argspec
+ and the value is returned in the I(gathered) key within the result.
+ type: str
+ choices:
+ - merged
+ - replaced
+ - gathered
+ - deleted
+
+author: Ansible Security Automation Team (@justjais) <https://github.com/ansible-security>
+"""
+
+EXAMPLES = """
+
+# Using MERGED state
+# -------------------
+
+- name: Add Snort n Apache log sources to IBM QRadar
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.0.2.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "Apache HTTP Server remote logs from rsyslog"
+ identifier: "198.51.100.1"
+ state: merged
+
+# RUN output:
+# -----------
+
+# qradar_log_sources_management:
+# after:
+# - auto_discovered: false
+# average_eps: 0
+# coalesce_events: true
+# creation_date: 1654727311444
+# credibility: 5
+# description: Snort IDS remote logs from rsyslog
+# enabled: true
+# gateway: false
+# group_ids:
+# - 0
+# id: 181
+# internal: false
+# language_id: 1
+# last_event_time: 0
+# log_source_extension_id: null
+# modified_date: 1654727311444
+# name: Snort logs
+# protocol_parameters:
+# - id: 1
+# name: incomingPayloadEncoding
+# value: UTF-8
+# - id: 0
+# name: identifier
+# value: 192.0.2.1
+# protocol_type_id: 0
+# requires_deploy: true
+# status:
+# last_updated: 0
+# messages: null
+# status: NA
+# store_event_payload: true
+# target_event_collector_id: 7
+# type_id: 2
+# wincollect_external_destination_ids: null
+# wincollect_internal_destination_id: null
+# - auto_discovered: false
+# average_eps: 0
+# coalesce_events: true
+# creation_date: 1654727311462
+# credibility: 5
+# description: Apache HTTP Server remote logs from rsyslog
+# enabled: true
+# gateway: false
+# group_ids:
+# - 0
+# id: 182
+# internal: false
+# language_id: 1
+# last_event_time: 0
+# log_source_extension_id: null
+# modified_date: 1654727311462
+# name: Apache HTTP Server logs
+# protocol_parameters:
+# - id: 1
+# name: incomingPayloadEncoding
+# value: UTF-8
+# - id: 0
+# name: identifier
+# value: 198.51.100.1
+# protocol_type_id: 0
+# requires_deploy: true
+# status:
+# last_updated: 0
+# messages: null
+# status: NA
+# store_event_payload: true
+# target_event_collector_id: 7
+# type_id: 10
+# wincollect_external_destination_ids: null
+# wincollect_internal_destination_id: null
+# before: []
+
+# Using REPLACED state
+# --------------------
+
+- name: Replace existing Log sources to IBM QRadar
+ ibm.qradar.qradar_log_sources_management:
+ state: replaced
+ config:
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "REPLACED Apache HTTP Server remote logs from rsyslog"
+ identifier: "192.0.2.1"
+
+# RUN output:
+# -----------
+
+# qradar_log_sources_management:
+# after:
+# - auto_discovered: false
+# average_eps: 0
+# coalesce_events: true
+# creation_date: 1654727944017
+# credibility: 5
+# description: REPLACED Apache HTTP Server remote logs from rsyslog
+# enabled: true
+# gateway: false
+# group_ids:
+# - 0
+# id: 183
+# internal: false
+# language_id: 1
+# last_event_time: 0
+# log_source_extension_id: null
+# modified_date: 1654727944017
+# name: Apache HTTP Server logs
+# protocol_parameters:
+# - id: 1
+# name: incomingPayloadEncoding
+# value: UTF-8
+# - id: 0
+# name: identifier
+# value: 192.0.2.1
+# protocol_type_id: 0
+# requires_deploy: true
+# status:
+# last_updated: 0
+# messages: null
+# status: NA
+# store_event_payload: true
+# target_event_collector_id: 7
+# type_id: 10
+# wincollect_external_destination_ids: null
+# wincollect_internal_destination_id: null
+# before:
+# - auto_discovered: false
+# average_eps: 0
+# coalesce_events: true
+# creation_date: 1654727311462
+# credibility: 5
+# description: Apache HTTP Server remote logs from rsyslog
+# enabled: true
+# gateway: false
+# group_ids:
+# - 0
+# id: 182
+# internal: false
+# language_id: 1
+# last_event_time: 0
+# log_source_extension_id: null
+# modified_date: 1654727311462
+# name: Apache HTTP Server logs
+# protocol_parameters:
+# - name: identifier
+# value: 198.51.100.1
+# - name: incomingPayloadEncoding
+# value: UTF-8
+# protocol_type_id: 0
+# requires_deploy: true
+# status:
+# last_updated: 0
+# messages: null
+# status: NA
+# store_event_payload: true
+# target_event_collector_id: 7
+# type_id: 10
+# wincollect_external_destination_ids: null
+# wincollect_internal_destination_id: null
+
+# Using GATHERED state
+# --------------------
+
+- name: Gather Snort n Apache log source from IBM QRadar
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: gathered
+
+# RUN output:
+# -----------
+
+# gathered:
+# - auto_discovered: false
+# average_eps: 0
+# coalesce_events: true
+# creation_date: 1654727311444
+# credibility: 5
+# description: Snort IDS remote logs from rsyslog
+# enabled: true
+# gateway: false
+# group_ids:
+# - 0
+# id: 181
+# internal: false
+# language_id: 1
+# last_event_time: 0
+# log_source_extension_id: null
+# modified_date: 1654728103340
+# name: Snort logs
+# protocol_parameters:
+# - id: 0
+# name: identifier
+# value: 192.0.2.1
+# - id: 1
+# name: incomingPayloadEncoding
+# value: UTF-8
+# protocol_type_id: 0
+# requires_deploy: true
+# status:
+# last_updated: 0
+# messages: null
+# status: NA
+# store_event_payload: true
+# target_event_collector_id: 7
+# type_id: 2
+# wincollect_external_destination_ids: null
+# wincollect_internal_destination_id: null
+# - auto_discovered: false
+# average_eps: 0
+# coalesce_events: true
+# creation_date: 1654727944017
+# credibility: 5
+# description: Apache HTTP Server remote logs from rsyslog
+# enabled: true
+# gateway: false
+# group_ids:
+# - 0
+# id: 183
+# internal: false
+# language_id: 1
+# last_event_time: 0
+# log_source_extension_id: null
+# modified_date: 1654728103353
+# name: Apache HTTP Server logs
+# protocol_parameters:
+# - id: 0
+# name: identifier
+# value: 192.0.2.1
+# - id: 1
+# name: incomingPayloadEncoding
+# value: UTF-8
+# protocol_type_id: 0
+# requires_deploy: true
+# status:
+# last_updated: 0
+# messages: null
+# status: NA
+# store_event_payload: true
+# target_event_collector_id: 7
+# type_id: 10
+# wincollect_external_destination_ids: null
+# wincollect_internal_destination_id: null
+
+- name: TO Gather ALL log sources from IBM QRadar
+ tags: gather_log_all
+ ibm.qradar.qradar_log_sources_management:
+ state: gathered
+
+# Using DELETED state
+# -------------------
+
+- name: Delete Snort n Apache log source from IBM QRadar
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: deleted
+
+# RUN output:
+# -----------
+
+# qradar_log_sources_management:
+# after: []
+# before:
+# - auto_discovered: false
+# average_eps: 0
+# coalesce_events: true
+# creation_date: 1654727311444
+# credibility: 5
+# description: Snort IDS remote logs from rsyslog
+# enabled: true
+# gateway: false
+# group_ids:
+# - 0
+# id: 181
+# internal: false
+# language_id: 1
+# last_event_time: 0
+# log_source_extension_id: null
+# modified_date: 1654728103340
+# name: Snort logs
+# protocol_parameters:
+# - id: 0
+# name: identifier
+# value: 192.0.2.1
+# - id: 1
+# name: incomingPayloadEncoding
+# value: UTF-8
+# protocol_type_id: 0
+# requires_deploy: true
+# status:
+# last_updated: 0
+# messages: null
+# status: NA
+# store_event_payload: true
+# target_event_collector_id: 7
+# type_id: 2
+# wincollect_external_destination_ids: null
+# wincollect_internal_destination_id: null
+# - auto_discovered: false
+# average_eps: 0
+# coalesce_events: true
+# creation_date: 1654727944017
+# credibility: 5
+# description: Apache HTTP Server remote logs from rsyslog
+# enabled: true
+# gateway: false
+# group_ids:
+# - 0
+# id: 183
+# internal: false
+# language_id: 1
+# last_event_time: 0
+# log_source_extension_id: null
+# modified_date: 1654728103353
+# name: Apache HTTP Server logs
+# protocol_parameters:
+# - id: 0
+# name: identifier
+# value: 192.0.2.1
+# - id: 1
+# name: incomingPayloadEncoding
+# value: UTF-8
+# protocol_type_id: 0
+# requires_deploy: true
+# status:
+# last_updated: 0
+# messages: null
+# status: NA
+# store_event_payload: true
+# target_event_collector_id: 7
+# type_id: 10
+# wincollect_external_destination_ids: null
+# wincollect_internal_destination_id: null
+"""
+
+RETURN = """
+before:
+ description: The configuration as structured data prior to module invocation.
+ returned: always
+ type: list
+ sample: The configuration returned will always be in the same format of the parameters above.
+after:
+ description: The configuration as structured data after module completion.
+ returned: when changed
+ type: list
+ sample: The configuration returned will always be in the same format of the parameters above.
+"""
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_action.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_action.py
new file mode 100644
index 000000000..784f1e7b1
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_action.py
@@ -0,0 +1,201 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: offense_action
+short_description: Take action on a QRadar Offense
+description:
+ - This module allows to assign, protect, follow up, set status, and assign closing reason to QRadar Offenses
+version_added: "1.0.0"
+options:
+ id:
+ description:
+ - ID of Offense
+ required: true
+ type: int
+ status:
+ description:
+ - One of "open", "hidden" or "closed". (Either all lower case or all caps)
+ required: false
+ choices: [ "open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED" ]
+ type: str
+ assigned_to:
+ description:
+ - Assign to an user, the QRadar username should be provided
+ required: false
+ type: str
+ closing_reason:
+ description:
+ - Assign a predefined closing reason here, by name.
+ required: false
+ type: str
+ closing_reason_id:
+ description:
+ - Assign a predefined closing reason here, by id.
+ required: false
+ type: int
+ follow_up:
+ description:
+ - Set or unset the flag to follow up on a QRadar Offense
+ required: false
+ type: bool
+ protected:
+ description:
+ - Set or unset the flag to protect a QRadar Offense
+ required: false
+ type: bool
+
+notes:
+ - Requires one of C(name) or C(id) be provided
+ - Only one of C(closing_reason) or C(closing_reason_id) can be provided
+
+author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
+"""
+
+"""
+# FIXME - WOULD LIKE TO QUERY BY NAME BUT HOW TO ACCOMPLISH THAT IS NON-OBVIOUS
+# name:
+# description:
+# - Name of Offense
+# required: true
+# type: str
+"""
+
+EXAMPLES = """
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+ set_offense_values,
+)
+
+
+def main():
+
+ argspec = dict(
+ # name=dict(required=False, type='str'),
+ # id=dict(required=False, type='str'),
+ id=dict(required=True, type="int"),
+ assigned_to=dict(required=False, type="str"),
+ closing_reason=dict(required=False, type="str"),
+ closing_reason_id=dict(required=False, type="int"),
+ follow_up=dict(required=False, type="bool"),
+ protected=dict(required=False, type="bool"),
+ status=dict(
+ required=False,
+ choices=["open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED"],
+ type="str",
+ ),
+ )
+
+ module = AnsibleModule(
+ argument_spec=argspec,
+ # required_one_of=[
+ # ('name', 'id',),
+ # ],
+ mutually_exclusive=[("closing_reason", "closing_reason_id")],
+ supports_check_mode=True,
+ )
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["name", "id", "assigned_to", "closing_reason"],
+ )
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME
+ # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name']))
+
+ code, found_offense = qradar_request.get(
+ "/api/siem/offenses/{0}".format(module.params["id"])
+ )
+
+ if found_offense:
+ set_offense_values(module, qradar_request)
+
+ post_strs = []
+
+ if module.params["status"] and (
+ to_text(found_offense["status"])
+ != to_text(module.params["status"])
+ ):
+ post_strs.append(
+ "status={0}".format(to_text(module.params["status"]))
+ )
+
+ if module.params["assigned_to"] and (
+ to_text(found_offense["assigned_to"])
+ != to_text(module.params["assigned_to"])
+ ):
+ post_strs.append(
+ "assigned_to={0}".format(module.params["assigned_to"])
+ )
+
+ if module.params["closing_reason_id"] and (
+ found_offense["closing_reason_id"]
+ != module.params["closing_reason_id"]
+ ):
+ post_strs.append(
+ "closing_reason_id={0}".format(
+ module.params["closing_reason_id"]
+ )
+ )
+
+ if module.params["follow_up"] and (
+ found_offense["follow_up"] != module.params["follow_up"]
+ ):
+ post_strs.append(
+ "follow_up={0}".format(module.params["follow_up"])
+ )
+
+ if module.params["protected"] and (
+ found_offense["protected"] != module.params["protected"]
+ ):
+ post_strs.append(
+ "protected={0}".format(module.params["protected"])
+ )
+
+ if post_strs:
+ if module.check_mode:
+ module.exit_json(
+ msg="A change would have been made but was not because of Check Mode.",
+ changed=True,
+ )
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/siem/offenses/{0}?{1}".format(
+ module.params["id"], "&".join(post_strs)
+ )
+ )
+ # FIXME - handle the scenario in which we can search by name and this isn't a required param anymore
+ module.exit_json(
+ msg="Successfully updated Offense ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ module.exit_json(
+ msg="No changes necessary. Nothing to do.", changed=False
+ )
+ else:
+ # FIXME - handle the scenario in which we can search by name and this isn't a required param anymore
+ module.fail_json(
+ msg="Unable to find Offense ID: {0}".format(module.params["id"])
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_info.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_info.py
new file mode 100644
index 000000000..1ead8a1ae
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_info.py
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+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>
+"""
+
+
+# FIXME - provide correct example here
+RETURN = """
+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
+"""
+
+
+EXAMPLES = """
+- 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
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+ find_dict_in_list,
+ set_offense_values,
+)
+
+
+def main():
+
+ argspec = dict(
+ id=dict(required=False, type="int"),
+ name=dict(required=False, type="str"),
+ assigned_to=dict(required=False, type="str"),
+ closing_reason=dict(required=False, type="str"),
+ closing_reason_id=dict(required=False, type="int"),
+ follow_up=dict(required=False, type="bool", default=None),
+ protected=dict(required=False, type="bool", default=None),
+ status=dict(
+ required=False,
+ choices=["open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED"],
+ default="open",
+ type="str",
+ ),
+ )
+
+ module = AnsibleModule(
+ argument_spec=argspec,
+ mutually_exclusive=[("closing_reason", "closing_reason_id")],
+ supports_check_mode=True,
+ )
+
+ qradar_request = QRadarRequest(module)
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET)
+ # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name']))
+
+ set_offense_values(module, qradar_request)
+
+ if module.params["id"]:
+ code, offenses = qradar_request.get(
+ "/api/siem/offenses/{0}".format(module.params["id"])
+ )
+
+ else:
+ query_strs = []
+
+ if module.params["status"]:
+ query_strs.append(
+ quote("status={0}".format(to_text(module.params["status"])))
+ )
+
+ if module.params["assigned_to"]:
+ query_strs.append(
+ quote("assigned_to={0}".format(module.params["assigned_to"]))
+ )
+
+ if module.params["closing_reason_id"]:
+ query_strs.append(
+ quote(
+ "closing_reason_id={0}".format(
+ module.params["closing_reason_id"]
+ )
+ )
+ )
+
+ if module.params["follow_up"] is not None:
+ query_strs.append(
+ quote("follow_up={0}".format(module.params["follow_up"]))
+ )
+
+ if module.params["protected"] is not None:
+ query_strs.append(
+ quote("protected={0}".format(module.params["protected"]))
+ )
+
+ if query_strs:
+ code, offenses = qradar_request.get(
+ "/api/siem/offenses?filter={0}".format("&".join(query_strs))
+ )
+ else:
+ code, offenses = qradar_request.get("/api/siem/offenses")
+
+ if module.params["name"]:
+ named_offense = find_dict_in_list(
+ offenses, "description", module.params["name"]
+ )
+ if named_offense:
+ offenses = named_offense
+ else:
+ offenses = []
+
+ module.exit_json(offenses=offenses, changed=False)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_note.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_note.py
new file mode 100644
index 000000000..53b6ec95c
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_note.py
@@ -0,0 +1,189 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: offense_note
+short_description: Create or update a QRadar Offense Note
+description:
+ - This module allows to create a QRadar Offense note
+version_added: "1.0.0"
+options:
+ id:
+ description:
+ - Offense ID to operate on
+ required: true
+ type: int
+ note_text:
+ description: The note's text contents
+ required: true
+ type: str
+
+author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
+"""
+
+"""
+# FIXME - WOULD LIKE TO QUERY BY NAME BUT HOW TO ACCOMPLISH THAT IS NON-OBVIOUS
+# offense_name:
+# description:
+# - Name of Offense
+# required: true
+# type: str
+
+# FIXME - WOULD LIKE TO MANAGE STATE
+# state:
+# description: Define state of the note: present or absent
+# required: false
+# choices: ["present", "absent"]
+# default: "present"
+"""
+
+EXAMPLES = """
+- name: Add a note to QRadar Offense ID 1
+ ibm.qradar.offense_note:
+ id: 1
+ note_text: This an example note entry that should be made on offense id 1
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+)
+
+
+def set_offense_values(module, qradar_request):
+ if module.params["closing_reason"]:
+ code, found_closing_reason = qradar_request.get(
+ "/api/siem/offense_closing_reasons?filter={0}".format(
+ quote('text="{0}"'.format(module.params["closing_reason"]))
+ )
+ )
+ if found_closing_reason:
+ module.params["closing_reason_id"] = found_closing_reason[0]["id"]
+ else:
+ module.fail_json(
+ "Unable to find closing_reason text: {0}".format(
+ module.params["closing_reason"]
+ )
+ )
+
+ if module.params["status"]:
+ module.params["status"] = module.params["status"].upper()
+
+
+def main():
+
+ argspec = dict(
+ # state=dict(required=False, choices=["present", "absent"], type='str', default="present"),
+ id=dict(required=True, type="int"),
+ note_text=dict(required=True, type="str"),
+ )
+
+ module = AnsibleModule(argument_spec=argspec, supports_check_mode=True)
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["state", "id"],
+ )
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME
+ # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name']))
+ # FIXME - once this is sorted, add it to module_utils
+
+ code, found_notes = qradar_request.get(
+ "/api/siem/offenses/{0}/notes?filter={1}".format(
+ module.params["id"],
+ quote('note_text="{0}"'.format(module.params["note_text"])),
+ )
+ )
+
+ # if module.params['state'] == 'present':
+
+ if found_notes:
+ # The note we want exists either by ID or by text name, verify
+
+ note = found_notes[0]
+ if note["note_text"] == module.params["note_text"]:
+ module.exit_json(
+ msg="No changes necessary. Nothing to do.", changed=False
+ )
+ else:
+ if module.check_mode:
+ module.exit_json(
+ msg="A change would have occured but did not because Check Mode",
+ changed=True,
+ )
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/siem/offenses/{0}/notes?note_text={1}".format(
+ module.params["id"],
+ quote("{0}".format(module.params["note_text"])),
+ ),
+ data=False,
+ )
+ module.exit_json(
+ msg="Successfully created Offense Note ID: {0}".format(
+ qradar_return_data["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=False,
+ )
+
+ else:
+ if module.check_mode:
+ module.exit_json(
+ msg="A change would have occured but did not because Check Mode",
+ changed=True,
+ )
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/siem/offenses/{0}/notes?note_text={1}".format(
+ module.params["id"],
+ quote("{0}".format(module.params["note_text"])),
+ ),
+ data=False,
+ )
+ module.exit_json(
+ msg="Successfully created Offense Note ID: {0}".format(
+ qradar_return_data["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+
+ module.exit_json(msg="No changes necessary. Nothing to do.", changed=False)
+
+ # FIXME FIXME FIXME - can we actually delete these via the REST API?
+ # if module.params['state'] == 'absent':
+ # if not found_notes:
+ # module.exit_json(msg="No changes necessary. Nothing to do.", changed=False)
+ # else:
+ # if module.check_mode:
+ # module.exit_json(msg="A change would have occured but did not because Check Mode", changed=True)
+ # # FIXME: fix the POST here to actually delete
+ # qradar_return_data = qradar_request.post_by_path(
+ # 'api/siem/offenses/{0}/notes?note_text={1}'.format(
+ # module.params['id'],
+ # quote("{0}".format(module.params['note_text'])),
+ # ),
+ # data=False
+ # )
+ # module.exit_json(
+ # msg="Successfully created Offense Note ID: {0}".format(qradar_return_data['id']),
+ # qradar_return_data=qradar_return_data,
+ # changed=True
+ # )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_rule.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_rule.py
new file mode 100644
index 000000000..f99bab134
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_rule.py
@@ -0,0 +1,262 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: rule
+short_description: Manage state of QRadar Rules, with filter options
+description:
+ - Manage state of 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:
+ - Manage state of a QRadar Rule by ID
+ required: false
+ type: int
+ name:
+ description:
+ - Manage state of a QRadar Rule by name
+ required: false
+ type: str
+ state:
+ description:
+ - Manage state of a QRadar Rule
+ required: True
+ choices: [ "enabled", "disabled", "absent" ]
+ type: str
+ owner:
+ description:
+ - Manage ownership of a QRadar Rule
+ required: false
+ type: str
+
+author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
+"""
+
+
+# FIXME - provide correct example here
+RETURN = """
+"""
+
+EXAMPLES = """
+- name: Enable Rule 'Ansible Example DDoS Rule'
+ qradar_rule:
+ name: 'Ansible Example DDOS Rule'
+ state: enabled
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+)
+import json
+
+
+def main():
+
+ argspec = dict(
+ id=dict(required=False, type="int"),
+ name=dict(required=False, type="str"),
+ state=dict(
+ required=True,
+ choices=["enabled", "disabled", "absent"],
+ type="str",
+ ),
+ owner=dict(required=False, type="str"),
+ )
+
+ module = AnsibleModule(
+ argument_spec=argspec,
+ supports_check_mode=True,
+ required_one_of=[("name", "id")],
+ mutually_exclusive=[("name", "id")],
+ )
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["id", "name", "state", "owner"],
+ )
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET)
+ # found_offense = qradar_request.get('/api/analytics/rules?filter={0}'.format(module.params['name']))
+ module.params["rule"] = {}
+
+ if module.params["id"]:
+ code, module.params["rule"] = qradar_request.get(
+ "/api/analytics/rules/{0}".format(module.params["id"])
+ )
+
+ elif module.params["name"]:
+ code, rules = qradar_request.get(
+ "/api/analytics/rules?filter={0}".format(
+ quote('"{0}"'.format(module.params["name"]))
+ )
+ )
+ if rules:
+ module.params["rule"] = rules[0]
+ module.params["id"] = rules[0]["id"]
+
+ if module.params["state"] == "enabled":
+ if module.params["rule"]:
+ if module.params["rule"]["enabled"] is True:
+ # Already enabled
+ if module.params["id"]:
+ module.exit_json(
+ msg="No change needed for rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data={},
+ changed=False,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully enabled rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data={},
+ changed=False,
+ )
+ else:
+ # Not enabled, enable It
+ module.params["rule"]["enabled"] = True
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/analytics/rules/{0}".format(
+ module.params["rule"]["id"]
+ ),
+ data=json.dumps(module.params["rule"]),
+ )
+ if module.params["id"]:
+ module.exit_json(
+ msg="Successfully enabled rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully enabled rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ if module.params["id"]:
+ module.fail_json(
+ msg="Unable to find rule ID: {0}".format(
+ module.params["id"]
+ )
+ )
+ if module.params["name"]:
+ module.fail_json(
+ msg='Unable to find rule named: "{0}"'.format(
+ module.params["name"]
+ )
+ )
+
+ elif module.params["state"] == "disabled":
+ if module.params["rule"]:
+ if module.params["rule"]["enabled"] is False:
+ # Already disabled
+ if module.params["id"]:
+ module.exit_json(
+ msg="No change needed for rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data={},
+ changed=False,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully enabled rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data={},
+ changed=False,
+ )
+ else:
+ # Not disabled, disable It
+ module.params["rule"]["enabled"] = False
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/analytics/rules/{0}".format(
+ module.params["rule"]["id"]
+ ),
+ data=json.dumps(module.params["rule"]),
+ )
+ if module.params["id"]:
+ module.exit_json(
+ msg="Successfully disabled rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully disabled rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ if module.params["id"]:
+ module.fail_json(
+ msg="Unable to find rule ID: {0}".format(
+ module.params["id"]
+ )
+ )
+ if module.params["name"]:
+ module.fail_json(
+ msg='Unable to find rule named: "{0}"'.format(
+ module.params["name"]
+ )
+ )
+
+ elif module.params["state"] == "absent":
+ if module.params["rule"]:
+ code, qradar_return_data = qradar_request.delete(
+ "/api/analytics/rules/{0}".format(module.params["rule"]["id"])
+ )
+ if module.params["id"]:
+ module.exit_json(
+ msg="Successfully deleted rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully deleted rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ module.exit_json(msg="Nothing to do, rule not found.")
+
+ module.exit_json(rules=rules, changed=False)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/qradar_rule_info.py b/ansible_collections/ibm/qradar/plugins/modules/qradar_rule_info.py
new file mode 100644
index 000000000..d5c92453a
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/qradar_rule_info.py
@@ -0,0 +1,143 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+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>"
+"""
+
+
+# FIXME - provide correct example here
+RETURN = """
+"""
+
+EXAMPLES = """
+- 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
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+)
+
+
+def main():
+
+ argspec = dict(
+ id=dict(required=False, type="int"),
+ name=dict(required=False, type="str"),
+ owner=dict(required=False, type="str"),
+ type=dict(
+ required=False,
+ choices=["EVENT", "FLOW", "COMMON", "USER"],
+ type="str",
+ ),
+ origin=dict(
+ required=False, choices=["SYSTEM", "OVERRIDE", "USER"], type="str"
+ ),
+ )
+
+ module = AnsibleModule(argument_spec=argspec, supports_check_mode=True)
+
+ qradar_request = QRadarRequest(module)
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET)
+ # found_offense = qradar_request.get('/api/analytics/rules?filter={0}'.format(module.params['name']))
+
+ if module.params["id"]:
+ code, rules = qradar_request.get(
+ "/api/analytics/rules/{0}".format(module.params["id"])
+ )
+
+ else:
+ query_strs = []
+
+ if module.params["name"]:
+ query_strs.append(
+ quote('name="{0}"'.format(to_text(module.params["name"])))
+ )
+
+ if module.params["owner"]:
+ query_strs.append(
+ quote("owner={0}".format(module.params["owner"]))
+ )
+
+ if module.params["type"]:
+ query_strs.append(quote("type={0}".format(module.params["type"])))
+
+ if module.params["origin"]:
+ query_strs.append(
+ quote("origin={0}".format(module.params["origin"]))
+ )
+
+ if query_strs:
+ code, rules = qradar_request.get(
+ "/api/analytics/rules?filter={0}".format("&".join(query_strs))
+ )
+ else:
+ code, rules = qradar_request.get("/api/analytics/rules")
+
+ module.exit_json(rules=rules, changed=False)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/rule.py b/ansible_collections/ibm/qradar/plugins/modules/rule.py
new file mode 100644
index 000000000..f99bab134
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/rule.py
@@ -0,0 +1,262 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+module: rule
+short_description: Manage state of QRadar Rules, with filter options
+description:
+ - Manage state of 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:
+ - Manage state of a QRadar Rule by ID
+ required: false
+ type: int
+ name:
+ description:
+ - Manage state of a QRadar Rule by name
+ required: false
+ type: str
+ state:
+ description:
+ - Manage state of a QRadar Rule
+ required: True
+ choices: [ "enabled", "disabled", "absent" ]
+ type: str
+ owner:
+ description:
+ - Manage ownership of a QRadar Rule
+ required: false
+ type: str
+
+author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>
+"""
+
+
+# FIXME - provide correct example here
+RETURN = """
+"""
+
+EXAMPLES = """
+- name: Enable Rule 'Ansible Example DDoS Rule'
+ qradar_rule:
+ name: 'Ansible Example DDOS Rule'
+ state: enabled
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+)
+import json
+
+
+def main():
+
+ argspec = dict(
+ id=dict(required=False, type="int"),
+ name=dict(required=False, type="str"),
+ state=dict(
+ required=True,
+ choices=["enabled", "disabled", "absent"],
+ type="str",
+ ),
+ owner=dict(required=False, type="str"),
+ )
+
+ module = AnsibleModule(
+ argument_spec=argspec,
+ supports_check_mode=True,
+ required_one_of=[("name", "id")],
+ mutually_exclusive=[("name", "id")],
+ )
+
+ qradar_request = QRadarRequest(
+ module,
+ not_rest_data_keys=["id", "name", "state", "owner"],
+ )
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET)
+ # found_offense = qradar_request.get('/api/analytics/rules?filter={0}'.format(module.params['name']))
+ module.params["rule"] = {}
+
+ if module.params["id"]:
+ code, module.params["rule"] = qradar_request.get(
+ "/api/analytics/rules/{0}".format(module.params["id"])
+ )
+
+ elif module.params["name"]:
+ code, rules = qradar_request.get(
+ "/api/analytics/rules?filter={0}".format(
+ quote('"{0}"'.format(module.params["name"]))
+ )
+ )
+ if rules:
+ module.params["rule"] = rules[0]
+ module.params["id"] = rules[0]["id"]
+
+ if module.params["state"] == "enabled":
+ if module.params["rule"]:
+ if module.params["rule"]["enabled"] is True:
+ # Already enabled
+ if module.params["id"]:
+ module.exit_json(
+ msg="No change needed for rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data={},
+ changed=False,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully enabled rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data={},
+ changed=False,
+ )
+ else:
+ # Not enabled, enable It
+ module.params["rule"]["enabled"] = True
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/analytics/rules/{0}".format(
+ module.params["rule"]["id"]
+ ),
+ data=json.dumps(module.params["rule"]),
+ )
+ if module.params["id"]:
+ module.exit_json(
+ msg="Successfully enabled rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully enabled rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ if module.params["id"]:
+ module.fail_json(
+ msg="Unable to find rule ID: {0}".format(
+ module.params["id"]
+ )
+ )
+ if module.params["name"]:
+ module.fail_json(
+ msg='Unable to find rule named: "{0}"'.format(
+ module.params["name"]
+ )
+ )
+
+ elif module.params["state"] == "disabled":
+ if module.params["rule"]:
+ if module.params["rule"]["enabled"] is False:
+ # Already disabled
+ if module.params["id"]:
+ module.exit_json(
+ msg="No change needed for rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data={},
+ changed=False,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully enabled rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data={},
+ changed=False,
+ )
+ else:
+ # Not disabled, disable It
+ module.params["rule"]["enabled"] = False
+
+ qradar_return_data = qradar_request.post_by_path(
+ "api/analytics/rules/{0}".format(
+ module.params["rule"]["id"]
+ ),
+ data=json.dumps(module.params["rule"]),
+ )
+ if module.params["id"]:
+ module.exit_json(
+ msg="Successfully disabled rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully disabled rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ if module.params["id"]:
+ module.fail_json(
+ msg="Unable to find rule ID: {0}".format(
+ module.params["id"]
+ )
+ )
+ if module.params["name"]:
+ module.fail_json(
+ msg='Unable to find rule named: "{0}"'.format(
+ module.params["name"]
+ )
+ )
+
+ elif module.params["state"] == "absent":
+ if module.params["rule"]:
+ code, qradar_return_data = qradar_request.delete(
+ "/api/analytics/rules/{0}".format(module.params["rule"]["id"])
+ )
+ if module.params["id"]:
+ module.exit_json(
+ msg="Successfully deleted rule ID: {0}".format(
+ module.params["id"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ if module.params["name"]:
+ module.exit_json(
+ msg="Successfully deleted rule named: {0}".format(
+ module.params["name"]
+ ),
+ qradar_return_data=qradar_return_data,
+ changed=True,
+ )
+ else:
+ module.exit_json(msg="Nothing to do, rule not found.")
+
+ module.exit_json(rules=rules, changed=False)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/plugins/modules/rule_info.py b/ansible_collections/ibm/qradar/plugins/modules/rule_info.py
new file mode 100644
index 000000000..d5c92453a
--- /dev/null
+++ b/ansible_collections/ibm/qradar/plugins/modules/rule_info.py
@@ -0,0 +1,143 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# (c) 2019, Adam Miller (admiller@redhat.com)
+# 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
+
+DOCUMENTATION = """
+---
+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>"
+"""
+
+
+# FIXME - provide correct example here
+RETURN = """
+"""
+
+EXAMPLES = """
+- 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
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_text
+
+from ansible.module_utils.six.moves.urllib.parse import quote
+from ansible_collections.ibm.qradar.plugins.module_utils.qradar import (
+ QRadarRequest,
+)
+
+
+def main():
+
+ argspec = dict(
+ id=dict(required=False, type="int"),
+ name=dict(required=False, type="str"),
+ owner=dict(required=False, type="str"),
+ type=dict(
+ required=False,
+ choices=["EVENT", "FLOW", "COMMON", "USER"],
+ type="str",
+ ),
+ origin=dict(
+ required=False, choices=["SYSTEM", "OVERRIDE", "USER"], type="str"
+ ),
+ )
+
+ module = AnsibleModule(argument_spec=argspec, supports_check_mode=True)
+
+ qradar_request = QRadarRequest(module)
+
+ # if module.params['name']:
+ # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET)
+ # found_offense = qradar_request.get('/api/analytics/rules?filter={0}'.format(module.params['name']))
+
+ if module.params["id"]:
+ code, rules = qradar_request.get(
+ "/api/analytics/rules/{0}".format(module.params["id"])
+ )
+
+ else:
+ query_strs = []
+
+ if module.params["name"]:
+ query_strs.append(
+ quote('name="{0}"'.format(to_text(module.params["name"])))
+ )
+
+ if module.params["owner"]:
+ query_strs.append(
+ quote("owner={0}".format(module.params["owner"]))
+ )
+
+ if module.params["type"]:
+ query_strs.append(quote("type={0}".format(module.params["type"])))
+
+ if module.params["origin"]:
+ query_strs.append(
+ quote("origin={0}".format(module.params["origin"]))
+ )
+
+ if query_strs:
+ code, rules = qradar_request.get(
+ "/api/analytics/rules?filter={0}".format("&".join(query_strs))
+ )
+ else:
+ code, rules = qradar_request.get("/api/analytics/rules")
+
+ module.exit_json(rules=rules, changed=False)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/ansible_collections/ibm/qradar/pyproject.toml b/ansible_collections/ibm/qradar/pyproject.toml
new file mode 100644
index 000000000..c9ca12efb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/pyproject.toml
@@ -0,0 +1,11 @@
+[tool.black]
+line-length = 100
+
+[tool.pytest.ini_options]
+addopts = ["-vvv", "-n", "2", "--log-level", "WARNING", "--color", "yes"]
+testpaths = [
+ "tests",
+]
+filterwarnings = [
+ 'ignore:AnsibleCollectionFinder has already been configured',
+] \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/requirements.txt b/ansible_collections/ibm/qradar/requirements.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/requirements.txt
diff --git a/ansible_collections/ibm/qradar/test-requirements.txt b/ansible_collections/ibm/qradar/test-requirements.txt
new file mode 100644
index 000000000..8002336b1
--- /dev/null
+++ b/ansible_collections/ibm/qradar/test-requirements.txt
@@ -0,0 +1,8 @@
+black==22.3.0 ; python_version > '3.5'
+flake8
+mock ; python_version < '3.5'
+pexpect
+pytest-xdist
+yamllint
+coverage==4.5.4
+git+https://github.com/ansible-community/pytest-ansible-units.git
diff --git a/ansible_collections/ibm/qradar/tests/.keep b/ansible_collections/ibm/qradar/tests/.keep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/.keep
diff --git a/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network b/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network
new file mode 100644
index 000000000..f26802f63
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network
@@ -0,0 +1 @@
+qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases
new file mode 100644
index 000000000..d7e4f1e4d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases
new file mode 100644
index 000000000..d7e4f1e4d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml
new file mode 100644
index 000000000..cf547abcb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml
@@ -0,0 +1,60 @@
+---
+- name: Create Testing Apache HTTP Server log source
+ log_source_management:
+ name: "Testing Collections PB - 192.168.1.112"
+ type_name: "Apache HTTP Server"
+ state: present
+ description: "Testing Collection PB Description"
+ identifier: "192.168.1.112"
+ register: snort_log_source_create
+
+- name: Assert Create Test Apache HTTP Server log source changed
+ assert:
+ that:
+ - snort_log_source_create is changed
+ - snort_log_source_create is not failed
+
+- name: Create Testing Apache HTTP Server log source RERUN
+ log_source_management:
+ name: "Testing Collections PB - 192.168.1.112"
+ type_name: "Apache HTTP Server"
+ state: present
+ description: "Testing Collection PB Description"
+ identifier: "192.168.1.112"
+ register: snort_log_source_create_rerun
+
+- name: Assert Create Test Apache HTTP Server log source is not changed on RERUN
+ assert:
+ that:
+ - snort_log_source_create_rerun is not changed
+ - snort_log_source_create_rerun is not failed
+
+- name: Delete Testing Apache HTTP Server log source
+ log_source_management:
+ name: "Testing Collections PB - 192.168.1.112"
+ type_name: "Apache HTTP Server"
+ state: absent
+ description: "Testing Collection PB Description"
+ identifier: "192.168.1.112"
+ register: snort_log_source_delete
+
+- name: Assert Delete Test Apache HTTP Server log source changed
+ assert:
+ that:
+ - snort_log_source_delete is changed
+ - snort_log_source_delete is not failed
+
+- name: Delete Testing Apache HTTP Server log source RERUN
+ log_source_management:
+ name: "Testing Collections PB - 192.168.1.112"
+ type_name: "Apache HTTP Server"
+ state: absent
+ description: "Testing Collection PB Description"
+ identifier: "192.168.1.112"
+ register: snort_log_source_delete_rerun
+
+- name: Assert Delete Test Apache HTTP Server log source is not changed on RERUN
+ assert:
+ that:
+ - snort_log_source_delete_rerun is not changed
+ - snort_log_source_delete_rerun is not failed
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases
new file mode 100644
index 000000000..d7e4f1e4d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml
new file mode 100644
index 000000000..7495ec9b8
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml
@@ -0,0 +1,19 @@
+---
+
+#- qradar_offense_action:
+# id: 1
+# status: "hidden"
+# assigned_to: "admin"
+# protected: false
+#
+#- qradar_offense_note:
+# offense_id: 2
+# note_text: "testing note text from playbook - modified"
+#
+#- name: get info about qradar offense
+# qradar_offense_info:
+# protected: true
+# status: "HIDDEN"
+# register: offense_info
+#
+#- debug: var=offense_info
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases
new file mode 100644
index 000000000..d7e4f1e4d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases
new file mode 100644
index 000000000..d7e4f1e4d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml
new file mode 100644
index 000000000..10c0fabcb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+testcase: '*'
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/meta/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/meta/main.yaml
new file mode 100644
index 000000000..23d65c7ef
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/meta/main.yaml
@@ -0,0 +1,2 @@
+---
+dependencies: []
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml
new file mode 100644
index 000000000..dc4768b5c
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml
@@ -0,0 +1,18 @@
+---
+- name: collect all cli test cases
+ find:
+ paths: '{{ role_path }}/tests/cli'
+ patterns: '{{ testcase }}.yaml'
+ register: test_cases
+
+- name: set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: Run test case (connection=ansible.netcommon.httpapi)
+ include: '{{ test_case_to_run }}'
+ vars:
+ ansible_connection: ansible.netcommon.httpapi
+ with_items: '{{ test_items }}'
+ loop_control:
+ loop_var: test_case_to_run
+ tags: connection_httpapi
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml
new file mode 100644
index 000000000..62cc1ae1e
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml
@@ -0,0 +1,7 @@
+---
+- include: cli.yaml
+ tags:
+ - cli
+
+- include: redirection.yaml
+ when: ansible_version.full is version('2.10.0', '>=')
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml
new file mode 100644
index 000000000..a57054c7d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml
@@ -0,0 +1,6 @@
+---
+- name: collect all cli test cases
+ find:
+ paths: '{{ role_path }}/tests/redirection'
+ patterns: '{{ testcase }}.yaml'
+ register: test_cases
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml
new file mode 100644
index 000000000..0b8e6b8f6
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml
@@ -0,0 +1,14 @@
+---
+- name: Populate Log Sources Management for tests
+ tags: merged
+ ibm.qradar.qradar_log_sources_management: &id001
+ state: merged
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.0.2.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "Apache HTTP Server remote logs from rsyslog"
+ identifier: "198.51.100.1" \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml
new file mode 100644
index 000000000..e7f5896be
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml
@@ -0,0 +1,7 @@
+---
+- name: Remove already configured Log Sources Management by Name
+ ibm.qradar.qradar_log_sources_management:
+ state: deleted
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs" \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml
new file mode 100644
index 000000000..f5c70826b
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml
@@ -0,0 +1,38 @@
+---
+- debug:
+ msg: Start Deleted integration state for qradar_log_sources_management ansible_connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_log_sources_config.yaml
+
+- include_tasks: _populate_log_sources_config.yaml
+
+- block:
+
+ - name: Delete attributes of provided configured Log Sources Management
+ register: result
+ ibm.qradar.qradar_log_sources_management: &id001
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: deleted
+
+ - assert:
+ that:
+ - result.changed == true
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
+ \ length == 4 }}"
+ - merged['before'] == result['qradar_log_sources_management']['after']
+
+ - name: Delete attributes of all configured Log Sources Management (IDEMPOTENT)
+ register: result
+ ibm.qradar.qradar_log_sources_management: *id001
+
+ - name: Assert that the previous delete task was idempotent
+ assert:
+ that:
+ - result.changed == false
+
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml
new file mode 100644
index 000000000..c30ad1646
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml
@@ -0,0 +1,27 @@
+---
+- debug:
+ msg: START qradar_log_sources_management gathered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_log_sources_config.yaml
+
+- include_tasks: _populate_log_sources_config.yaml
+
+- block:
+
+ - name: Gather the provided configuration with the exisiting running configuration
+ register: result
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: gathered
+
+ - assert:
+ that:
+ - "{{ merged['after'] | symmetric_difference(result['gathered']) |\
+ \ length == 4 }}"
+ - result['changed'] == false
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml
new file mode 100644
index 000000000..224671edb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml
@@ -0,0 +1,69 @@
+---
+- debug:
+ msg: START Merged qradar_log_sources_management state for integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_log_sources_config.yaml
+
+- block:
+
+ - name: Merge and Create new Log Sources Management
+ tags: merged
+ register: result
+ ibm.qradar.qradar_log_sources_management: &id001
+ state: merged
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.0.2.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "Apache HTTP Server remote logs from rsyslog"
+ identifier: "198.51.100.1"
+
+ - name: To remove creation_date from the after dict
+ set_fact:
+ after: "{{ after | default([]) | combine({ item.key : item.value }) }}"
+ when: "{{item.key not in ['creation_date']}}"
+ with_dict: "{{ dict }}"
+ loop: "{{ result['qradar_log_sources_management']['after'] }}"
+
+ - name: To remove modified_date from the after dict
+ set_fact:
+ after: "{{ after | default([]) | combine({ item.key : item.value }) }}"
+ when: "{{item.key not in ['modified_date']}}"
+ with_dict: "{{ dict }}"
+ loop: "{{ result['qradar_log_sources_management']['after'] }}"
+
+ - name: To remove ID from the after dict
+ set_fact:
+ after: "{{ after | default([]) | combine({ item.key : item.value }) }}"
+ when: "{{item.key not in ['id']}}"
+ with_dict: "{{ dict }}"
+ loop: "{{ result['qradar_log_sources_management']['after'] }}"
+
+ - name: Assert that task reports change and after dict is correctly generated
+ assert:
+ that:
+ - result['changed'] == true
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
+ \ length == 4 }}"
+
+ - name: Assert that before dicts are correctly generated
+ assert:
+ that:
+ - merged['before'] == result['qradar_log_sources_management']['before']
+
+ - name: Merge provided configuration with Log Sources Management (IDEMPOTENT)
+ register: result
+ ibm.qradar.qradar_log_sources_management: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml \ No newline at end of file
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml
new file mode 100644
index 000000000..d8dfd7373
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml
@@ -0,0 +1,45 @@
+---
+- debug:
+ msg: START Replaced qradar_log_sources_management state for integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_log_sources_config.yaml
+- include_tasks: _populate_log_sources_config.yaml
+
+- block:
+
+ - name: Replace existing Log Sources Management
+ register: result
+ ibm.qradar.qradar_log_sources_management: &id001
+ state: replaced
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "REPLACED Snort IDS remote logs from rsyslog"
+ identifier: "198.51.100.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "REPLACED Apache HTTP Server remote logs from rsyslog"
+ identifier: "192.0.2.1"
+
+ - assert:
+ that:
+ - result.changed == true
+ - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
+ \ length == 4 }}"
+ - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
+ \ length == 4 }}"
+
+ - name: Replaces device configuration of listed Log Sources Management with provided configuration
+ (IDEMPOTENT)
+ register: result
+ ibm.qradar.qradar_log_sources_management: *id001
+
+ - name: Assert that task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml
new file mode 100644
index 000000000..0536a6a73
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml
@@ -0,0 +1,62 @@
+---
+- debug:
+ msg: START qradar_log_sources_management round trip integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_log_sources_config.yaml
+
+- block:
+
+ - name: Apply the provided configuration (base config)
+ register: base_config
+ ibm.qradar.qradar_log_sources_management: &id001
+ state: merged
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "Snort IDS remote logs from rsyslog"
+ identifier: "192.0.2.1"
+ - name: "Apache HTTP Server logs"
+ type_name: "Apache HTTP Server"
+ description: "Apache HTTP Server remote logs from rsyslog"
+ identifier: "198.51.100.1"
+
+ - name: Gather Qradar Log Sources Management facts
+ register: gather_result
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ - name: "Apache HTTP Server logs"
+ state: gathered
+
+ - name: Apply the configuration which need to be reverted
+ register: result
+ ibm.qradar.qradar_log_sources_management:
+ config:
+ - name: "Snort logs"
+ type_name: "Snort Open Source IDS"
+ description: "REPLACED Snort IDS remote logs from rsyslog"
+ identifier: "198.51.100.1"
+ state: replaced
+
+ - assert:
+ that:
+ - result.changed == true
+ - "{{ merged['before'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\
+ \ length == 1 }}"
+ - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\
+ \ length == 3 }}"
+
+ - name: Revert back to base config using facts round trip
+ register: revert
+ ibm.qradar.qradar_log_sources_management:
+ config: "{{ gather_result['gathered'] }}"
+ state: replaced
+
+ - assert:
+ that:
+ - revert['changed'] == true
+
+ always:
+
+ - include_tasks: _remove_log_sources_config.yaml
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml
new file mode 100644
index 000000000..7e7c63c52
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml
@@ -0,0 +1,136 @@
+---
+merged:
+ before: []
+
+ after:
+ - auto_discovered: false
+ average_eps: 0
+ coalesce_events: true
+ credibility: 5
+ description: Snort IDS remote logs from rsyslog
+ enabled: true
+ gateway: false
+ group_ids:
+ - 0
+ internal: false
+ language_id: 1
+ last_event_time: 0
+ log_source_extension_id: null
+ name: Snort logs
+ protocol_parameters:
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 192.0.2.1
+ protocol_type_id: 0
+ requires_deploy: true
+ status:
+ last_updated: 0
+ messages: null
+ status: NA
+ store_event_payload: true
+ target_event_collector_id: 7
+ type_id: 2
+ wincollect_external_destination_ids: null
+ wincollect_internal_destination_id: null
+ - auto_discovered: false
+ average_eps: 0
+ coalesce_events: true
+ credibility: 5
+ description: Apache HTTP Server remote logs from rsyslog
+ enabled: true
+ gateway: false
+ group_ids:
+ - 0
+ internal: false
+ language_id: 1
+ last_event_time: 0
+ log_source_extension_id: null
+ name: Apache HTTP Server logs
+ protocol_parameters:
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 198.51.100.1
+ protocol_type_id: 0
+ requires_deploy: true
+ status:
+ last_updated: 0
+ messages: null
+ status: NA
+ store_event_payload: true
+ target_event_collector_id: 7
+ type_id: 10
+ wincollect_external_destination_ids: null
+ wincollect_internal_destination_id: null
+
+replaced:
+ after:
+ - auto_discovered: false
+ average_eps: 0
+ coalesce_events: true
+ credibility: 5
+ description: REPLACED Snort IDS remote logs from rsyslog
+ enabled: true
+ gateway: false
+ group_ids:
+ - 0
+ internal: false
+ language_id: 1
+ last_event_time: 0
+ log_source_extension_id: null
+ name: Snort logs
+ protocol_parameters:
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 198.51.100.1
+ protocol_type_id: 0
+ requires_deploy: true
+ status:
+ last_updated: 0
+ messages: null
+ status: NA
+ store_event_payload: true
+ target_event_collector_id: 7
+ type_id: 2
+ wincollect_external_destination_ids: null
+ wincollect_internal_destination_id: null
+ - auto_discovered: false
+ average_eps: 0
+ coalesce_events: true
+ credibility: 5
+ description: REPLACED Apache HTTP Server remote logs from rsyslog
+ enabled: true
+ gateway: false
+ group_ids:
+ - 0
+ internal: false
+ language_id: 1
+ last_event_time: 0
+ log_source_extension_id: null
+ name: Apache HTTP Server logs
+ protocol_parameters:
+ - id: 1
+ name: incomingPayloadEncoding
+ value: UTF-8
+ - id: 0
+ name: identifier
+ value: 192.0.2.1
+ protocol_type_id: 0
+ requires_deploy: true
+ status:
+ last_updated: 0
+ messages: null
+ status: NA
+ store_event_payload: true
+ target_event_collector_id: 7
+ type_id: 10
+ wincollect_external_destination_ids: null
+ wincollect_internal_destination_id: null
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases
new file mode 100644
index 000000000..d7e4f1e4d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases
new file mode 100644
index 000000000..d7e4f1e4d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases b/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases
new file mode 100644
index 000000000..d7e4f1e4d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases
@@ -0,0 +1 @@
+network/qradar
diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml
new file mode 100644
index 000000000..142fd613d
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml
@@ -0,0 +1,55 @@
+---
+- name: get info about qradar offense
+ rule_info:
+ name: "Service DoS Attack Detected"
+ register: rule_info
+
+- debug: var=rule_info
+
+- name: enable rule by id
+ rule:
+ state: enabled
+ id: "{{ rule_info['rules'][0]['id']|int }}"
+ register: enable_rule_by_id
+
+- name: ensure enable rule by id
+ assert:
+ that:
+ - enable_rule_by_id is changed
+ - enable_rule_by_id is not failed
+
+- name: enable rule by id again
+ rule:
+ state: enabled
+ id: "{{ rule_info['rules'][0]['id']|int }}"
+ register: enable_rule_by_id_again
+
+- name: ensure enable rule by id again
+ assert:
+ that:
+ - enable_rule_by_id_again is not changed
+ - enable_rule_by_id_again is not failed
+
+- name: disable rule by id
+ rule:
+ state: disabled
+ id: "{{ rule_info['rules'][0]['id']|int }}"
+ register: disable_rule_by_id
+
+- name: ensure disable rule by id
+ assert:
+ that:
+ - disable_rule_by_id is changed
+ - disable_rule_by_id is not failed
+
+- name: disable rule by id again
+ rule:
+ state: disabled
+ id: "{{ rule_info['rules'][0]['id']|int }}"
+ register: disable_rule_by_id_again
+
+- name: ensure disable rule by id again
+ assert:
+ that:
+ - disable_rule_by_id_again is not changed
+ - disable_rule_by_id_again is not failed
diff --git a/ansible_collections/ibm/qradar/tests/sanity/ignore-2.9.txt b/ansible_collections/ibm/qradar/tests/sanity/ignore-2.9.txt
new file mode 100644
index 000000000..75b4d0a13
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/sanity/ignore-2.9.txt
@@ -0,0 +1,6 @@
+plugins/modules/log_source_management.py validate-modules:deprecation-mismatch
+plugins/modules/log_source_management.py validate-modules:invalid-documentation
+plugins/modules/rule.py validate-modules:deprecation-mismatch
+plugins/modules/rule.py validate-modules:invalid-documentation
+plugins/modules/rule_info.py validate-modules:deprecation-mismatch
+plugins/modules/rule_info.py validate-modules:invalid-documentation
diff --git a/ansible_collections/ibm/qradar/tests/unit/__init__.py b/ansible_collections/ibm/qradar/tests/unit/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/__init__.py
diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/__init__.py b/ansible_collections/ibm/qradar/tests/unit/compat/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/compat/__init__.py
diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py b/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py
new file mode 100644
index 000000000..bfc8adfbe
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py
@@ -0,0 +1,34 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+#
+# Compat for python2.7
+#
+
+# One unittest needs to import builtins via __import__() so we need to have
+# the string that represents it
+try:
+ import __builtin__
+except ImportError:
+ BUILTINS = "builtins"
+else:
+ BUILTINS = "__builtin__"
diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/mock.py b/ansible_collections/ibm/qradar/tests/unit/compat/mock.py
new file mode 100644
index 000000000..2ea98a17f
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/compat/mock.py
@@ -0,0 +1,128 @@
+# pylint: skip-file
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+"""
+Compat module for Python3.x's unittest.mock module
+"""
+import sys
+
+# Python 2.7
+
+# Note: Could use the pypi mock library on python3.x as well as python2.x. It
+# is the same as the python3 stdlib mock library
+
+try:
+ # Allow wildcard import because we really do want to import all of mock's
+ # symbols into this compat shim
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ from unittest.mock import *
+except ImportError:
+ # Python 2
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ try:
+ from mock import *
+ except ImportError:
+ print("You need the mock library installed on python2.x to run tests")
+
+
+# Prior to 3.4.4, mock_open cannot handle binary read_data
+if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
+ file_spec = None
+
+ def _iterate_read_data(read_data):
+ # Helper for mock_open:
+ # Retrieve lines from read_data via a generator so that separate calls to
+ # readline, read, and readlines are properly interleaved
+ sep = b"\n" if isinstance(read_data, bytes) else "\n"
+ data_as_list = [l + sep for l in read_data.split(sep)]
+
+ if data_as_list[-1] == sep:
+ # If the last line ended in a newline, the list comprehension will have an
+ # extra entry that's just a newline. Remove this.
+ data_as_list = data_as_list[:-1]
+ else:
+ # If there wasn't an extra newline by itself, then the file being
+ # emulated doesn't have a newline to end the last line remove the
+ # newline that our naive format() added
+ data_as_list[-1] = data_as_list[-1][:-1]
+
+ for line in data_as_list:
+ yield line
+
+ def mock_open(mock=None, read_data=""):
+ """
+ A helper function to create a mock to replace the use of `open`. It works
+ for `open` called directly or used as a context manager.
+
+ The `mock` argument is the mock object to configure. If `None` (the
+ default) then a `MagicMock` will be created for you, with the API limited
+ to methods or attributes available on standard file handles.
+
+ `read_data` is a string for the `read` methoddline`, and `readlines` of the
+ file handle to return. This is an empty string by default.
+ """
+
+ def _readlines_side_effect(*args, **kwargs):
+ if handle.readlines.return_value is not None:
+ return handle.readlines.return_value
+ return list(_data)
+
+ def _read_side_effect(*args, **kwargs):
+ if handle.read.return_value is not None:
+ return handle.read.return_value
+ return type(read_data)().join(_data)
+
+ def _readline_side_effect():
+ if handle.readline.return_value is not None:
+ while True:
+ yield handle.readline.return_value
+ for line in _data:
+ yield line
+
+ global file_spec
+ if file_spec is None:
+ import _io
+
+ file_spec = list(
+ set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))
+ )
+
+ if mock is None:
+ mock = MagicMock(name="open", spec=open)
+
+ handle = MagicMock(spec=file_spec)
+ handle.__enter__.return_value = handle
+
+ _data = _iterate_read_data(read_data)
+
+ handle.write.return_value = None
+ handle.read.return_value = None
+ handle.readline.return_value = None
+ handle.readlines.return_value = None
+
+ handle.read.side_effect = _read_side_effect
+ handle.readline.side_effect = _readline_side_effect()
+ handle.readlines.side_effect = _readlines_side_effect
+
+ mock.return_value = handle
+ return mock
diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py b/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py
new file mode 100644
index 000000000..df3379b82
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py
@@ -0,0 +1,39 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+"""
+Compat module for Python2.7's unittest module
+"""
+
+import sys
+
+# Allow wildcard import because we really do want to import all of
+# unittests's symbols into this compat shim
+# pylint: disable=wildcard-import,unused-wildcard-import
+if sys.version_info < (2, 7):
+ try:
+ # Need unittest2 on python2.6
+ from unittest2 import *
+ except ImportError:
+ print("You need unittest2 installed on python2.6.x to run tests")
+else:
+ from unittest import *
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/__init__.py b/ansible_collections/ibm/qradar/tests/unit/mock/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/__init__.py
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/loader.py b/ansible_collections/ibm/qradar/tests/unit/mock/loader.py
new file mode 100644
index 000000000..19c44a7e8
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/loader.py
@@ -0,0 +1,116 @@
+# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+import os
+
+from ansible.errors import AnsibleParserError
+from ansible.parsing.dataloader import DataLoader
+from ansible.module_utils._text import to_bytes, to_text
+
+
+class DictDataLoader(DataLoader):
+ def __init__(self, file_mapping=None):
+ file_mapping = {} if file_mapping is None else file_mapping
+ assert type(file_mapping) == dict
+
+ super(DictDataLoader, self).__init__()
+
+ self._file_mapping = file_mapping
+ self._build_known_directories()
+ self._vault_secrets = None
+
+ def load_from_file(self, path, cache=True, unsafe=False):
+ path = to_text(path)
+ if path in self._file_mapping:
+ return self.load(self._file_mapping[path], path)
+ return None
+
+ # TODO: the real _get_file_contents returns a bytestring, so we actually convert the
+ # unicode/text it's created with to utf-8
+ def _get_file_contents(self, file_name):
+ path = to_text(file_name)
+ if path in self._file_mapping:
+ return (to_bytes(self._file_mapping[path]), False)
+ else:
+ raise AnsibleParserError("file not found: %s" % path)
+
+ def path_exists(self, path):
+ path = to_text(path)
+ return path in self._file_mapping or path in self._known_directories
+
+ def is_file(self, path):
+ path = to_text(path)
+ return path in self._file_mapping
+
+ def is_directory(self, path):
+ path = to_text(path)
+ return path in self._known_directories
+
+ def list_directory(self, path):
+ ret = []
+ path = to_text(path)
+ for x in list(self._file_mapping.keys()) + self._known_directories:
+ if x.startswith(path):
+ if os.path.dirname(x) == path:
+ ret.append(os.path.basename(x))
+ return ret
+
+ def is_executable(self, path):
+ # FIXME: figure out a way to make paths return true for this
+ return False
+
+ def _add_known_directory(self, directory):
+ if directory not in self._known_directories:
+ self._known_directories.append(directory)
+
+ def _build_known_directories(self):
+ self._known_directories = []
+ for path in self._file_mapping:
+ dirname = os.path.dirname(path)
+ while dirname not in ("/", ""):
+ self._add_known_directory(dirname)
+ dirname = os.path.dirname(dirname)
+
+ def push(self, path, content):
+ rebuild_dirs = False
+ if path not in self._file_mapping:
+ rebuild_dirs = True
+
+ self._file_mapping[path] = content
+
+ if rebuild_dirs:
+ self._build_known_directories()
+
+ def pop(self, path):
+ if path in self._file_mapping:
+ del self._file_mapping[path]
+ self._build_known_directories()
+
+ def clear(self):
+ self._file_mapping = dict()
+ self._known_directories = []
+
+ def get_basedir(self):
+ return os.getcwd()
+
+ def set_vault_secrets(self, vault_secrets):
+ self._vault_secrets = vault_secrets
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/path.py b/ansible_collections/ibm/qradar/tests/unit/mock/path.py
new file mode 100644
index 000000000..1e5902864
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/path.py
@@ -0,0 +1,12 @@
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import (
+ MagicMock,
+)
+from ansible.utils.path import unfrackpath
+
+
+mock_unfrackpath_noop = MagicMock(
+ spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x
+)
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py b/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py
new file mode 100644
index 000000000..f7ab5fe91
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py
@@ -0,0 +1,94 @@
+# (c) 2016, Matt Davis <mdavis@ansible.com>
+# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+import sys
+import json
+
+from contextlib import contextmanager
+from io import BytesIO, StringIO
+from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest
+from ansible.module_utils.six import PY3
+from ansible.module_utils._text import to_bytes
+
+
+@contextmanager
+def swap_stdin_and_argv(stdin_data="", argv_data=tuple()):
+ """
+ context manager that temporarily masks the test runner's values for stdin and argv
+ """
+ real_stdin = sys.stdin
+ real_argv = sys.argv
+
+ if PY3:
+ fake_stream = StringIO(stdin_data)
+ fake_stream.buffer = BytesIO(to_bytes(stdin_data))
+ else:
+ fake_stream = BytesIO(to_bytes(stdin_data))
+
+ try:
+ sys.stdin = fake_stream
+ sys.argv = argv_data
+
+ yield
+ finally:
+ sys.stdin = real_stdin
+ sys.argv = real_argv
+
+
+@contextmanager
+def swap_stdout():
+ """
+ context manager that temporarily replaces stdout for tests that need to verify output
+ """
+ old_stdout = sys.stdout
+
+ if PY3:
+ fake_stream = StringIO()
+ else:
+ fake_stream = BytesIO()
+
+ try:
+ sys.stdout = fake_stream
+
+ yield fake_stream
+ finally:
+ sys.stdout = old_stdout
+
+
+class ModuleTestCase(unittest.TestCase):
+ def setUp(self, module_args=None):
+ if module_args is None:
+ module_args = {
+ "_ansible_remote_tmp": "/tmp",
+ "_ansible_keep_remote_files": False,
+ }
+
+ args = json.dumps(dict(ANSIBLE_MODULE_ARGS=module_args))
+
+ # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually
+ self.stdin_swap = swap_stdin_and_argv(stdin_data=args)
+ self.stdin_swap.__enter__()
+
+ def tearDown(self):
+ # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually
+ self.stdin_swap.__exit__(None, None, None)
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py b/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py
new file mode 100644
index 000000000..b34ae1340
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py
@@ -0,0 +1,42 @@
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+from ansible.module_utils._text import to_bytes
+
+from ansible.parsing.vault import VaultSecret
+
+
+class TextVaultSecret(VaultSecret):
+ """A secret piece of text. ie, a password. Tracks text encoding.
+
+ The text encoding of the text may not be the default text encoding so
+ we keep track of the encoding so we encode it to the same bytes."""
+
+ def __init__(self, text, encoding=None, errors=None, _bytes=None):
+ super(TextVaultSecret, self).__init__()
+ self.text = text
+ self.encoding = encoding or "utf-8"
+ self._bytes = _bytes
+ self.errors = errors or "strict"
+
+ @property
+ def bytes(self):
+ """The text encoded with encoding, unless we specifically set _bytes."""
+ return self._bytes or to_bytes(
+ self.text, encoding=self.encoding, errors=self.errors
+ )
diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py b/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py
new file mode 100644
index 000000000..5df30aaed
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py
@@ -0,0 +1,167 @@
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+import io
+import yaml
+
+from ansible.module_utils.six import PY3
+from ansible.parsing.yaml.loader import AnsibleLoader
+from ansible.parsing.yaml.dumper import AnsibleDumper
+
+
+class YamlTestUtils(object):
+ """Mixin class to combine with a unittest.TestCase subclass."""
+
+ def _loader(self, stream):
+ """Vault related tests will want to override this.
+
+ Vault cases should setup a AnsibleLoader that has the vault password."""
+ return AnsibleLoader(stream)
+
+ def _dump_stream(self, obj, stream, dumper=None):
+ """Dump to a py2-unicode or py3-string stream."""
+ if PY3:
+ return yaml.dump(obj, stream, Dumper=dumper)
+ else:
+ return yaml.dump(obj, stream, Dumper=dumper, encoding=None)
+
+ def _dump_string(self, obj, dumper=None):
+ """Dump to a py2-unicode or py3-string"""
+ if PY3:
+ return yaml.dump(obj, Dumper=dumper)
+ else:
+ return yaml.dump(obj, Dumper=dumper, encoding=None)
+
+ def _dump_load_cycle(self, obj):
+ # Each pass though a dump or load revs the 'generation'
+ # obj to yaml string
+ string_from_object_dump = self._dump_string(obj, dumper=AnsibleDumper)
+
+ # wrap a stream/file like StringIO around that yaml
+ stream_from_object_dump = io.StringIO(string_from_object_dump)
+ loader = self._loader(stream_from_object_dump)
+ # load the yaml stream to create a new instance of the object (gen 2)
+ obj_2 = loader.get_data()
+
+ # dump the gen 2 objects directory to strings
+ string_from_object_dump_2 = self._dump_string(
+ obj_2, dumper=AnsibleDumper
+ )
+
+ # The gen 1 and gen 2 yaml strings
+ self.assertEqual(string_from_object_dump, string_from_object_dump_2)
+ # the gen 1 (orig) and gen 2 py object
+ self.assertEqual(obj, obj_2)
+
+ # again! gen 3... load strings into py objects
+ stream_3 = io.StringIO(string_from_object_dump_2)
+ loader_3 = self._loader(stream_3)
+ obj_3 = loader_3.get_data()
+
+ string_from_object_dump_3 = self._dump_string(
+ obj_3, dumper=AnsibleDumper
+ )
+
+ self.assertEqual(obj, obj_3)
+ # should be transitive, but...
+ self.assertEqual(obj_2, obj_3)
+ self.assertEqual(string_from_object_dump, string_from_object_dump_3)
+
+ def _old_dump_load_cycle(self, obj):
+ """Dump the passed in object to yaml, load it back up, dump again, compare."""
+ stream = io.StringIO()
+
+ yaml_string = self._dump_string(obj, dumper=AnsibleDumper)
+ self._dump_stream(obj, stream, dumper=AnsibleDumper)
+
+ yaml_string_from_stream = stream.getvalue()
+
+ # reset stream
+ stream.seek(0)
+
+ loader = self._loader(stream)
+ # loader = AnsibleLoader(stream, vault_password=self.vault_password)
+ obj_from_stream = loader.get_data()
+
+ stream_from_string = io.StringIO(yaml_string)
+ loader2 = self._loader(stream_from_string)
+ # loader2 = AnsibleLoader(stream_from_string, vault_password=self.vault_password)
+ obj_from_string = loader2.get_data()
+
+ stream_obj_from_stream = io.StringIO()
+ stream_obj_from_string = io.StringIO()
+
+ if PY3:
+ yaml.dump(
+ obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper
+ )
+ yaml.dump(
+ obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper
+ )
+ else:
+ yaml.dump(
+ obj_from_stream,
+ stream_obj_from_stream,
+ Dumper=AnsibleDumper,
+ encoding=None,
+ )
+ yaml.dump(
+ obj_from_stream,
+ stream_obj_from_string,
+ Dumper=AnsibleDumper,
+ encoding=None,
+ )
+
+ yaml_string_stream_obj_from_stream = stream_obj_from_stream.getvalue()
+ yaml_string_stream_obj_from_string = stream_obj_from_string.getvalue()
+
+ stream_obj_from_stream.seek(0)
+ stream_obj_from_string.seek(0)
+
+ if PY3:
+ yaml_string_obj_from_stream = yaml.dump(
+ obj_from_stream, Dumper=AnsibleDumper
+ )
+ yaml_string_obj_from_string = yaml.dump(
+ obj_from_string, Dumper=AnsibleDumper
+ )
+ else:
+ yaml_string_obj_from_stream = yaml.dump(
+ obj_from_stream, Dumper=AnsibleDumper, encoding=None
+ )
+ yaml_string_obj_from_string = yaml.dump(
+ obj_from_string, Dumper=AnsibleDumper, encoding=None
+ )
+
+ assert yaml_string == yaml_string_obj_from_stream
+ assert (
+ yaml_string
+ == yaml_string_obj_from_stream
+ == yaml_string_obj_from_string
+ )
+ assert (
+ yaml_string
+ == yaml_string_obj_from_stream
+ == yaml_string_obj_from_string
+ == yaml_string_stream_obj_from_stream
+ == yaml_string_stream_obj_from_string
+ )
+ assert obj == obj_from_stream
+ assert obj == obj_from_string
+ assert obj == yaml_string_obj_from_stream
+ assert obj == yaml_string_obj_from_string
+ assert (
+ obj
+ == obj_from_stream
+ == obj_from_string
+ == yaml_string_obj_from_stream
+ == yaml_string_obj_from_string
+ )
+ return {
+ "obj": obj,
+ "yaml_string": yaml_string,
+ "yaml_string_from_stream": yaml_string_from_stream,
+ "obj_from_stream": obj_from_stream,
+ "obj_from_string": obj_from_string,
+ "yaml_string_obj_from_string": yaml_string_obj_from_string,
+ }
diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/action/__init__.py b/ansible_collections/ibm/qradar/tests/unit/plugins/action/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/plugins/action/__init__.py
diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py b/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py
new file mode 100644
index 000000000..390992698
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py
@@ -0,0 +1,165 @@
+# Copyright (c) 2022 Red Hat
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+#
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+import unittest
+import tempfile
+from ansible.playbook.task import Task
+from ansible.template import Templar
+from ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules import (
+ ActionModule,
+)
+from ansible_collections.ansible.utils.tests.unit.compat.mock import (
+ MagicMock,
+ patch,
+)
+
+RESPONSE_PAYLOAD = {
+ "average_capacity": "null",
+ "base_capacity": "null",
+ "base_host_id": "null",
+ "capacity_timestamp": "null",
+ "creation_date": "1658929682568",
+ "enabled": False,
+ "id": "100443",
+ "identifier": "ae5a1268-02a0-4976-84c5-dbcbcf854b9c",
+ "linked_rule_identifier": "null",
+ "modification_date": "1658929682567",
+ "name": "Ansible Example DDOS Rule",
+ "origin": "USER",
+ "owner": "admin",
+ "type": "EVENT",
+}
+
+REQUEST_PAYLOAD = {
+ "name": "Ansible Example DDOS Rule",
+ "enabled": True,
+}
+
+
+class TestQradarAnalyticsRules(unittest.TestCase):
+ def setUp(self):
+ task = MagicMock(Task)
+ # Ansible > 2.13 looks for check_mode in task
+ task.check_mode = False
+ play_context = MagicMock()
+ # Ansible <= 2.13 looks for check_mode in play_context
+ play_context.check_mode = False
+ connection = patch(
+ "ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules.Connection"
+ )
+ fake_loader = {}
+ templar = Templar(loader=fake_loader)
+ self._plugin = ActionModule(
+ task=task,
+ connection=connection,
+ play_context=play_context,
+ loader=fake_loader,
+ templar=templar,
+ shared_loader_obj=None,
+ )
+ self._plugin._task.action = "qradar_analytics_rules"
+ self._task_vars = {}
+
+ @patch("ansible.module_utils.connection.Connection.__rpc__")
+ def test_qradar_analytics_rules_merged(self, connection):
+ self._plugin.search_for_resource = MagicMock()
+ self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD
+ self._plugin._connection.socket_path = (
+ tempfile.NamedTemporaryFile().name
+ )
+ self._plugin._connection._shell = MagicMock()
+ self._plugin._task.args = {
+ "state": "merged",
+ "config": REQUEST_PAYLOAD,
+ }
+ result = self._plugin.run(task_vars=self._task_vars)
+ self.assertTrue(result["changed"])
+
+ @patch("ansible.module_utils.connection.Connection.__rpc__")
+ def test_qradar_analytics_rules_merged_idempotent(self, connection):
+ self._plugin._connection.socket_path = (
+ tempfile.NamedTemporaryFile().name
+ )
+ self._plugin._connection._shell = MagicMock()
+ self._plugin.search_for_resource = MagicMock()
+ self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD
+ self._plugin.api_return = "qradar_analytics_rules"
+ self._plugin._task.args = {
+ "state": "merged",
+ "config": {
+ "enabled": False,
+ "name": "Ansible Example DDOS Rule",
+ },
+ }
+ result = self._plugin.run(task_vars=self._task_vars)
+ self.assertFalse(result["changed"])
+
+ @patch("ansible.module_utils.connection.Connection.__rpc__")
+ def test_qradar_analytics_rules_deleted(self, connection):
+ self._plugin._connection.socket_path = (
+ tempfile.NamedTemporaryFile().name
+ )
+ self._plugin._connection._shell = MagicMock()
+ self._plugin.search_for_resource = MagicMock()
+ self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD
+ self._plugin.api_return = "qradar_analytics_rules"
+ self._plugin._task.args = {
+ "state": "deleted",
+ "config": {
+ "name": "Ansible Example DDOS Rule",
+ },
+ }
+ result = self._plugin.run(task_vars=self._task_vars)
+ self.assertTrue(result["changed"])
+
+ @patch("ansible.module_utils.connection.Connection.__rpc__")
+ def test_qradar_analytics_rules_deleted_idempotent(self, connection):
+ self._plugin.search_for_resource = MagicMock()
+ self._plugin.search_for_resource.return_value = {}
+ self._plugin._connection.socket_path = (
+ tempfile.NamedTemporaryFile().name
+ )
+ self._plugin._connection._shell = MagicMock()
+ self._plugin._task.args = {
+ "state": "deleted",
+ "config": {
+ "name": "Ansible Example DDOS Rule",
+ },
+ }
+ result = self._plugin.run(task_vars=self._task_vars)
+ self.assertFalse(result["changed"])
+
+ @patch("ansible.module_utils.connection.Connection.__rpc__")
+ def test_qradar_analytics_rules_gathered(self, connection):
+ self._plugin._connection.socket_path = (
+ tempfile.NamedTemporaryFile().name
+ )
+ self._plugin._connection._shell = MagicMock()
+ self._plugin.search_for_resource = MagicMock()
+ self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD
+ self._plugin.api_return = "qradar_analytics_rules"
+ self._plugin._task.args = {
+ "state": "gathered",
+ "config": {"name": "Ansible Example DDOS Rule"},
+ }
+ result = self._plugin.run(task_vars=self._task_vars)
+ self.assertEqual(result["gathered"], RESPONSE_PAYLOAD)
diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/__init__.py b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/__init__.py
diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py
new file mode 100644
index 000000000..e19a1e04c
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py
@@ -0,0 +1,40 @@
+# Copyright (c) 2017 Ansible Project
+# 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
+
+import json
+
+import pytest
+
+from ansible.module_utils.six import string_types
+from ansible.module_utils._text import to_bytes
+from ansible.module_utils.common._collections_compat import MutableMapping
+
+
+@pytest.fixture
+def patch_ansible_module(request, mocker):
+ if isinstance(request.param, string_types):
+ args = request.param
+ elif isinstance(request.param, MutableMapping):
+ if "ANSIBLE_MODULE_ARGS" not in request.param:
+ request.param = {"ANSIBLE_MODULE_ARGS": request.param}
+ if "_ansible_remote_tmp" not in request.param["ANSIBLE_MODULE_ARGS"]:
+ request.param["ANSIBLE_MODULE_ARGS"][
+ "_ansible_remote_tmp"
+ ] = "/tmp"
+ if (
+ "_ansible_keep_remote_files"
+ not in request.param["ANSIBLE_MODULE_ARGS"]
+ ):
+ request.param["ANSIBLE_MODULE_ARGS"][
+ "_ansible_keep_remote_files"
+ ] = False
+ args = json.dumps(request.param)
+ else:
+ raise Exception(
+ "Malformed data to the patch_ansible_module pytest fixture"
+ )
+
+ mocker.patch("ansible.module_utils.basic._ANSIBLE_ARGS", to_bytes(args))
diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py
new file mode 100644
index 000000000..d55afc0b3
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py
@@ -0,0 +1,51 @@
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+import json
+
+from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest
+from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import patch
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+
+
+def set_module_args(args):
+ if "_ansible_remote_tmp" not in args:
+ args["_ansible_remote_tmp"] = "/tmp"
+ if "_ansible_keep_remote_files" not in args:
+ args["_ansible_keep_remote_files"] = False
+
+ args = json.dumps({"ANSIBLE_MODULE_ARGS": args})
+ basic._ANSIBLE_ARGS = to_bytes(args)
+
+
+class AnsibleExitJson(Exception):
+ pass
+
+
+class AnsibleFailJson(Exception):
+ pass
+
+
+def exit_json(*args, **kwargs):
+ if "changed" not in kwargs:
+ kwargs["changed"] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs):
+ kwargs["failed"] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class ModuleTestCase(unittest.TestCase):
+ def setUp(self):
+ self.mock_module = patch.multiple(
+ basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json
+ )
+ self.mock_module.start()
+ self.mock_sleep = patch("time.sleep")
+ self.mock_sleep.start()
+ set_module_args({})
+ self.addCleanup(self.mock_module.stop)
+ self.addCleanup(self.mock_sleep.stop)
diff --git a/ansible_collections/ibm/qradar/tests/unit/requirements.txt b/ansible_collections/ibm/qradar/tests/unit/requirements.txt
new file mode 100644
index 000000000..a9772bea1
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tests/unit/requirements.txt
@@ -0,0 +1,42 @@
+boto3
+placebo
+pycrypto
+passlib
+pypsrp
+python-memcached
+pytz
+pyvmomi
+redis
+requests
+setuptools > 0.6 # pytest-xdist installed via requirements does not work with very old setuptools (sanity_ok)
+unittest2 ; python_version < '2.7'
+importlib ; python_version < '2.7'
+netaddr
+ipaddress
+netapp-lib
+solidfire-sdk-python
+
+# requirements for F5 specific modules
+f5-sdk ; python_version >= '2.7'
+f5-icontrol-rest ; python_version >= '2.7'
+deepdiff
+
+# requirement for Fortinet specific modules
+pyFMG
+
+# requirement for aci_rest module
+xmljson
+
+# requirement for winrm connection plugin tests
+pexpect
+
+# requirement for the linode module
+linode-python # APIv3
+linode_api4 ; python_version > '2.6' # APIv4
+
+# requirement for the gitlab module
+python-gitlab
+httmock
+
+# requirment for kubevirt modules
+openshift ; python_version >= '2.7'
diff --git a/ansible_collections/ibm/qradar/tox.ini b/ansible_collections/ibm/qradar/tox.ini
new file mode 100644
index 000000000..a533ccb30
--- /dev/null
+++ b/ansible_collections/ibm/qradar/tox.ini
@@ -0,0 +1,33 @@
+[tox]
+minversion = 1.4.2
+envlist = linters
+skipsdist = True
+
+[testenv]
+basepython = python3
+deps = -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+commands = find {toxinidir} -type f -name "*.py[c|o]" -delete
+
+[testenv:black]
+install_command = pip install {opts} {packages}
+commands =
+ black -v -l79 {toxinidir}
+
+[testenv:linters]
+install_command = pip install {opts} {packages}
+commands =
+ black -v -l79 --check {toxinidir}
+ flake8 {posargs}
+
+[testenv:venv]
+commands = {posargs}
+
+[flake8]
+# E123, E125 skipped as they are invalid PEP-8.
+
+show-source = True
+ignore = E123,E125,E402,E501,E741,W503
+max-line-length = 160
+builtins = _
+exclude = .git,.tox,tests/unit/compat/