Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
1c78512
feat: Add list watchlist function
PaperMtn Nov 22, 2025
a50b9dd
feat: Add list watchlist function
PaperMtn Nov 22, 2025
4c8c728
feat: Add get watchlist function
PaperMtn Nov 22, 2025
d6e6112
feat: Add delete watchlist function
PaperMtn Nov 23, 2025
a2384cf
feat: Add create watchlist function
PaperMtn Dec 1, 2025
b7187cb
feat: Update pagination helper to return a list if the API endpoint r…
PaperMtn Dec 1, 2025
dfdb98e
chore: Remove unused imports
PaperMtn Dec 6, 2025
9caa984
chore: Update mappings
PaperMtn Dec 6, 2025
a01ea2a
fix Issue-148 and apply black formatting
MisterSeajay Dec 1, 2025
e703596
run black formatter
MisterSeajay Dec 2, 2025
98319fe
break long urls below 80 char line limit
MisterSeajay Dec 2, 2025
6da83ae
break long urls below 80 char line limit
MisterSeajay Dec 2, 2025
7a09a9a
Use ChronicleClient type hint
MisterSeajay Dec 2, 2025
5f4a115
Revert client: ChronicleClient type hint. :-(
MisterSeajay Dec 2, 2025
e88f456
update unit tests for paginated lists
MisterSeajay Dec 2, 2025
2cfa97d
make long url string construction consistent
MisterSeajay Dec 2, 2025
ccaee19
chore: added page_size condition. Added documentation. Fixed tests.
mihirvala08 Dec 4, 2025
9f8c6af
chore: fixed cli for parser list
mihirvala08 Dec 4, 2025
f252f4e
chore: added changelog. updated project version
mihirvala08 Dec 8, 2025
3d5cd68
refactor: Update to match new base url generation
PaperMtn Dec 6, 2025
73fecb4
feature: Implement helper for standard non-paginated requests
PaperMtn Dec 8, 2025
f491192
feature: Tests for watchlist functions
PaperMtn Dec 8, 2025
1a75c46
feature: Implement CLI arguments for watchlists
PaperMtn Dec 8, 2025
599005d
feature: Implement CLI arguments for watchlists
PaperMtn Dec 8, 2025
5e3be2e
chore: Update READMEs
PaperMtn Dec 9, 2025
2fde8b6
chore: Fix PyLint issues
PaperMtn Dec 9, 2025
f351ad2
Merge branch 'main' into feature/watchlist-implementation
PaperMtn Dec 10, 2025
61959a9
fix: Missing imports
PaperMtn Dec 10, 2025
b40b57a
fix: Missing imports
PaperMtn Dec 10, 2025
19daf69
feat: added support for log processing pipeline methods
mihirvala08 Dec 2, 2025
8a2f74a
chore: updated for p310 syntax
mihirvala08 Dec 11, 2025
fd3d470
Fix: Display help message for commands without arguments
moosterhof Dec 9, 2025
fcb4d01
chore: added help print for remaining commands
mihirvala08 Dec 10, 2025
d7bbf52
chore: fixed search arg check. format and linting fix.
mihirvala08 Dec 11, 2025
ec8c3ea
chore: added changelog. updated project version
mihirvala08 Dec 11, 2025
6f0c263
chore: added CLI support
mihirvala08 Dec 11, 2025
555ac13
chore: fixed examples.
mihirvala08 Dec 12, 2025
fca20f6
chore: added unit tests. updated pipeline id handling.
mihirvala08 Dec 15, 2025
4fc8977
chore: added integration tests. Added documentation.
mihirvala08 Dec 16, 2025
d5c0d99
chore: updated doc string
mihirvala08 Dec 16, 2025
1d0400f
chore: renamed patch to update. added changelog. updated project vers…
mihirvala08 Dec 17, 2025
b1c973f
chore: added API mapping
mihirvala08 Dec 17, 2025
ca956c8
chore: minor refactor
mihirvala08 Dec 17, 2025
cf953d8
Merge branch 'main' into feature/watchlist-implementation
PaperMtn Dec 17, 2025
aa05678
chore: minor refactoring and formatting.
mihirvala08 Dec 18, 2025
ebe94b5
chore: fixed unit test
mihirvala08 Dec 18, 2025
12fceba
chore: added support for watchlist update
mihirvala08 Dec 18, 2025
620d7ad
chore: fixed pagination token return for paginated request
mihirvala08 Dec 22, 2025
07cbb02
chore: added changelog. updated project version
mihirvala08 Dec 22, 2025
bb81114
chore: refactor and linting
mihirvala08 Dec 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.30.0] - 2025-12-22
### Added
- Support for following watchlist management methods:
- List watchlists
- Create watchlist
- Get watchlist details
- Update watchlist
- Delete watchlist

## [0.29.0] - 2025-12-17
### Added
- Support for following log/data processing pipeline methods:
Expand Down
43 changes: 43 additions & 0 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,49 @@ secops parser-extension activate --log-type OKTA --id "1234567890"
secops parser-extension delete --log-type OKTA --id "1234567890"
```

### Watchlist Management

List watchlists:

```bash
# List all watchlists
secops watchlist list

# List watchlist with pagination
secops watchlist list --page-size 50
```

Get watchlist details:

```bash
secops watchlist get --watchlist-id "abc-123-def"
```

Create a new watchlist:

```bash
secops watchlist create --name "my_watchlist" --display-name "my_watchlist" --description "My watchlist description" --multiplying-factor 1.5
```

Update a watchlist:

```bash
# Update display name and description
secops watchlist update --watchlist-id "abc-123-def" --display-name "Updated Name" --description "Updated description"

# Update multiplying factor and pin the watchlist
secops watchlist update --watchlist-id "abc-123-def" --multiplying-factor 2.0 --pinned true

# Update entity population mechanism (JSON string or file path)
secops watchlist update --watchlist-id "abc-123-def" --entity-population-mechanism '{"manual": {}}'
```

Delete a watchlist:

```bash
secops watchlist delete --watchlist-id "abc-123-def"
```

### Rule Management

List detection rules:
Expand Down
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,60 @@ extension_id = "1234567890"
chronicle.delete_parser_extension(log_type, extension_id)
```

## Watchlist Management

### Creating a Watchlist

Create a new watchlist:

```python
watchlist = chronicle.create_watchlist(
name="my_watchlist",
display_name="my_watchlist",
multiplying_factor=1.5,
description="My new watchlist"
)
```

### Updating a Watchlist

Update a watchlist by ID:

```python
updated_watchlist = chronicle.update_watchlist(
watchlist_id="abc-123-def",
display_name="Updated Watchlist Name",
description="Updated description",
multiplying_factor=2.0,
entity_population_mechanism={"manual": {}},
watchlist_user_preferences={"pinned": True}
)
```

### Deleting a Watchlist

Delete a watchlist by ID:

```python
chronicle.delete_watchlist("acb-123-def", force=True)
```

### Getting a Watchlist

Get a watchlist by ID:

```python
watchlist = chronicle.get_watchlist("acb-123-def")
```

### List all Watchlists

List all watchlists:

```python
watchlists = chronicle.list_watchlists()
```

## Rule Management

The SDK provides comprehensive support for managing Chronicle detection rules:
Expand Down
162 changes: 81 additions & 81 deletions api_module_mapping.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "secops"
version = "0.29.0"
version = "0.30.0"
description = "Python SDK for wrapping the Google SecOps API for common use cases"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
13 changes: 13 additions & 0 deletions src/secops/chronicle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@
find_udm_field_values,
)
from secops.chronicle.validate import validate_query
from secops.chronicle.watchlist import (
list_watchlists,
get_watchlist,
delete_watchlist,
create_watchlist,
update_watchlist,
)

