Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Netskope Event Collector] Add support for event type selection #32300

Conversation

samuelFain
Copy link
Contributor

@samuelFain samuelFain commented Jan 18, 2024

Contributing to Cortex XSOAR Content

Make sure to register your contribution by filling the contribution registration form

The Pull Request will be reviewed only after the contribution registration form is filled.

Status

  • In Progress
  • Ready
  • In Hold - (Reason for hold)

Related Issues

fixes: XSUP-32126

Description

Add the Event Types To Fetch parameter to support fetching of specific event types.

Must have

  • Tests
  • Documentation

@samuelFain samuelFain changed the title [Netskope Event Collector] [Netskope Event Collector] Add support for event type selection Jan 18, 2024
Updated logic to handle fetching specific events
@samuelFain samuelFain self-assigned this Jan 18, 2024
@samuelFain samuelFain marked this pull request as draft January 18, 2024 14:45
@samuelFain samuelFain marked this pull request as ready for review January 21, 2024 11:54
Copy link
Contributor

@JasBeilin JasBeilin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! See my comments.

Comment on lines 301 to 311
def handle_event_types_to_fetch(event_types_to_fetch) -> list[str]:
""" Handle event_types_to_fetch parameter.
Transform the event_types_to_fetch parameter into a pythonic list with lowercase values.
"""
def format_event_type_name(event_name: str) -> str:
return event_name.lower()

return argToList(
arg=event_types_to_fetch,
transform=format_event_type_name,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 While I love functions, we can make this a one liner-

Suggested change
def handle_event_types_to_fetch(event_types_to_fetch) -> list[str]:
""" Handle event_types_to_fetch parameter.
Transform the event_types_to_fetch parameter into a pythonic list with lowercase values.
"""
def format_event_type_name(event_name: str) -> str:
return event_name.lower()
return argToList(
arg=event_types_to_fetch,
transform=format_event_type_name,
)
def handle_event_types_to_fetch(event_types_to_fetch) -> list[str]:
""" Handle event_types_to_fetch parameter.
Transform the event_types_to_fetch parameter into a pythonic list with lowercase values.
"""
return argToList(
arg=event_types_to_fetch,
transform=lambda x: x.lower(),
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

name: event_types_to_fetch
type: 16
required: false
additionalinfo: 'Event types to be fetched by this instance. Default is: Application, Alert, Page, Audit, Network.'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
additionalinfo: 'Event types to be fetched by this instance. Default is: Application, Alert, Page, Audit, Network.'
additionalinfo: 'Event types to fetch. Default is all available types: Application, Alert, Page, Audit, Network.'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Minor updates to logic and UT
Copy link
Contributor

@JasBeilin JasBeilin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Add nextTrigger key-value pair to lastRun dictionary
Copy link

github-actions bot commented Feb 6, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
Packs/Netskope/Integrations/NetskopeEventCollector
   NetskopeEventCollector.py118992%81–82, 97, 99, 207, 211–212, 266–267
TOTAL118992% 

Tests Skipped Failures Errors Time
14 0 💤 0 ❌ 0 🔥 11.446s ⏱️

@samuelFain samuelFain merged commit 218d27d into master Feb 8, 2024
19 checks passed
@samuelFain samuelFain deleted the feature/XSUP-32126/netskope-event-collector-add-event-type-selection branch February 8, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants