Skip to content

Commit

Permalink
fix(sensor_download_info): use v2 override for new endpoint (#520)
Browse files Browse the repository at this point in the history
* fix(sensor_download_info): use v2 override for new endpoint

To maintain backwards compatability with FalconPy, we take advantage of
the override feature that allows us to use the new
sensors/combined/installers/v2 endpoint. This means we can now pass in
architectures as a filter.

This also updates the limit to ensure users know the default limit is
set to 100.

* chore: minor wording changes to remove need for offset

This particular endpoint doesn't provide an offset which is strange
since the default limit is 100 and if you have more than that you
wouldn't know without passing in a larger limit.
  • Loading branch information
carlosmmatos authored May 21, 2024
1 parent 21dfbed commit 7d30714
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions plugins/modules/sensor_download_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@
- Returns a set of Sensor Installers which match the filter criteria.
options:
filter:
description:
- The filter expression that should be used to limit the results using FQL (Falcon Query Language) syntax.
- See the return values or CrowdStrike docs for more information about the available filters that can be used.
type: str
limit:
description:
- The maximum number of records to return. [1-500]
- Use with the offset parameter to manage pagination of results.
default: 100
type: int
extends_documentation_fragment:
- crowdstrike.falcon.credentials
- crowdstrike.falcon.credentials.auth
- crowdstrike.falcon.info
- crowdstrike.falcon.info.sort
requirements:
Expand All @@ -40,15 +44,20 @@
"""

EXAMPLES = r"""
- name: Get a list of Linux Sensor Installers
- name: Get a list of all Linux Sensor Installers
crowdstrike.falcon.sensor_download_info:
filter: "platform:'linux'"
limit: 200
- name: Get a list of the 2 latest Windows Sensor Installers
crowdstrike.falcon.sensor_download_info:
limit: 2
filter: "platform:'windows'"
sort: "version|desc"
- name: Get all zLinux(s390x) Sensor Installers
crowdstrike.falcon.sensor_download_info:
filter: "platform:'linux' + architectures:'s390x'"
"""

RETURN = r"""
Expand Down Expand Up @@ -110,6 +119,12 @@
returned: success
type: str
sample: 6.22.11404
architectures:
description: A list of architectures supported by the Sensor Installer.
returned: success
type: list
elements: str
sample: x86_64
"""

import traceback
Expand All @@ -135,7 +150,7 @@

DOWNLOAD_INFO_ARGS = {
"filter": {"type": "str", "required": False},
"limit": {"type": "int", "required": False},
"limit": {"type": "int", "required": False, "default": 100},
"offset": {"type": "int", "required": False},
"sort": {"type": "str", "required": False},
}
Expand Down Expand Up @@ -170,7 +185,7 @@ def main():

falcon = authenticate(module, SensorDownload)

query_result = falcon.get_combined_sensor_installers_by_query(**args)
query_result = falcon.override("GET", "/sensors/combined/installers/v2", parameters={**args})

result = dict(
changed=False,
Expand Down

0 comments on commit 7d30714

Please sign in to comment.