__all__ = [
# Client
Expand Down Expand Up @@ -327,4 +334,10 @@
"fetch_associated_pipeline",
"fetch_sample_logs_by_streams",
"test_pipeline",
# Watchlist
"list_watchlists",
"get_watchlist",
"delete_watchlist",
"create_watchlist",
"update_watchlist",
]
133 changes: 133 additions & 0 deletions src/secops/chronicle/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@
find_udm_field_values as _find_udm_field_values,
)
from secops.chronicle.validate import validate_query as _validate_query
from secops.chronicle.watchlist import (
list_watchlists as _list_watchlists,
get_watchlist as _get_watchlist,
delete_watchlist as _delete_watchlist,
create_watchlist as _create_watchlist,
update_watchlist as _update_watchlist,
)
from secops.exceptions import SecOpsError


Expand Down Expand Up @@ -605,6 +612,132 @@ def validate_query(self, query: str) -> dict[str, Any]:
"""
return _validate_query(self, query)

def list_watchlists(
self,
page_size: int | None = None,
page_token: str | None = None,
) -> dict[str, Any]:
"""Get a list of all watchlists.

Args:
page_size: Maximum number of watchlists to return per page
page_token: Token for the next page of results, if available

Returns:
Dictionary with list of watchlists

Raises:
APIError: If the API request fails
"""
return _list_watchlists(self, page_size, page_token)

def get_watchlist(
self,
watchlist_id: str,
) -> dict[str, Any]:
"""Get a specific watchlist by ID.

Args:
watchlist_id: ID of the watchlist to retrieve

Returns:
Watchlist

Raises:
APIError: If the API request fails
"""
return _get_watchlist(self, watchlist_id)

def delete_watchlist(
self,
watchlist_id: str,
force: bool | None = None,
) -> dict[str, Any]:
"""Delete a watchlist by ID.

Args:
watchlist_id: ID of the watchlist to delete
force: Optional. If set to true, any entities under this
watchlist will also be deleted.
(Otherwise, the request will only work if the
watchlist has no entities.)

Returns:
Deleted watchlist

Raises:
APIError: If the API request fails
"""
return _delete_watchlist(self, watchlist_id, force)

def create_watchlist(
self,
name: str,
display_name: str,
multiplying_factor: float,
description: str | None = None,
) -> dict[str, Any]:
"""Create a watchlist

Args:
name: Name of the watchlist
display_name: Display name of the watchlist
multiplying_factor: Multiplying factor for the watchlist
description: Optional. Description of the watchlist

Returns:
Created watchlist

Raises:
APIError: If the API request fails
"""
return _create_watchlist(
self, name, display_name, multiplying_factor, description
)

def update_watchlist(
self,
watchlist_id: str,
display_name: str | None = None,
description: str | None = None,
multiplying_factor: float | None = None,
entity_population_mechanism: dict[str, Any] | None = None,
watchlist_user_preferences: dict[str, Any] | None = None,
update_mask: str | None = None,
) -> dict[str, Any]:
"""Update a watchlist.

Args:
watchlist_id: ID of the watchlist to update.
display_name: Optional. Display name of the watchlist.
Must be 1-63 characters.
description: Optional. Description of the watchlist.
multiplying_factor: Optional. Weight applied to risk score
for entities in this watchlist. Default is 1.0.
entity_population_mechanism: Optional. Mechanism to populate
entities in the watchlist. Example: {"manual": {}}.
watchlist_user_preferences: Optional. User preferences for
watchlist configuration. Example: {"pinned": True}.
update_mask: Optional. Comma-separated list of fields to
update. If not provided, all non-None fields are updated.

Returns:
Updated watchlist.

Raises:
APIError: If the API request fails.
"""
return _update_watchlist(
self,
watchlist_id,
display_name,
description,
multiplying_factor,
entity_population_mechanism,
watchlist_user_preferences,
update_mask,
)

def get_stats(
self,
query: str,
Expand Down
Empty file.
Loading